[8.7.0] Support external repository labels in package_group#28896
Merged
Wyverald merged 1 commit intobazelbuild:release-8.7.0from Mar 23, 2026
Merged
[8.7.0] Support external repository labels in package_group#28896Wyverald merged 1 commit intobazelbuild:release-8.7.0from
Wyverald merged 1 commit intobazelbuild:release-8.7.0from
Conversation
dd10d70 to
2ea93ab
Compare
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
2ea93ab to
5b5e3cf
Compare
Wyverald
approved these changes
Mar 23, 2026
Merged
via the queue into
bazelbuild:release-8.7.0
with commit Mar 23, 2026
4ef27a5
46 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-pick dfe9326 for release-8.7.0 branch