-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
Resolve Label
s for toolchain roots and sysroots correctly under bzlmod
#235
Resolve Label
s for toolchain roots and sysroots correctly under bzlmod
#235
Conversation
3327e60
to
35c601b
Compare
Potentially-silly question - why do we need to support LLVM at absolute paths? Can't the user have a |
Not silly at all. This was for avoiding the sandbox overhead when using llvm with an http_archive rule. So relative paths to the extracted repo become absolute paths, and the files don't have to be brought into the sandbox. When this project started, the sandboxing overhead in Bazel was significant. I don't know how it looks like now. |
That makes sense. Nowadays |
Might be OK to do it. Do you mean to remove it only for bzlmod or for both? I have not been keeping up with the ecosystem (my active involvement with Bazel was 4-5 years ago), so I don't have a strong opinion either way. You can decide between @rrbutani and yourself. |
I don't have a strong opinion about whether to support absolute paths; I don't personally use the feature and I agree that dropping support for it would be a nice simplification. However, I think this is somewhat orthogonal to this PR; besides absolute paths the other reason this PR adds the (slightly weird) inverted toolchain root and sysroot label maps is to allow users to route multiple os/arch keys to the same toolchain_roots = {
"ubuntu-20.04-linux-x86_64": "@llvm_toolchain_root",
"arch-linux-x86_64": "@llvm_toolchain_root",
}, If we were to make Assuming we want the above to be expressible1, we have some options:
I have no real opinion about which of these approaches to go with or whether we should support 1:many mappings at all. I went the indirection route because it preserves the existing functionality and because I think it's a less-worse breaking change (it'll at least error in a way that makes it obvious what attrs you need to change) but ultimately I was just trying to get the tests to pass under bzlmod. Footnotes
|
Fair enough, I can send PRs removing the absolute paths separately. I'm not sure if people use distro keys, we do not. But we do use a universal sysroot for OSX somit covers two arches. I wouldn't mind getting by with the alias workaround though. |
@siddharthab @jsharpe: Do you have opinions about whether to keep the 1-to many functionality/whether the breaking change in this PR as implemented is acceptable? |
I have not had time to look into this properly. Honestly, I have not even looked into what bzlmod implies. Will do this tomorrow. Thanks for all your help @rrbutani, very appreciated. |
Sorry, running behind with this, but still on my mind. Will try to get to this sometime this week. |
No rush; I was just going through my open PRs. It doesn't seem like this is affecting anyone's work flow (#234 was just about the test suite not passing). |
Thanks. I had a chance to look today. I prefer a comma-separated string list as the simplest and most concise option here. I do not anticipate commas being used as part of distro names. If commas can indeed be used, maybe some other separator, or perhaps your json encoding option. If we choose commas now and later realize it was a mistake, we can introduce an escape mechanism (small chance). I think that Bazel never introduced more value types other than a string in label_keyed_string_dict, is because they expected a string to encode arbitrary information. |
👍 Sounds good to me; I'll update this PR to match (probably not before this weekend though).
I think this has more to do with the pain involved with adding new attribute types to Bazel. If you're going to only offer one dict-label attribute type |
Thanks for your great work so far! I tried using this branch for our migration to bzlmod and it seems to work fine so far. Has there been any progress towards getting this merged in the past months? No hurries at all, I just would like to learn about your plans. |
Apologies, I dropped the ball on this. I still need to implement the interface changes that were requested. I should have time to do so this coming weekend. |
Instead of going through the additional indirection, this could also be solved by adding a dedicated
All these tags could have optional |
Is there any plan to get this landed and issuing a major version bump? |
I will wrap up this PR in the next few days. |
a6f32b6
to
f990dec
Compare
f5036c4
to
9127e1d
Compare
@siddharthab sorry for dropping the ball on this; thanks for finishing it up |
Currently the repo rule and tag class accept string-form labels for toolchain root packages and sysroots. Under
bzlmod
this is problematic because users may pass us labels that point at repos that are not in this module's repo mapping. To support such labels, they need to be passed to us as actualLabel
s (not strings).This necessitates some (breaking) changes to interface for the repo rule and tag class.
For
toolchain_roots
:Label -> string
attribute (i.e.label_keyed_string_dict
) wouldn't workAdding a level of indirection (
toolchain_roots_label_map
) was the least-worst solution I could come up with:While this is a breaking change, it shouldn't be too bad though; there's no potential for silent errors and the error message provides a good hint about what change needs to be made I think.
I've applied a similar change to
sysroot
:For
sysroot
I considered just flipping the map since I think forcing a1:1
mapping would be more acceptable but:I've also enabled bzlmod-enabled tests for the system paths, absolute paths, and cross tests in CI.
Fixes #234. cc: @steve-261370