-
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
bzlmod external repo name and copts #15553
Comments
Not saying this is a good answer, but you can create a def canonical_repo_name():
return native.repository_name()[1:] # Skip over the leading '@' Then, call that function from a BUILD file in |
I just stumbled over the following; this could be used as a workaround.
|
This feature would make this unnecessary in one case, which in my experience is the most common case. |
This is partially addressed by the REPO.bazel proposal (#18077), except that |
Bazel also has to work around a similar issue by bazel/src/tools/bzlmod/utils.bzl Lines 17 to 21 in b264850
I'll close this one since there is workaround and not much else we can do from Bzlmod side. |
Description of the bug:
Bzlmod stores modules as external repos in external/<module>.<version>. By using labels in rules the correct locations are resolved.
However in some cases it is necessary to use copts from cc_binary and cc_library to include further headers and in that case there is no option to define the external workspace via a variable in the rules copts.
Depending on how bzlmod includes external repos the name is different.
Use of the registry
bazel_dep(name = "foo", version = "0.1.0")
=> external/foo.0.1.0
Use of local_path_override
local_path_override(
module_name = "foo",
path = "../projects/foo/"
)
=> external/foo
This behaviour is problematic when referencing an external workspace in the copts.
For an example please see the attachment example.tar.gz.
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
See example
Which operating system are you running Bazel on?
MacOS Monterey 12.3.1
What is the output of
bazel info release
?release 5.1.1
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: