-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't use a label in build_file #855
Comments
This is a nifty idea, unfortunately it's not easy to do. A label doesn't distinguish between generated and source files (by design), and if it's a generated file, you can't know the contents of the file because nothing is executed before the build files are known. So now you have a bit of a chicken and egg problem. |
We do use label for Skylark extension that cannot be generated. I think On Fri, Feb 5, 2016 at 11:54 PM Alex Humesky [email protected]
|
After some discussion with Alex, even though it is feasible, it might not be desirable because of performance issues that might arise. |
Understood. Is the error message at least considered a bug? It was a bit unclear what was going on with a larger example. On Friday, February 5, 2016, Damien Martin-Guillerez <
P. Oscar Boykin, Ph.D. | http://twitter.com/posco | http://pobox.com/~boykin |
Yes definitely, the error reporting is terrible with remote repositories |
It's also not possible to use labels in For instance: # WORKSPACE
new_http_archive(
name = "docker_ubuntu",
build_file = "BUILD.ubuntu",
url = "https://codeload.github.com/tianon/docker-brew-ubuntu-core/zip/e406914e5f648003dfe8329b512c30c9ad0d2f9c",
sha256 = "de31e6fcb843068965de5945c11a6f86399be5e4208c7299fb7311634fb41943",
type = "zip",
strip_prefix = "docker-brew-ubuntu-core-e406914e5f648003dfe8329b512c30c9ad0d2f9c") # BUILD.ubuntu
load("//tools/build_defs/docker:docker.bzl", "docker_build")
docker_build(
name = "trusty",
tars = ["trusty/ubuntu-trusty-core-cloudimg-amd64-root.tar.gz"],
visibility = ["//visibility:public"]) $ bazel build @docker_ubuntu//:trusty
ERROR: error loading package '@docker_ubuntu//': Extension file not found. Unable to load package for '@docker_ubuntu//tools/build_defs/docker:docker.bzl': BUILD file not found on package path.
INFO: Elapsed time: 0.088s If I change that load statement back to |
I believe you can use "@//" to refer to the main repository from an external repository, so "@//tools/build_defs/docker:docker.bzl" |
I have that (using However, I had to do a bit of work related to issues with labels in the main vs default repositories first. Those changes are currently being reviewed. The big change is I8bd7f7b00bec58a7157507595421bc50c81b404c, but the current patch set on Gerrit is old because it depends on a two other changes which are being reviewed separately. Comments welcome on that and the other two: I3762e6be911b79a133a2959fce3a8bf34d183232 and If337eb2579ae613ba09cab0e0c927691922c0a39. I'm not sure if any of the halfway fixes made on master since then fixed this particular case, but my main-vs-default-cleanup branch definitely should work. |
The |
This still doesn't work for the csharp rules in the bazelbuild/rules_dotnet repsository. If I create a repository and reference the workspace using a local_repository rule in in the WORKSPACE file I get errors saying:
The easiest way to replicate is to copy the examples directory out of the rules_dotnet repo into it's own directory and create a WORKSPACE file there like so:
Then run |
Actually after looking at the closure issue it looks like the correct way is to do str(Label(...)) which is non-obvious but fixes the issue. Is this the intended behavior? |
in my workspace (to use scala) I have:
but if that build_file is a label I get:
The text was updated successfully, but these errors were encountered: