-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Label resolution fails by repo mapping when used by a repo rule inside a module extension #14659
Comments
Thank you @fitzner for the extensive repo archive! I'm looking into this. |
Sorry for the very late response but I finally found some cycles to debug this. Turns out this is a very subtle bug in our usage of This means that all text labels given to attributes are treated as if they're specified in the imaginary Unfortunately the fix here isn't trivial, since it's not very clear what to use instead of bazel/src/main/java/com/google/devtools/build/lib/packages/Package.java Lines 1086 to 1088 in c878c67
So this change might take a little more time. At least we know what's broken! |
We just switched to While this bug breaks several attributes in |
Could you clarify your example with a code snippet? It's unclear to me if those are repo rule attributes, if this is a WORKSPACE file or a .bzl file or some other file, etc. In general (assuming this is the WORKSPACE file), the repo mapping you specify for a repo applies to things within the repo, not the patch file you're passing to it (which is resolved in the WORKSPACE file's context). |
WORKSPACE:
|
Then that is intended (see my comment above). Labels within the |
Thanks. What should be done for this dep tree (repo-name:version-number):
Where multiple versions of In this case we need two instantions of b:
|
Hi, ping re my q above. Thanks. |
Ping again. |
sorry for the delay. In your case, since you need two instantions of b, you'll necessarily need to have two
|
Thanks. This is exactly what we do for our h/ware IPs, using our dep-management tool. |
Description of the problem / feature request:
We are facing an issue when a module is used from a bzlmod registry and e.g. a http_archive repo rule inside the extension do reference a label from the module repository.
It seems that the repo mapping is wrongly used in that context.
We just observe the issue when the module is fetched from a registry. When we use 'archive_override' or 'local_path_override' in the main module everything works.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
MODULE.bazel in the foo module and registry
source.json from the registry
extensions.bzl in the foo module
BUILD.bug from in th foo module
MODULE.bazel in the test project
When
bazelisk build @foo//:test
is executed it leads to the described error.What operating system are you running Bazel on?
Linux Ubuntu 20.04.3, MacOs 10.15.7
What's the output of
bazel info release
?release 5.0.0
If
bazel info release
returns "development version" or "(@non-git)", tell us how you built Bazel.What's the output of
git remote get-url origin ; git rev-parse master ; git rev-parse HEAD
?Have you found anything relevant by searching the web?
Any other information, logs, or outputs that you want to share?
Find the example package to reproduce the issue as an attachment.
example.tar.gz
The text was updated successfully, but these errors were encountered: