Skip to content

Commit

Permalink
Share full classpath NestedSet between full and header compile actions
Browse files Browse the repository at this point in the history
The Starlark API already adds the direct JARs to the transitive
classpath `depset`, so the deleted code path didn't actually change the
set. However, it resulted in separate instances being passed to and
retained by `JavaCompileAction` and `JavaHeaderCompileAction` in the
case where the direct classpath optimization isn't used.
  • Loading branch information
fmeum committed Feb 14, 2024
1 parent d51f948 commit ad0fc99
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,16 +321,10 @@ public Builder addAdditionalOutputs(Iterable<Artifact> outputs) {

public JavaTargetAttributes build() {
built = true;
NestedSet<Artifact> directJars = directJarsBuilder.build();
NestedSet<Artifact> compileTimeClassPath =
NestedSetBuilder.<Artifact>naiveLinkOrder()
.addTransitive(directJars)
.addTransitive(compileTimeClassPathBuilder.build())
.build();
return new JavaTargetAttributes(
ImmutableSet.copyOf(sourceFiles),
runtimeClassPath.build(),
compileTimeClassPath,
compileTimeClassPathBuilder.build(),
bootClassPath,
sourcePath,
nativeLibraries.build(),
Expand All @@ -341,7 +335,7 @@ public JavaTargetAttributes build() {
ImmutableList.copyOf(sourceJars),
classPathResources.build(),
additionalOutputs.build(),
directJars,
directJarsBuilder.build(),
compileTimeDependencyArtifacts.build(),
targetLabel,
injectingRuleKind,
Expand Down

0 comments on commit ad0fc99

Please sign in to comment.