diff options
author | jcater <jcater@google.com> | 2018-06-19 14:14:34 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-19 14:15:59 -0700 |
commit | 5f292bb18e98172a3540c92bfa7d38eba1cac624 (patch) | |
tree | 044ed085ca19968b8ad12b635863d863956b939c /src/main/java/com/google/devtools/build/lib/packages | |
parent | e032e31abefe9643ded6686a30458429690a4cf5 (diff) |
Be more permissive when dealing with rules which have
ExecutionPlatformConstraintsAllowed set to PER_TARGET and also have an
alread-existing exec_compatible_with attribute.
PiperOrigin-RevId: 201238805
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/packages')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/packages/RuleClass.java | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java b/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java index 75fd947223..fba4c92a65 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java +++ b/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java @@ -703,13 +703,6 @@ public class RuleClass { "Attribute %s is inherited multiple times in %s ruleclass", attrName, name); - if (attrName.equals("exec_compatible_with") - && parent.executionPlatformConstraintsAllowed - == ExecutionPlatformConstraintsAllowed.PER_TARGET) { - // This attribute should not be inherited because executionPlatformConstraintsAllowed is - // not inherited. - continue; - } attributes.put(attrName, attribute); } @@ -762,13 +755,8 @@ public class RuleClass { if (type == RuleClassType.PLACEHOLDER) { Preconditions.checkNotNull(ruleDefinitionEnvironmentHashCode, this.name); } - if (executionPlatformConstraintsAllowed == ExecutionPlatformConstraintsAllowed.PER_TARGET) { - // Only rules that allow per target execution constraints need this attribute. - Preconditions.checkState( - !this.attributes.containsKey("exec_compatible_with"), - "Rule %s should not already define the attribute \"exec_compatible_with\"" - + " because executionPlatformConstraintsAllowed is set to PER_TARGET", - key); + if (executionPlatformConstraintsAllowed == ExecutionPlatformConstraintsAllowed.PER_TARGET + && !this.contains("exec_compatible_with")) { this.add( attr("exec_compatible_with", BuildType.LABEL_LIST) .allowedFileTypes() |