diff options
author | 2017-07-07 20:55:55 +0200 | |
---|---|---|
committer | 2017-07-10 09:16:07 +0200 | |
commit | 739d80ccbd795bac7727a6d89bbb92f5436675cf (patch) | |
tree | c8e639f557b0adf44b0f90d0157c64f750f3fd95 /src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleBaseRule.java | |
parent | c6bd5166d1c558fb8f619b53eb4c56fa7cee8b93 (diff) |
Update the default values for the C++ and Java late-bound attributes to the correct //tools/cpp:toolchain and //tools/jdk:jdk.
PiperOrigin-RevId: 161227981
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleBaseRule.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleBaseRule.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleBaseRule.java b/src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleBaseRule.java index 544a03df21..2e9bbf3f31 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleBaseRule.java +++ b/src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleBaseRule.java @@ -29,6 +29,7 @@ import com.google.devtools.build.lib.analysis.TransitiveInfoProvider; import com.google.devtools.build.lib.analysis.config.BuildConfiguration; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.packages.Attribute; +import com.google.devtools.build.lib.packages.Attribute.LateBoundLabel; import com.google.devtools.build.lib.packages.AttributeMap; import com.google.devtools.build.lib.packages.BuildType; import com.google.devtools.build.lib.packages.Rule; @@ -46,22 +47,23 @@ import com.google.devtools.build.lib.util.FileTypeSet; * as a setup script target. */ public class GenRuleBaseRule implements RuleDefinition { - /** * Late-bound dependency on the C++ toolchain <i>iff</i> the genrule has make variables that need * that toolchain. */ - public static final Attribute.LateBoundLabel<BuildConfiguration> CC_TOOLCHAIN = - new Attribute.LateBoundLabel<BuildConfiguration>( - CppRuleClasses.CROSSTOOL_LABEL, CppConfiguration.class) { - @Override - public Label resolve(Rule rule, AttributeMap attributes, BuildConfiguration configuration) { - return attributes != null - && GenRuleBase.requiresCrosstool(attributes.get("cmd", Type.STRING)) - ? CppRuleClasses.CC_TOOLCHAIN.resolve(rule, attributes, configuration) - : null; - } - }; + public static Attribute.LateBoundLabel<BuildConfiguration> ccToolchainAttribute( + RuleDefinitionEnvironment env) { + return new LateBoundLabel<BuildConfiguration>( + env.getToolsLabel(CppRuleClasses.CROSSTOOL_LABEL), CppConfiguration.class) { + @Override + public Label resolve(Rule rule, AttributeMap attributes, BuildConfiguration configuration) { + return attributes != null + && GenRuleBase.requiresCrosstool(attributes.get("cmd", Type.STRING)) + ? CppRuleClasses.ccToolchainAttribute(env).resolve(rule, attributes, configuration) + : null; + } + }; + } @Override public RuleClass build( |