[L] Change in bazel/bazel[master]: Add `refines_constraint_value` attribute to `constraint_setting` (htt...

0 views
Skip to first unread message

Copybara Service (Gerrit)

unread,
12:27 PM (4 hours ago) 12:27 PM
to Fabian Meumertzheim

Copybara Service submitted the change

Change information

Commit message:
Add `refines_constraint_value` attribute to `constraint_setting` (https://github.com/bazelbuild/bazel/pull/29655)

Implements [Hierarchical constraint settings](https://docs.google.com/document/d/1Lq-0aPBOT0cat1wcFbnPmurbyo05NpZXu0uGq12H_HE) ([discussion #28877](https://github.com/bazelbuild/bazel/discussions/28877)).

Adds a new optional, label-valued `refines_constraint_value` attribute on `constraint_setting`. This lets a `constraint_setting` express that any of its `constraint_value`s refine (i.e., imply) a particular `constraint_value` of another setting (e.g. a `//libc/glibc:version` setting refining `//libc:glibc`).

This has two consequences:

* **Platform validation.** Any `platform` that declares a non-default `constraint_value` for a refining setting must also declare the refined `constraint_value` (directly or via a parent platform). Bazel reports an actionable error including a `buildozer` fixup.

* **`select()` specificity.** A condition that matches via a refining `constraint_value` is treated as more specific than a condition that matches only via the refined `constraint_value`, so both can co-exist in the same `select()` without producing an "ambiguous match" error.

> Note: the design doc calls this attribute `refines_value`. It is renamed to `refines_constraint_value` here for symmetry with `default_constraint_value`.

RELNOTES: The new `refines_constraint_value` attribute on `constraint_setting` can be used to indicate that any non-default value for that setting specified on a `platform` requires the refined value to also be specified.

Closes #29655.
PiperOrigin-RevId: 926078211
Change-Id: Ic82738f2771adf7469f267aeea9dc020f203f8e5
Files:
  • M src/main/java/com/google/devtools/build/lib/analysis/platform/ConstraintSettingInfo.java
  • M src/main/java/com/google/devtools/build/lib/rules/config/ConfigSetting.java
  • M src/main/java/com/google/devtools/build/lib/rules/platform/ConstraintSetting.java
  • M src/main/java/com/google/devtools/build/lib/rules/platform/ConstraintSettingRule.java
  • M src/main/java/com/google/devtools/build/lib/rules/platform/Platform.java
  • M src/test/java/com/google/devtools/build/lib/analysis/ConfigurableAttributesTest.java
  • M src/test/java/com/google/devtools/build/lib/analysis/platform/ConstraintCollectionTest.java
  • M src/test/java/com/google/devtools/build/lib/rules/config/ConfigSettingTest.java
  • M src/test/java/com/google/devtools/build/lib/rules/platform/ConstraintTest.java
  • M src/test/java/com/google/devtools/build/lib/rules/platform/PlatformInfoApiTest.java
Change size: L
Delta: 10 files changed, 695 insertions(+), 13 deletions(-)
Branch: refs/heads/master
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: bazel
Gerrit-Branch: master
Gerrit-Change-Id: Ic82738f2771adf7469f267aeea9dc020f203f8e5
Gerrit-Change-Number: 329590
Gerrit-PatchSet: 4
Gerrit-Owner: Copybara Service <copybara-wor...@google.com>
Gerrit-CC: Fabian Meumertzheim <fab...@meumertzhe.im>
open
diffy

Copybara Service (Gerrit)

unread,
12:27 PM (4 hours ago) 12:27 PM
to Fabian Meumertzheim

Copybara Service uploaded new patchset

Copybara Service uploaded patch set #4 to this change.
Open in Gerrit

Related details

Attention set is empty
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
open
diffy
Reply all
Reply to author
Forward
0 new messages