Support external repository labels in package_group#28811
Support external repository labels in package_group#28811meteorcloudy wants to merge 3 commits intobazelbuild:masterfrom
Conversation
2ec99a5 to
2b4c509
Compare
|
@brandjon @Wyverald What do you think about this change? @mkruskal-google needs this for limiting certain abseil targets visibility to a specific new BCR module. already works when you have a |
|
Does this work with nodep deps? That would resolve concerns about increased dep footprint. |
|
@fmeum Unfortunately no, nodep requires |
|
FYI @gregestren |
| */ | ||
| public static PackageSpecification fromStringForBzlVisibility( | ||
| RepositoryName repositoryName, String spec) throws EvalException { | ||
| RepositoryMapping mapper, RepositoryName repositoryName, String spec) throws EvalException { |
| package_group( | ||
| name = "banana", | ||
| packages = ["@veggies//:cucumber"], | ||
| packages = ["@@veggies//cucumber"], |
There was a problem hiding this comment.
AFAICT there's no test that exercises the repo mapping logic (ie. single @). can you add one?
2b4c509 to
bced873
Compare
|
@bazel-io fork 9.1.0 |
|
@bazel-io fork 8.7.0 |
### Description This PR enables `package_group` to correctly interpret labels that include external repositories (e.g., `@module//...` or `@module//:__subpackages__`). ### Motivation 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. ### Build API Changes 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 ### Checklist - [x] I have added tests for the new use cases (if any). - [ ] I have updated the documentation (if applicable). ### Release Notes RELNOTES: `package_group` now supports labels with external repositories in the `packages` attribute. Closes bazelbuild#28811. PiperOrigin-RevId: 878957471 Change-Id: Ic84df870374fb8c6f6f24d6fdff388d909750469
|
@bazel-io fork 9.0.1 |
### Description This PR enables `package_group` to correctly interpret labels that include external repositories (e.g., `@module//...` or `@module//:__subpackages__`). ### Motivation 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. ### Build API Changes 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 ### Checklist - [x] I have added tests for the new use cases (if any). - [ ] I have updated the documentation (if applicable). ### Release Notes RELNOTES: `package_group` now supports labels with external repositories in the `packages` attribute. Closes bazelbuild#28811. PiperOrigin-RevId: 878957471 Change-Id: Ic84df870374fb8c6f6f24d6fdff388d909750469
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
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
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
…28895) ### Description This PR enables `package_group` to correctly interpret labels that include external repositories (e.g., `@module//...` or `@module//:__subpackages__`). ### Motivation 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. ### Build API Changes 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 ### Checklist - [x] I have added tests for the new use cases (if any). - [ ] I have updated the documentation (if applicable). ### Release Notes RELNOTES: `package_group` now supports labels with external repositories in the `packages` attribute. Closes #28811. PiperOrigin-RevId: 878957471 Change-Id: Ic84df870374fb8c6f6f24d6fdff388d909750469 Commit dfe9326 Co-authored-by: Yun Peng <[email protected]>
…28893) ### Description This PR enables `package_group` to correctly interpret labels that include external repositories (e.g., `@module//...` or `@module//:__subpackages__`). ### Motivation 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. ### Build API Changes 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 ### Checklist - [x] I have added tests for the new use cases (if any). - [ ] I have updated the documentation (if applicable). ### Release Notes RELNOTES: `package_group` now supports labels with external repositories in the `packages` attribute. Closes #28811. PiperOrigin-RevId: 878957471 Change-Id: Ic84df870374fb8c6f6f24d6fdff388d909750469 Commit dfe9326 Co-authored-by: Yun Peng <[email protected]>
|
Rolled back at 4eac06f due to internal breakages. |
|
Likely we just need to clean up the depot, so we don't have to rollback in release branches. |
Description
This PR enables
package_groupto correctly interpret labels that include external repositories (e.g.,@module//...or@module//:__subpackages__).Motivation
Previously,
PackageSpecification.javastrictly required package names to start with//, failing on labels with repository prefixes. This made it impossible to define apackage_groupthat includes packages from other Bzlmod modules. This change leveragesLabel.parseWithRepoContextto correctly resolve repository mapping and validate package specifications within the context of the repository where thepackage_groupis defined.Fixes an issue where bazel build would fail when a
package_groupreferenced an external repository in itspackagesattribute.Build API Changes
Yes. This change affects the behavior of the
package_grouprule and thevisibility()function in.bzlfiles.Checklist
Release Notes
RELNOTES:
package_groupnow supports labels with external repositories in thepackagesattribute.