diff options
author | Liam Miller-Cushon <cushon@google.com> | 2017-03-03 18:40:11 +0000 |
---|---|---|
committer | Yue Gan <yueg@google.com> | 2017-03-06 09:45:57 +0000 |
commit | ccd0ffb28676fb5943ae3a364ea40219160b86f8 (patch) | |
tree | 39e11c140101568e641bee92973e0a4812665c87 /src/main/java/com/google/devtools | |
parent | 12e9947d84ad55bf8b4e2aa7923a9d345d15ee34 (diff) |
Pass the bootclasspath as a top-level JavaBuilder flag
instead of hiding inside javacopts, and then processing
javacopts to extract in JavaBuilder.
--
PiperOrigin-RevId: 149127902
MOS_MIGRATED_REVID=149127902
Diffstat (limited to 'src/main/java/com/google/devtools')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java | 64 |
1 files changed, 33 insertions, 31 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java index 93b5bcf9c0..ee053f19d8 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java @@ -613,6 +613,7 @@ public final class JavaCompileAction extends AbstractAction { final Collection<Artifact> sourceJars, final Collection<Artifact> sourceFiles, final Collection<Artifact> extdirInputs, + final Collection<Artifact> bootclasspathEntries, final List<String> javacOpts, final String ruleKind, final Label targetLabel, @@ -647,6 +648,9 @@ public final class JavaCompileAction extends AbstractAction { if (!extdirInputs.isEmpty()) { result.addJoinExecPaths("--extdir", pathSeparator, extdirInputs); } + if (!bootclasspathEntries.isEmpty()) { + result.addJoinExecPaths("--bootclasspath", pathSeparator, bootclasspathEntries); + } if (!processorPath.isEmpty() || !processorPathDirs.isEmpty()) { ImmutableList.Builder<String> execPathStrings = ImmutableList.<String>builder(); execPathStrings.addAll(Artifact.toExecPaths(processorPath)); @@ -663,7 +667,8 @@ public final class JavaCompileAction extends AbstractAction { for (Artifact message : messages) { addAsResourcePrefixedExecPath( semantics.getDefaultJavaResourcePath(message.getRootRelativePath()), - message, result); + message, + result); } } if (!resources.isEmpty()) { @@ -1015,13 +1020,8 @@ public final class JavaCompileAction extends AbstractAction { // TODO(bazel-team): all the params should be calculated before getting here, and the various // aggregation code below should go away. final String pathSeparator = configuration.getHostPathSeparator(); - List<String> jcopts = new ArrayList<>(javacOpts); - if (!bootclasspathEntries.isEmpty()) { - jcopts.add("-bootclasspath"); - jcopts.add(Artifact.joinExecPaths(pathSeparator, bootclasspathEntries)); - } final List<String> internedJcopts = new ArrayList<>(); - for (String jcopt : jcopts) { + for (String jcopt : javacOpts) { internedJcopts.add(StringCanonicalizer.intern(jcopt)); } @@ -1078,30 +1078,32 @@ public final class JavaCompileAction extends AbstractAction { } ImmutableList<Artifact> outputs = outputsBuilder.build(); - CustomMultiArgv commonJavaBuilderArgs = commonJavaBuilderArgs( - semantics, - classDirectory, - sourceGenDirectory, - tempDirectory, - outputJar, - gensrcOutputJar, - manifestProtoOutput, - compressJar, - outputDepsProto, - processorPath, - processorPathDirs, - processorNames, - translations, - resources, - resourceJars, - classpathResources, - sourceJars, - sourceFiles, - extdirInputs, - internedJcopts, - ruleKind, - targetLabel, - pathSeparator); + CustomMultiArgv commonJavaBuilderArgs = + commonJavaBuilderArgs( + semantics, + classDirectory, + sourceGenDirectory, + tempDirectory, + outputJar, + gensrcOutputJar, + manifestProtoOutput, + compressJar, + outputDepsProto, + processorPath, + processorPathDirs, + processorNames, + translations, + resources, + resourceJars, + classpathResources, + sourceJars, + sourceFiles, + extdirInputs, + bootclasspathEntries, + internedJcopts, + ruleKind, + targetLabel, + pathSeparator); CustomCommandLine.Builder paramFileContentsBuilder = javaCompileCommandLine( commonJavaBuilderArgs, |