-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Add attr.label_list_dict
#27119
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
Add attr.label_list_dict
#27119
Conversation
138edea to
6146d60
Compare
|
@lberki Choosing you as a reviewer based on #7989 (comment) :-) |
|
ping @lberki |
lberki
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the delay. Even today, I only had time to review the production code, but not the tests.
src/main/java/com/google/devtools/build/lib/bazel/repository/AttributeUtils.java
Outdated
Show resolved
Hide resolved
Motivating examples for adding this type: * Packaging rules that bundle targets into substructures (e.g. subdirectories). * Providing hints to aspects via a well-known implicit attribute mapping the names of other attributes to a list of well-known targets representing the semantic meaning of an edge (e.g. "compile time dep", "runtime dep", "third party dep", ...) for use in SBOM generation and packaging. * rules_js and other rulesets have `patches` parameters on their module extensions that accept lists of patches to apply per external dependency. With WORKSPACE, they relied on `attr.string_list_dict`, but the lack of repo mapping means that there is no direct port. Users would need to migrate to individual tags per hub repo and dep to supply patches. Adding this type doesn't incur a significant maintenance cost: * The native attribute type `LABEL_LIST_DICT` already exists (added for `exec_group_compatible_with`), so this only requires wiring it up in Starlark. * A Starlark type with equivalent BUILD syntax already exists (`attr.string_list_dict`), so there is no need for tooling to explicitly support the new type. RELNOTES[NEW]: The new `attr.label_list_dict` type accepts a dict in which keys are strings and values are lists of labels.
6146d60 to
a7e165e
Compare
|
Let's merge this then. @fmeum 's been waiting long enough. |
tetromino
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fabian, can you please also add the new type to AttributeType in stardoc_output.proto, and add support for it in AttributeInfoExtractor.java?
That's already on master as the native type existed before I added the Starlark type in this PR. |
tetromino
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fabian, can you please also add the new type to AttributeType in stardoc_output.proto, and add support for it in AttributeInfoExtractor.java?
That's already on master as the native type existed before I added the Starlark type in this PR.
Ahh - of course, you added it in f99a46f. I apologize for misreading.
|
@bazel-io fork 9.0.0 |
Motivating examples for adding this type: * Packaging rules that bundle targets into substructures (e.g. subdirectories). * Providing hints to aspects via a well-known implicit attribute mapping the names of other attributes to a list of well-known targets representing the semantic meaning of an edge (e.g. "compile time dep", "runtime dep", "third party dep", ...) for use in SBOM generation and packaging. * rules_js and other rulesets have `patches` parameters on their module extensions that accept lists of patches to apply per external dependency. With WORKSPACE, they relied on `attr.string_list_dict`, but the lack of repo mapping means that there is no direct port. Users would need to migrate to individual tags per hub repo and dep to supply patches. Adding this type doesn't incur a significant maintenance cost: * The native attribute type `LABEL_LIST_DICT` already exists (added for `exec_group_compatible_with`), so this only requires wiring it up in Starlark. In fact, some of the added logic (duplicate checking) is relevant for this existing use case, we just forgot to add it. * A Starlark type with equivalent BUILD syntax already exists (`attr.string_list_dict`), so there is no need for tooling to explicitly support the new type. Fixes bazelbuild#7989 RELNOTES[NEW]: The new `attr.label_list_dict` type accepts a dict in which keys are strings and values are lists of labels. Closes bazelbuild#27119. PiperOrigin-RevId: 828510272 Change-Id: Ibf5ba97d049e592af2f61d91dbaa42cfe264f0bb
|
Can this also be cherry-picked to |
|
@bazel-io fork 8.5.0 |
Motivating examples for adding this type: * Packaging rules that bundle targets into substructures (e.g. subdirectories). * Providing hints to aspects via a well-known implicit attribute mapping the names of other attributes to a list of well-known targets representing the semantic meaning of an edge (e.g. "compile time dep", "runtime dep", "third party dep", ...) for use in SBOM generation and packaging. * rules_js and other rulesets have `patches` parameters on their module extensions that accept lists of patches to apply per external dependency. With WORKSPACE, they relied on `attr.string_list_dict`, but the lack of repo mapping means that there is no direct port. Users would need to migrate to individual tags per hub repo and dep to supply patches. Adding this type doesn't incur a significant maintenance cost: * The native attribute type `LABEL_LIST_DICT` already exists (added for `exec_group_compatible_with`), so this only requires wiring it up in Starlark. In fact, some of the added logic (duplicate checking) is relevant for this existing use case, we just forgot to add it. * A Starlark type with equivalent BUILD syntax already exists (`attr.string_list_dict`), so there is no need for tooling to explicitly support the new type. Fixes #7989 RELNOTES[NEW]: The new `attr.label_list_dict` type accepts a dict in which keys are strings and values are lists of labels. Closes #27119. PiperOrigin-RevId: 828510272 Change-Id: Ibf5ba97d049e592af2f61d91dbaa42cfe264f0bb Commit b0f51a9 Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
Motivating examples for adding this type:
patchesparameters on their module extensions that accept lists of patches to apply per external dependency. With WORKSPACE, they relied onattr.string_list_dict, but the lack of repo mapping means that there is no direct port. Users would need to migrate to individual tags per hub repo and dep to supply patches.Adding this type doesn't incur a significant maintenance cost:
LABEL_LIST_DICTalready exists (added forexec_group_compatible_with), so this only requires wiring it up in Starlark. In fact, some of the added logic (duplicate checking) is relevant for this existing use case, we just forgot to add it.attr.string_list_dict), so there is no need for tooling to explicitly support the new type.Fixes #7989
RELNOTES[NEW]: The new
attr.label_list_dicttype accepts a dict in which keys are strings and values are lists of labels.