aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2017-04-13 03:06:14 +0000
committerGravatar Jakob Buchgraber <buchgr@google.com>2017-04-13 09:36:56 +0200
commit8e042300d8e1eb6b9eda8a59bdb809aadb91d23b (patch)
tree588028b0aa2c2017f5536a78e715429e1da7e80c
parent75381c77ba1a74c4e9484706a5b5b2149a716716 (diff)
Lifting restriction that java home cannot be absolute path when jvm label is used.
PiperOrigin-RevId: 153020672
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/Jvm.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/Jvm.java b/src/main/java/com/google/devtools/build/lib/rules/java/Jvm.java
index 919538077f..7658cd341a 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/Jvm.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/Jvm.java
@@ -45,11 +45,11 @@ public final class Jvm extends BuildConfiguration.Fragment {
/**
* Creates a Jvm instance. Either the {@code javaHome} parameter is absolute,
- * or the {@code jvmLabel} parameter must be non-null. This restriction might
- * be lifted in the future. Only the {@code jvmLabel} is optional.
+ * and/or the {@code jvmLabel} parameter must be non-null. Only the
+ * {@code jvmLabel} is optional.
*/
public Jvm(PathFragment javaHome, Label jvmLabel) {
- Preconditions.checkArgument(javaHome.isAbsolute() ^ (jvmLabel != null));
+ Preconditions.checkArgument(javaHome.isAbsolute() || jvmLabel != null);
this.javaHome = javaHome;
this.jvmLabel = jvmLabel;
this.java = getJavaHome().getRelative(BIN_JAVA);
@@ -88,7 +88,7 @@ public final class Jvm extends BuildConfiguration.Fragment {
* same thing as getJavaExecutable().
*/
public PathFragment getRunfilesJavaExecutable() {
- if (jvmLabel == null || jvmLabel.getPackageIdentifier().getRepository().isMain()) {
+ if (javaHome.isAbsolute() || jvmLabel.getPackageIdentifier().getRepository().isMain()) {
return getJavaExecutable();
}
return jvmLabel.getPackageIdentifier().getRepository().getRunfilesPath().getRelative(BIN_JAVA);