tulsi
tulsi copied to clipboard
Project generation fails if WORKSPACE is missing apple rules repos
Running the Tulsi generator on a simple C++ Bazel project fails with the following error:
ERROR: while parsing ':all': no such package '': BUILD file not found on package path
ERROR: in /private/var/tmp/_bazel_matt.blair/463b60ab96858747c164e8476da8f7f2/external/tulsi/tulsi/tulsi_aspects.bzl: in /private/var/tmp/_bazel_matt.blair/463b60ab96858747c164e8476da8f7f2/external/tulsi/tulsi/tulsi_aspects_paths.bzl: Unable to load package for '@build_bazel_rules_apple//apple:providers.bzl': The repository could not be resolved
ERROR: Analysis of aspect '@tulsi//:tulsi/tulsi_aspects.bzl%tulsi_sources_aspect of //src:main' failed; build aborted: in /private/var/tmp/_bazel_matt.blair/463b60ab96858747c164e8476da8f7f2/external/tulsi/tulsi/tulsi_aspects.bzl: in /private/var/tmp/_bazel_matt.blair/463b60ab96858747c164e8476da8f7f2/external/tulsi/tulsi/tulsi_aspects_paths.bzl: Unable to load package for '@build_bazel_rules_apple//apple:providers.bzl': The repository could not be resolved
General failure: Bazel aspects could not be built.
Here is a minimal project that produces this error: test_tulsi_1.zip
This error is resolved if I add the following rules to my WORKSPACE:
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
git_repository(
name = "bazel_skylib",
remote = "https://github.com/bazelbuild/bazel-skylib.git",
tag = "0.7.0",
)
git_repository(
name = "build_bazel_rules_apple",
remote = "https://github.com/bazelbuild/rules_apple.git",
tag = "0.14.0",
)
git_repository(
name = "build_bazel_rules_swift",
remote = "https://github.com/bazelbuild/rules_swift.git",
tag = "0.7.0",
)
Including these rules is a reasonable requirement, but it isn't documented anywhere that this is the case. Tulsi should either include these rules automatically if absent, or document that these are required.
Using Tulsi version: https://github.com/bazelbuild/tulsi/tree/3dd59abc8d82e64b9ea35127b180318c87752afe Bazel version: 0.23.2 macOS version: 10.13.6