aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Liam Miller-Cushon <cushon@google.com>2016-04-21 19:38:53 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-04-22 11:48:54 +0000
commit83db68466368d912202deb672983d8e4c43a143f (patch)
tree8102ad2aeb8fd922fef0090387ac301dcd03a47a
parentce7e8e7fee1ca173a2a232ff46ba4bc578bf7273 (diff)
Don't resolve --java_launcher for targets that opt out
If a target uses its launcher attribute to override --java_launcher, that should also override the value of :java_launcher. The default value of --java_launcher may not be compatible with the target architecture. -- MOS_MIGRATED_REVID=120473209
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/JavaSemantics.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaSemantics.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaSemantics.java
index 70ee87aefb..c30ddac0cf 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaSemantics.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaSemantics.java
@@ -14,6 +14,7 @@
package com.google.devtools.build.lib.rules.java;
+import static com.google.devtools.build.lib.packages.BuildType.LABEL;
import static com.google.devtools.build.lib.packages.ImplicitOutputsFunction.fromTemplates;
import com.google.common.collect.ImmutableList;
@@ -153,8 +154,14 @@ public interface JavaSemantics {
LateBoundLabel<BuildConfiguration> JAVA_LAUNCHER =
new LateBoundLabel<BuildConfiguration>(JavaConfiguration.class) {
@Override
- public Label resolve(Rule rule, AttributeMap attributes,
- BuildConfiguration configuration) {
+ public Label resolve(Rule rule, AttributeMap attributes, BuildConfiguration configuration) {
+ // don't read --java_launcher if this target overrides via a launcher attribute
+ if (attributes != null && attributes.has("launcher", LABEL)) {
+ Label launcher = attributes.get("launcher", LABEL);
+ if (launcher != null) {
+ return launcher;
+ }
+ }
return configuration.getFragment(JavaConfiguration.class).getJavaLauncherLabel();
}
};