diff options
author | 2015-10-28 20:49:22 +0000 | |
---|---|---|
committer | 2015-10-29 07:47:10 +0000 | |
commit | 4a10251278872f8f00228da8a6a0e0d98f10bdc4 (patch) | |
tree | 414cf9a6223f3516ca629403bb2ba75de355b2ac /src/main/java/com/google/devtools/build/lib/analysis/constraints/ConstraintSemantics.java | |
parent | 0446c95d4e2f5e4a084744a10c87d631a92b3be0 (diff) |
Provide a way to explicitly constraint-enforce
attributes that would otherwise be skipped by
default policy.
This is the simplistic start to a user-controllable
enforcement policy API.
--
MOS_MIGRATED_REVID=106530210
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/constraints/ConstraintSemantics.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/analysis/constraints/ConstraintSemantics.java | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/constraints/ConstraintSemantics.java b/src/main/java/com/google/devtools/build/lib/analysis/constraints/ConstraintSemantics.java index 8355f1d322..9997de4cb2 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/constraints/ConstraintSemantics.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/constraints/ConstraintSemantics.java @@ -523,16 +523,18 @@ public class ConstraintSemantics { Type<?> attrType = attributes.getAttributeType(attr); // TODO(bazel-team): support a user-definable API for choosing which attributes are checked - if ((attrType != BuildType.LABEL && attrType != BuildType.LABEL_LIST) - || RuleClass.isConstraintAttribute(attr) - || attr.equals("visibility") - // Use the same implicit deps check that query uses. This facilitates running queries to - // determine exactly which rules need to be constraint-annotated for depot migrations. - || !Rule.NO_IMPLICIT_DEPS.apply(ruleContext.getRule(), attrDef) - // We can't identify host deps by calling BuildConfiguration.isHostConfiguration() - // because --nodistinct_host_configuration subverts that call. - || attrDef.getConfigurationTransition() == Attribute.ConfigurationTransition.HOST) { - continue; + if (!attrDef.checkConstraintsOverride()) { + if ((attrType != BuildType.LABEL && attrType != BuildType.LABEL_LIST) + || RuleClass.isConstraintAttribute(attr) + || attr.equals("visibility") + // Use the same implicit deps check that query uses. This facilitates running queries to + // determine exactly which rules need to be constraint-annotated for depot migrations. + || !Rule.NO_IMPLICIT_DEPS.apply(ruleContext.getRule(), attrDef) + // We can't identify host deps by calling BuildConfiguration.isHostConfiguration() + // because --nodistinct_host_configuration subverts that call. + || attrDef.getConfigurationTransition() == Attribute.ConfigurationTransition.HOST) { + continue; + } } for (TransitiveInfoCollection dep : |