Skip to content

[8.7.0] Support external repository labels in package_group#28896

Merged
Wyverald merged 1 commit intobazelbuild:release-8.7.0from
meteorcloudy:cherry-pick-dfe9326
Mar 23, 2026
Merged

[8.7.0] Support external repository labels in package_group#28896
Wyverald merged 1 commit intobazelbuild:release-8.7.0from
meteorcloudy:cherry-pick-dfe9326

Conversation

@meteorcloudy
Copy link
Copy Markdown
Member

Cherry-pick dfe9326 for release-8.7.0 branch

@meteorcloudy meteorcloudy requested a review from a team as a code owner March 5, 2026 12:41
@github-actions github-actions Bot added team-Configurability platforms, toolchains, cquery, select(), config transitions awaiting-review PR is awaiting review from an assigned reviewer labels Mar 5, 2026
@meteorcloudy meteorcloudy requested a review from Wyverald March 5, 2026 12:44
@meteorcloudy meteorcloudy enabled auto-merge March 5, 2026 12:44
@meteorcloudy meteorcloudy force-pushed the cherry-pick-dfe9326 branch from dd10d70 to 2ea93ab Compare March 5, 2026 12:51
This PR enables `package_group` to correctly interpret labels that include external repositories (e.g., `@module//...` or `@module//:__subpackages__`).

Previously, `PackageSpecification.java` strictly required package names to start with `//`, failing on labels with repository prefixes. This made it impossible to define a `package_group` that includes packages from other Bzlmod modules. This change leverages `Label.parseWithRepoContext` to correctly resolve repository mapping and validate package specifications within the context of the repository where the `package_group` is defined.

Fixes an issue where bazel build would fail when a `package_group` referenced an external repository in its `packages` attribute.

Yes. This change affects the behavior of the `package_group` rule and the `visibility()` function in `.bzl` files.

1. Has this been discussed in a design doc or issue? No, but the change and impact should be straightforward to understand.
2. Is the change backward compatible? Yes, it relaxes a restriction that previously caused errors.
3. If it's a breaking change, what is the migration plan? N/A

- [x] I have added tests for the new use cases (if any).
- [ ] I have updated the documentation (if applicable).

RELNOTES: `package_group` now supports labels with external repositories in the `packages` attribute.

Closes bazelbuild#28811.

PiperOrigin-RevId: 878957471
Change-Id: Ic84df870374fb8c6f6f24d6fdff388d909750469
@meteorcloudy meteorcloudy force-pushed the cherry-pick-dfe9326 branch from 2ea93ab to 5b5e3cf Compare March 5, 2026 12:59
@meteorcloudy meteorcloudy added this pull request to the merge queue Mar 23, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Mar 23, 2026
@Wyverald Wyverald added this pull request to the merge queue Mar 23, 2026
Merged via the queue into bazelbuild:release-8.7.0 with commit 4ef27a5 Mar 23, 2026
46 checks passed
@github-actions github-actions Bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Mar 23, 2026
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants