aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/java_tools/buildjar
diff options
context:
space:
mode:
authorGravatar cushon <cushon@google.com>2018-04-05 15:34:50 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-04-05 15:36:42 -0700
commit538e5c6a2437a08a3f588803e30a79534bc71b37 (patch)
tree8b61d428a84d319daa084be3736bc65f50ae58fd /src/java_tools/buildjar
parentbeafd7ef1245511a74d12962cecfbeddc05e0d46 (diff)
Tolerate empty bootclasspaths in javac-turbine
PiperOrigin-RevId: 191809494
Diffstat (limited to 'src/java_tools/buildjar')
-rw-r--r--src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/BlazeJavacMain.java2
-rw-r--r--src/java_tools/buildjar/java/com/google/devtools/build/java/turbine/javac/JavacTurbineCompiler.java7
2 files changed, 7 insertions, 2 deletions
diff --git a/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/BlazeJavacMain.java b/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/BlazeJavacMain.java
index 20b8689392..d422cd39ea 100644
--- a/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/BlazeJavacMain.java
+++ b/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/BlazeJavacMain.java
@@ -210,7 +210,7 @@ public class BlazeJavacMain {
}
fileManager.setLocationFromPaths(StandardLocation.SOURCE_PATH, sourcePath);
- // TODO(cushon): require an explicit bootclasspath
+ // The bootclasspath may legitimately be empty if --release is being used.
Collection<Path> bootClassPath = arguments.bootClassPath();
if (!bootClassPath.isEmpty()) {
fileManager.setLocationFromPaths(StandardLocation.PLATFORM_CLASS_PATH, bootClassPath);
diff --git a/src/java_tools/buildjar/java/com/google/devtools/build/java/turbine/javac/JavacTurbineCompiler.java b/src/java_tools/buildjar/java/com/google/devtools/build/java/turbine/javac/JavacTurbineCompiler.java
index f88b1a71f0..3ee4d204c0 100644
--- a/src/java_tools/buildjar/java/com/google/devtools/build/java/turbine/javac/JavacTurbineCompiler.java
+++ b/src/java_tools/buildjar/java/com/google/devtools/build/java/turbine/javac/JavacTurbineCompiler.java
@@ -40,6 +40,7 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
+import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Locale;
@@ -85,7 +86,11 @@ public class JavacTurbineCompiler {
fm.setContext(context);
fm.setLocationFromPaths(StandardLocation.SOURCE_PATH, Collections.<Path>emptyList());
fm.setLocationFromPaths(StandardLocation.CLASS_PATH, request.classPath());
- fm.setLocationFromPaths(StandardLocation.PLATFORM_CLASS_PATH, request.bootClassPath());
+ // The bootclasspath may legitimately be empty if --release is being used.
+ Collection<Path> bootClassPath = request.bootClassPath();
+ if (!bootClassPath.isEmpty()) {
+ fm.setLocationFromPaths(StandardLocation.PLATFORM_CLASS_PATH, bootClassPath);
+ }
fm.setLocationFromPaths(
StandardLocation.ANNOTATION_PROCESSOR_PATH, request.processorClassPath());
fm.setLocationFromPaths(StandardLocation.CLASS_OUTPUT, ImmutableList.of(classes));