diff options
author | 2015-03-11 21:53:19 +0000 | |
---|---|---|
committer | 2015-03-13 14:16:04 +0000 | |
commit | d8f3c3933a57d917b979cfd872d865a4fb6995a8 (patch) | |
tree | ed34152c00fd42de582cdb988f11394cfc641388 /src/main/java/com/google/devtools/build | |
parent | e2fa64dc550e8b1a16759e46400226592f75e40f (diff) |
Fix classpath with named workspace for java binary
The classpath construction used a prefix substitution that was not
including the name of the workspace for java binaries.
--
MOS_MIGRATED_REVID=88375741
Diffstat (limited to 'src/main/java/com/google/devtools/build')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java | 5 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java index b301161088..bfccae39eb 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java @@ -154,6 +154,11 @@ public class BazelJavaSemantics implements JavaSemantics { BuildConfiguration config = ruleContext.getConfiguration(); List<Substitution> arguments = new ArrayList<>(); + String workspacePrefix = ruleContext.getWorkspaceName(); + if (!workspacePrefix.isEmpty()) { + workspacePrefix += "/"; + } + arguments.add(Substitution.of("%workspace_prefix%", workspacePrefix)); arguments.add(Substitution.of("%javabin%", javaExecutable)); arguments.add(Substitution.of("%needs_runfiles%", config.getFragment(Jvm.class).getJavaExecutable().isAbsolute() ? "0" : "1")); diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt index a17246f81d..ff7202499a 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt @@ -158,7 +158,7 @@ if [[ "$SINGLEJAR" == 1 ]]; then || die "Option --singlejar was passed, but %s does not exist.\n (You may need to build it explicitly.)" "$CLASSPATH" else # Create the shortest classpath we can, by making it relative if possible. - RUNPATH="${JAVA_RUNFILES}/" + RUNPATH="${JAVA_RUNFILES}/%workspace_prefix%" RUNPATH="${RUNPATH#$PWD/}" CLASSPATH=%classpath% fi |