Skip to content

Commit

Permalink
Automated g4 rollback of commit 8c41633.
Browse files Browse the repository at this point in the history
*** Reason for rollback ***

Causes Blaze release failures.

*** Original change description ***

Genrules only depend on the host JDK if they have Java make variables.

e.g.: cmd = "$(JAVA) foo.java ..."
PiperOrigin-RevId: 152516143
  • Loading branch information
aragos authored and buchgr committed Apr 10, 2017
1 parent 80f32ba commit e27cd7d
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.google.devtools.build.lib.rules.cpp.CppConfiguration;
import com.google.devtools.build.lib.rules.genrule.GenRuleBaseRule;
import com.google.devtools.build.lib.rules.java.JavaConfiguration;
import com.google.devtools.build.lib.rules.java.JavaSemantics;

/**
* Rule definition for genrule for Bazel.
Expand Down Expand Up @@ -51,7 +52,7 @@ public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env)
.add(attr("stamp", BOOLEAN).value(false))

.add(attr(":cc_toolchain", LABEL).value(GenRuleBaseRule.CC_TOOLCHAIN))
.add(attr(":host_jdk", LABEL).cfg(HOST).value(GenRuleBaseRule.HOST_JDK))
.add(attr(":host_jdk", LABEL).cfg(HOST).value(JavaSemantics.HOST_JDK))

.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ java_library(
"//src/main/java/com/google/devtools/build/lib:build-base",
"//src/main/java/com/google/devtools/build/lib:events",
"//src/main/java/com/google/devtools/build/lib:java-compilation",
"//src/main/java/com/google/devtools/build/lib:java-implicit-attributes",
"//src/main/java/com/google/devtools/build/lib:packages",
"//src/main/java/com/google/devtools/build/lib:vfs",
"//src/main/java/com/google/devtools/build/lib/actions",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected static boolean requiresCrosstool(String command) {
return CROSSTOOL_MAKE_VARIABLE.matcher(command).find();
}

protected static boolean requiresJdk(String command) {
protected boolean requiresJdk(String command) {
return JDK_MAKE_VARIABLE.matcher(command).find();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
import com.google.devtools.build.lib.rules.MakeVariableProvider;
import com.google.devtools.build.lib.rules.cpp.CppConfiguration;
import com.google.devtools.build.lib.rules.cpp.CppRuleClasses;
import com.google.devtools.build.lib.rules.java.JavaImplicitAttributes;
import com.google.devtools.build.lib.rules.java.JavaSemantics;
import com.google.devtools.build.lib.rules.java.Jvm;
import com.google.devtools.build.lib.syntax.Type;
import com.google.devtools.build.lib.util.FileTypeSet;

Expand All @@ -66,22 +63,6 @@ public Label resolve(Rule rule, AttributeMap attributes, BuildConfiguration conf
}
};

/**
* Late-bound dependency on the host JDK <i>iff</i> the genrule has make variables that need
* that rule.
*/
public static final Attribute.LateBoundLabel<BuildConfiguration> HOST_JDK =
new Attribute.LateBoundLabel<BuildConfiguration>(
JavaImplicitAttributes.JDK_LABEL, Jvm.class) {
@Override
public Label resolve(Rule rule, AttributeMap attributes, BuildConfiguration configuration) {
return attributes != null
&& GenRuleBase.requiresJdk(attributes.get("cmd", Type.STRING))
? JavaSemantics.HOST_JDK.resolve(rule, attributes, configuration)
: null;
}
};

@Override
public RuleClass build(
RuleClass.Builder builder, RuleDefinitionEnvironment env) {
Expand Down

0 comments on commit e27cd7d

Please sign in to comment.