Adding select statements for build script environment and data attributes in bzlmod#3511
Conversation
15b7d65 to
72fb619
Compare
illicitonion
left a comment
There was a problem hiding this comment.
Looks reasonable to me - ideally we'd have more expressive annotations, or a helper function to generate this stuff, but this opens up capabilities we currently lack :) Thanks!
What would a helper function look like in this scenario? I'm unsure how to add functions into I had thought about adding a new tag class such as: But felt that was a little messy too as it isn't part of the original annotation. Have you any suggestions? |
416dc52 to
9b7635b
Compare
9b7635b to
f855550
Compare
These aren't currently supported by Bazel, but there's perpetually discussion about them :) sorry, I was saying "ideally" as in "if Bazel were more capable" rather than "if Finn put in more work" :D
This kind of new tag class is probably the nicest way to express this at the moment tbh, I wouldn't complain about this API at all. But also happy to merge this as-is if you don't fancy putting it together :) |
|
Merge as is for now and I'll consider the latter API. |
|
@illicitonion can we go with this as is for now? |
illicitonion
left a comment
There was a problem hiding this comment.
Weird, I thought I'd already merged this - sorry for the delay!
Adds an `annotation_select` tag class.
This annotation will add common environment variables:
```
crate.annotation(
crate = "foo",
build_scipt_data = [
"@bar",
],
build_script_env = {
"BAR": "bar",
},
)
```
This annotation will append a platform dependent select statement to the
above variables:
```
crate.annotation_select(
crate = "foo",
triples = ["x86_64-unknown-linux-gnu"],
build_script_data = [
"@baz",
],
build_script_env = {
"BAZ": "baz",
},
)
```
Attempts to improve #3511
---------
Co-authored-by: Daniel Wagner-Hall <dawagner@gmail.com>
An implementation to bring some select statement functionality which are available in repository rules but not bzlmod.
Since a dict of dicts is not supported, I've opted for a dict of json string which gets decoded on the other end.