Skip to content

Commit

Permalink
Clean up javabase handling in JavaCompileActionBuilder
Browse files Browse the repository at this point in the history
by reading these directly from the toolchain instead of passing them separately
to the builder.

PiperOrigin-RevId: 346149476
  • Loading branch information
cushon authored and copybara-github committed Dec 7, 2020
1 parent d3e64f4 commit 68323d8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,6 @@ public void createCompileAction(JavaCompileOutputs<Artifact> outputs)

JavaClasspathMode classpathMode = getJavaConfiguration().getReduceJavaClasspath();
builder.setClasspathMode(classpathMode);
builder.setJavaExecutable(javaToolchain.getJavaRuntime().javaBinaryExecPathFragment());
builder.setJavaBaseInputs(javaToolchain.getJavaRuntime().javaBaseInputsMiddleman());
builder.setAdditionalInputs(additionalInputsForDatabinding);
Label label = ruleContext.getLabel();
builder.setTargetLabel(label);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import com.google.devtools.build.lib.rules.java.JavaPluginInfoProvider.JavaPluginInfo;
import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
import com.google.devtools.build.lib.util.StringCanonicalizer;
import com.google.devtools.build.lib.vfs.PathFragment;
import java.util.Collections;
import java.util.stream.Stream;
import javax.annotation.Nullable;
Expand Down Expand Up @@ -134,8 +133,6 @@ public void extend(ExtraActionInfo.Builder builder, ImmutableList<String> argume

private final RuleContext ruleContext;
private final JavaToolchainProvider toolchain;
private PathFragment javaExecutable;
private NestedSet<Artifact> javabaseInputs = NestedSetBuilder.emptySet(Order.NAIVE_LINK_ORDER);
private ImmutableSet<Artifact> additionalOutputs = ImmutableSet.of();
private Artifact coverageArtifact;
private ImmutableSet<Artifact> sourceFiles = ImmutableSet.of();
Expand Down Expand Up @@ -193,8 +190,6 @@ public JavaCompileAction build() {
compileTimeDependencyArtifacts = NestedSetBuilder.emptySet(Order.STABLE_ORDER);
}

Preconditions.checkState(javaExecutable != null, ruleContext.getActionOwner());

CustomCommandLine.Builder executableLine = CustomCommandLine.builder();
NestedSetBuilder<Artifact> toolsBuilder = NestedSetBuilder.compileOrder();

Expand All @@ -210,7 +205,7 @@ public JavaCompileAction build() {
} else {
toolsBuilder.add(javaBuilderJar);
executableLine
.addPath(javaExecutable)
.addPath(toolchain.getJavaRuntime().javaBinaryExecPathFragment())
.addAll(javacJvmOpts)
.add("-jar")
.addPath(javaBuilderJar.getExecPath());
Expand All @@ -228,7 +223,7 @@ public JavaCompileAction build() {
.addTransitive(extraData)
.addAll(sourceJars)
.addAll(sourceFiles)
.addTransitive(javabaseInputs)
.addTransitive(toolchain.getJavaRuntime().javaBaseInputsMiddleman())
.addTransitive(bootClassPath.bootclasspath())
.addAll(sourcePathEntries)
.addAll(additionalInputs);
Expand Down Expand Up @@ -362,16 +357,6 @@ private CustomCommandLine buildParamFileContents(ImmutableList<String> javacOpts
return result.build();
}

public JavaCompileActionBuilder setJavaExecutable(PathFragment javaExecutable) {
this.javaExecutable = javaExecutable;
return this;
}

public JavaCompileActionBuilder setJavaBaseInputs(NestedSet<Artifact> javabaseInputs) {
this.javabaseInputs = javabaseInputs;
return this;
}

public JavaCompileActionBuilder setAdditionalOutputs(ImmutableSet<Artifact> outputs) {
this.additionalOutputs = outputs;
return this;
Expand Down

0 comments on commit 68323d8

Please sign in to comment.