aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleBaseRule.java
diff options
context:
space:
mode:
authorGravatar janakr <janakr@google.com>2017-07-07 20:55:55 +0200
committerGravatar László Csomor <laszlocsomor@google.com>2017-07-10 09:16:07 +0200
commit739d80ccbd795bac7727a6d89bbb92f5436675cf (patch)
treec8e639f557b0adf44b0f90d0157c64f750f3fd95 /src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleBaseRule.java
parentc6bd5166d1c558fb8f619b53eb4c56fa7cee8b93 (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.java26
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(