Add refines_constraint_value attribute to constraint_setting#29655
Draft
fmeum wants to merge 2 commits into
Draft
Add refines_constraint_value attribute to constraint_setting#29655fmeum wants to merge 2 commits into
refines_constraint_value attribute to constraint_setting#29655fmeum wants to merge 2 commits into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Adds a new optional, label-valued `refines_constraint_value` attribute to `constraint_setting`. This makes it possible to express that a constraint setting hierarchically refines a constraint value of another setting, e.g. a glibc version setting refining the libc=glibc value. Semantics: * 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). The error message includes a buildozer fixup command. Platforms that resolve to the setting's default value (whether implicitly or by declaring it explicitly) do not pull in the refined value, so a "no information" default can coexist with refinement. * In a select(), a condition that matches via a refining constraint_value is treated as more specific than a condition that matches via the refined constraint_value, so the two can co-exist without producing an "ambiguous match" error. `refines_constraint_value` and `default_constraint_value` may be set on the same `constraint_setting`. Implementation: * `ConstraintSettingInfo` stores the immediate refines label plus a pointer to the refined setting; the transitive refinement chain is materialized on demand to keep storage linear in the depth of the refinement graph (which can be 40+ levels deep in practice). * `ConfigSetting` includes the refinement chain in `ConfigMatchingProvider.constraintValuesSetting`, so the existing `refines()` set-containment logic picks up refinement relationships. * `Platform` validates that refined constraint values are present, checking the entire parent chain. Default refining values are exempt.
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.
Implements Hierarchical constraint settings (discussion #28877).
Adds a new optional, label-valued
refines_constraint_valueattribute onconstraint_setting. This lets aconstraint_settingexpress that any of itsconstraint_values refine (i.e., imply) a particularconstraint_valueof another setting (e.g. a//libc/glibc:versionsetting refining//libc:glibc).This has two consequences:
Platform validation. Any
platformthat declares a non-defaultconstraint_valuefor a refining setting must also declare the refinedconstraint_value(directly or via a parent platform). Bazel reports an actionable error including abuildozerfixup.select()specificity. A condition that matches via a refiningconstraint_valueis treated as more specific than a condition that matches only via the refinedconstraint_value, so both can co-exist in the sameselect()without producing an "ambiguous match" error.RELNOTES: The new
refines_constraint_valueattribute onconstraint_settingcan be used to indicate that any non-default value for that setting specified on aplatformrequires the refined value to also be specified.