Skip to content

Conversation

@bazel-io
Copy link
Member

@bazel-io bazel-io commented Nov 5, 2025

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

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
@bazel-io bazel-io requested a review from a team as a code owner November 5, 2025 18:11
@bazel-io bazel-io added team-Configurability platforms, toolchains, cquery, select(), config transitions team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. awaiting-review PR is awaiting review from an assigned reviewer labels Nov 5, 2025
@bazel-io bazel-io requested review from lberki and tetromino November 5, 2025 18:11
@meteorcloudy meteorcloudy added this pull request to the merge queue Nov 6, 2025
Merged via the queue into bazelbuild:release-9.0.0 with commit 121ae62 Nov 6, 2025
46 checks passed
@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-Configurability platforms, toolchains, cquery, select(), config transitions team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants