aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Ulf Adams <ulfjack@google.com>2015-09-08 13:25:35 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2015-09-08 17:26:18 +0000
commit0b6389723a8d9d3a92e49dc0412fb395b62dc32c (patch)
tree2514064f0ee6141d12051a1338a2d560f57e491f /src
parent240eb7888627967252229979c3029097f58cbb38 (diff)
Avoid checking visibility and other constraints for the lipo dependency.
The lipo dependency is artificial; it's an artifact of how LIPO is implemented in Bazel. Running these checks doesn't make sense; they unnecessarily disallow perfectly valid scenarios. -- MOS_MIGRATED_REVID=102550286
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/Attribute.java16
3 files changed, 21 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
index 16982f0519..0cfb114da0 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
@@ -1570,7 +1570,9 @@ public final class RuleContext extends TargetContext
validateDirectPrerequisiteType(prerequisite, attribute);
validateDirectPrerequisiteFileTypes(prerequisite, attribute);
validateMandatoryProviders(prerequisite, attribute);
- prerequisiteValidator.validate(this, prerequisite, attribute);
+ if (attribute.performConstraintsCheck()) {
+ prerequisiteValidator.validate(this, prerequisite, attribute);
+ }
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java
index 5e4a7afa7a..1437192d50 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java
@@ -374,7 +374,8 @@ public class BazelCppRuleClasses {
.add(attr("includes", STRING_LIST))
.add(attr(":lipo_context_collector", LABEL)
.cfg(CppTransition.LIPO_COLLECTOR)
- .value(LIPO_CONTEXT_COLLECTOR))
+ .value(LIPO_CONTEXT_COLLECTOR)
+ .skipConstraintsCheck())
.build();
}
diff --git a/src/main/java/com/google/devtools/build/lib/packages/Attribute.java b/src/main/java/com/google/devtools/build/lib/packages/Attribute.java
index 391a1da7b6..c181a7e156 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/Attribute.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/Attribute.java
@@ -201,6 +201,11 @@ public final class Attribute implements Comparable<Attribute> {
* its value based on properties of the build configuration.
*/
NONCONFIGURABLE,
+
+ /**
+ * Whether we should skip constraints checks for licenses, visibility, etc.
+ */
+ SKIP_CONSTRAINTS_CHECKS,
}
// TODO(bazel-team): modify this interface to extend Predicate and have an extra error
@@ -521,6 +526,13 @@ public final class Attribute implements Comparable<Attribute> {
}
/**
+ * Disables constraints and visibility checks.
+ */
+ public Builder<TYPE> skipConstraintsCheck() {
+ return setPropertyFlag(PropertyFlag.SKIP_CONSTRAINTS_CHECKS, "skip_constraints_checks");
+ }
+
+ /**
* If this is a label or label-list attribute, then this sets the allowed
* rule types for the labels occurring in the attribute. If the attribute
* contains Labels of any other rule type, then an error is produced during
@@ -1238,6 +1250,10 @@ public final class Attribute implements Comparable<Attribute> {
return getPropertyFlag(PropertyFlag.CHECK_ALLOWED_VALUES);
}
+ public boolean performConstraintsCheck() {
+ return !getPropertyFlag(PropertyFlag.SKIP_CONSTRAINTS_CHECKS);
+ }
+
/**
* Returns true if this attribute's value can be influenced by the build configuration.
*/