From 83db68466368d912202deb672983d8e4c43a143f Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Thu, 21 Apr 2016 19:38:53 +0000 Subject: 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 --- .../google/devtools/build/lib/rules/java/JavaSemantics.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib') 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 JAVA_LAUNCHER = new LateBoundLabel(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(); } }; -- cgit v1.2.3