-
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
Need string_keyed_label_list_dict
#7989
Comments
bazelbuild/bazel#5356 and bazelbuild/bazel#7989, are duplicates, and the former was closed. So let's link to the latter instead.
See this explanation of why we're loathe to add new attribute types. |
The linked explanation explains well why adding new attribute types is something one really wants to avoid, but I think
The way I see it, the absence of If one has a collection of very similar targets that one requires to have individual control of, it feels unnatural to do something like this: TOOLCHAIN_ATTRS = [
"compiler": attr.label(...),
"asan": attr.label(default="@myworkspace//:asan"),
"lsan": attr.label(default="@myworkspace//:lsan"),
"ubsan": attr.label(default="@myworkspace//:ubsan"),
...
] In BUILD files we would have to put With TOOLCHAIN_ATTRS = [
"compiler": attr.label(...),
"sanitizers": attr.string_keyed_label_dict(
default = {
"asan": "@myworkspace//:asan",
"lsan": "@myworkspace//:lsan",
"ubsan": "@myworkspace//:ubsan",
...
},
),
) The current attributes already cover the usecase. But we technically don't need
|
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team ( |
I'm also of the opinion that With that said, cc @fmeum |
This really just exposes the existing LABEL_DICT_UNARY type that already exists in Java. Other than writing some boring conversion logic, all pieces fell together pretty pleasantly. Work towards #7989. That one calls for a string-to-label-list-dict type, but I'm planning to resolve that as WAI, since string-to-label-dict is close enough. RELNOTES: None. PiperOrigin-RevId: 686415025 Change-Id: Ib07ada7ab2ede95220ed1cc2d3569996fc4afb88
3ef2abc implements the string-to-label-dict attribute type. For complicated reasons, string-to-label-list-dict would be considerably more complicated to implement and as the last comment by @Wyverald says, the utility of string-to-label-list-dict over string-to-label-dict is marginal. So I consider this bug fixed; on the off chance that string-to-label-list-dict is indispensable, please re-open, but don't expect a very quick resolution. |
Could we backport this to 7.4.0 and 8.0.0? Otherwise it will take a long time for this to be adoptable by rulesets. |
Yeah, I will need to do some backporting (not just this change), but I'll also need to earmark some time for it... |
This really just exposes the existing LABEL_DICT_UNARY type that already exists in Java. Other than writing some boring conversion logic, all pieces fell together pretty pleasantly. Work towards #7989. That one calls for a string-to-label-list-dict type, but I'm planning to resolve that as WAI, since string-to-label-dict is close enough. RELNOTES: None. PiperOrigin-RevId: 686415025 Change-Id: Ib07ada7ab2ede95220ed1cc2d3569996fc4afb88
#23997 for 8.0.0 |
This really just exposes the existing LABEL_DICT_UNARY type that already exists in Java. Other than writing some boring conversion logic, all pieces fell together pretty pleasantly. Work towards #7989. That one calls for a string-to-label-list-dict type, but I'm planning to resolve that as WAI, since string-to-label-dict is close enough. RELNOTES: None. PiperOrigin-RevId: 686415025 Change-Id: Ib07ada7ab2ede95220ed1cc2d3569996fc4afb88
#23998 for 7.4.0 |
This really just exposes the existing LABEL_DICT_UNARY type that already exists in Java. Other than writing some boring conversion logic, all pieces fell together pretty pleasantly. Work towards #7989. That one calls for a string-to-label-list-dict type, but I'm planning to resolve that as WAI, since string-to-label-dict is close enough. RELNOTES: None. PiperOrigin-RevId: 686415025 Change-Id: Ib07ada7ab2ede95220ed1cc2d3569996fc4afb88
This really just exposes the existing LABEL_DICT_UNARY type that already exists in Java. Other than writing some boring conversion logic, all pieces fell together pretty pleasantly. Work towards #7989. That one calls for a string-to-label-list-dict type, but I'm planning to resolve that as WAI, since string-to-label-dict is close enough. RELNOTES: None. PiperOrigin-RevId: 686415025 Change-Id: Ib07ada7ab2ede95220ed1cc2d3569996fc4afb88
This really just exposes the existing LABEL_DICT_UNARY type that already exists in Java. Other than writing some boring conversion logic, all pieces fell together pretty pleasantly. Work towards #7989. That one calls for a string-to-label-list-dict type, but I'm planning to resolve that as WAI, since string-to-label-dict is close enough. RELNOTES: None. PiperOrigin-RevId: 686415025 Change-Id: Ib07ada7ab2ede95220ed1cc2d3569996fc4afb88
@Wyverald's comment says that you don't usually need a string-to-label-list-dict because you can transform that into a string-to-label-dict and a few separate rules like this:
can be transformed into
|
Yes, it's possible to do that, but it's not ergonomic, and requires an extra dependency lookup. The proposed use case from #23802 is for adding new exec constraints to exec groups. The specific proposal is for the syntax:
So a) any target can use this attribute, and b) it's part of toolchain resolution, and thus happens before any dependencies are resolved. Due to this, trying to decompose into a separate |
I won't volunteer for adding |
Can this issue be reopened since this was not implemented? |
Re-opened, not sure if I'm going to have time to tackle it, however. |
Good news, being fixed as part of #24964. |
Motivation.
my_pkg_tar
not repeating directories list:instead of:
select
's of dicts (and even more+
is deprecated), one can not write:And we could write:
The text was updated successfully, but these errors were encountered: