aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java
diff options
context:
space:
mode:
authorGravatar cpeyser <cpeyser@google.com>2017-09-07 22:16:06 +0200
committerGravatar Yun Peng <pcloudy@google.com>2017-09-08 09:47:26 +0200
commitd852e484d8114829ad2d7a98f075a823889f5469 (patch)
tree7cc5fa6eb7d2853e2ce6e1a523a380b7eeb2a7ab /src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java
parentf7fc22e6fd665e73fe98846efa36a60e4bad05fe (diff)
Add a new toolchain type for c++. In order to do this, PlatformConfiguration is made a legal configuration fragment for every rule class.
Add a default "dummy" c++ toolchain to prevent resolution errors when legacy toolchain selection logic is used. Add toolchain mocks to java and shell tests. PiperOrigin-RevId: 167901210
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java77
1 files changed, 48 insertions, 29 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java b/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java
index 817f4d163e..f52d66f209 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java
@@ -182,41 +182,60 @@ public class BaseRuleClasses {
* Share common attributes across both base and Skylark base rules.
*/
public static RuleClass.Builder commonCoreAndSkylarkAttributes(RuleClass.Builder builder) {
- return builder
+ return PlatformSemantics.platformAttributes(builder)
// The visibility attribute is special: it is a nodep label, and loading the
// necessary package groups is handled by {@link LabelVisitor#visitTargetVisibility}.
// Package groups always have the null configuration so that they are not duplicated
// needlessly.
- .add(attr("visibility", NODEP_LABEL_LIST).orderIndependent().cfg(HOST)
- .nonconfigurable("special attribute integrated more deeply into Bazel's core logic"))
- .add(attr("deprecation", STRING).value(deprecationDefault)
- .nonconfigurable("Used in core loading phase logic with no access to configs"))
- .add(attr("tags", STRING_LIST).orderIndependent().taggable()
- .nonconfigurable("low-level attribute, used in TargetUtils without configurations"))
- .add(attr("generator_name", STRING).undocumented("internal")
- .nonconfigurable("static structure of a rule"))
- .add(attr("generator_function", STRING).undocumented("internal")
- .nonconfigurable("static structure of a rule"))
- .add(attr("generator_location", STRING).undocumented("internal")
- .nonconfigurable("static structure of a rule"))
- .add(attr("testonly", BOOLEAN).value(testonlyDefault)
- .nonconfigurable("policy decision: rules testability should be consistent"))
+ .add(
+ attr("visibility", NODEP_LABEL_LIST)
+ .orderIndependent()
+ .cfg(HOST)
+ .nonconfigurable(
+ "special attribute integrated more deeply into Bazel's core logic"))
+ .add(
+ attr("deprecation", STRING)
+ .value(deprecationDefault)
+ .nonconfigurable("Used in core loading phase logic with no access to configs"))
+ .add(
+ attr("tags", STRING_LIST)
+ .orderIndependent()
+ .taggable()
+ .nonconfigurable("low-level attribute, used in TargetUtils without configurations"))
+ .add(
+ attr("generator_name", STRING)
+ .undocumented("internal")
+ .nonconfigurable("static structure of a rule"))
+ .add(
+ attr("generator_function", STRING)
+ .undocumented("internal")
+ .nonconfigurable("static structure of a rule"))
+ .add(
+ attr("generator_location", STRING)
+ .undocumented("internal")
+ .nonconfigurable("static structure of a rule"))
+ .add(
+ attr("testonly", BOOLEAN)
+ .value(testonlyDefault)
+ .nonconfigurable("policy decision: rules testability should be consistent"))
.add(attr("features", STRING_LIST).orderIndependent())
.add(attr(":action_listener", LABEL_LIST).cfg(HOST).value(ACTION_LISTENER))
- .add(attr(RuleClass.COMPATIBLE_ENVIRONMENT_ATTR, LABEL_LIST)
- .allowedRuleClasses(EnvironmentRule.RULE_NAME)
- .cfg(Attribute.ConfigurationTransition.HOST)
- .allowedFileTypes(FileTypeSet.NO_FILE)
- .dontCheckConstraints()
- .nonconfigurable("special logic for constraints and select: see ConstraintSemantics")
- )
- .add(attr(RuleClass.RESTRICTED_ENVIRONMENT_ATTR, LABEL_LIST)
- .allowedRuleClasses(EnvironmentRule.RULE_NAME)
- .cfg(Attribute.ConfigurationTransition.HOST)
- .allowedFileTypes(FileTypeSet.NO_FILE)
- .dontCheckConstraints()
- .nonconfigurable("special logic for constraints and select: see ConstraintSemantics")
- );
+ .add(
+ attr(RuleClass.COMPATIBLE_ENVIRONMENT_ATTR, LABEL_LIST)
+ .allowedRuleClasses(EnvironmentRule.RULE_NAME)
+ .cfg(Attribute.ConfigurationTransition.HOST)
+ .allowedFileTypes(FileTypeSet.NO_FILE)
+ .dontCheckConstraints()
+ .nonconfigurable(
+ "special logic for constraints and select: see ConstraintSemantics"))
+ .add(
+ attr(RuleClass.RESTRICTED_ENVIRONMENT_ATTR, LABEL_LIST)
+ .allowedRuleClasses(EnvironmentRule.RULE_NAME)
+ .cfg(Attribute.ConfigurationTransition.HOST)
+ .allowedFileTypes(FileTypeSet.NO_FILE)
+ .dontCheckConstraints()
+ .nonconfigurable(
+ "special logic for constraints and select: see ConstraintSemantics"));
}
public static RuleClass.Builder nameAttribute(RuleClass.Builder builder) {