Skip to content

Commit

Permalink
Updating SingleJarActionBuilder.createSourceJarAction to take NestedS…
Browse files Browse the repository at this point in the history
…et for sources rather than ImmutableList.

RELNOTES: None
PiperOrigin-RevId: 231877095
  • Loading branch information
Googler authored and Copybara-Service committed Feb 1, 2019
1 parent 16e9cea commit 698c91d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public ConfiguredTarget create(RuleContext ruleContext)
SingleJarActionBuilder.createSourceJarAction(
ruleContext,
semantics,
ImmutableList.of(),
NestedSetBuilder.<Artifact>emptySet(Order.STABLE_ORDER),
transitiveSourceJars,
ruleContext.getImplicitOutputArtifact(JavaSemantics.JAVA_BINARY_DEPLOY_SOURCE_JAR));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ public void createSourceJarAction(
ruleContext,
ruleContext,
semantics,
attributes.getSourceFiles(),
NestedSetBuilder.<Artifact>wrap(Order.STABLE_ORDER, attributes.getSourceFiles()),
resourceJars.build(),
outputJar,
javaToolchainProvider,
Expand All @@ -692,7 +692,11 @@ public void createSourceJarAction(Artifact outputJar, @Nullable Artifact gensrcJ
resourceJars.add(gensrcJar);
}
SingleJarActionBuilder.createSourceJarAction(
ruleContext, semantics, attributes.getSourceFiles(), resourceJars.build(), outputJar);
ruleContext,
semantics,
NestedSetBuilder.<Artifact>wrap(Order.STABLE_ORDER, attributes.getSourceFiles()),
resourceJars.build(),
outputJar);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ Artifact packSourceFiles(
actionRegistry,
actions.getActionConstructionContext(),
javaSemantics,
ImmutableList.copyOf(sourceFiles),
NestedSetBuilder.<Artifact>stableOrder().addAll(sourceJars).build(),
NestedSetBuilder.<Artifact>wrap(Order.STABLE_ORDER, sourceFiles),
NestedSetBuilder.<Artifact>wrap(Order.STABLE_ORDER, sourceJars),
outputSrcJar,
javaToolchainProvider,
javaRuntimeInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import static java.util.Objects.requireNonNull;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.actions.ActionRegistry;
import com.google.devtools.build.lib.actions.Artifact;
Expand All @@ -31,6 +30,8 @@
import com.google.devtools.build.lib.analysis.actions.CustomCommandLine.VectorArg;
import com.google.devtools.build.lib.analysis.actions.SpawnAction;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
import com.google.devtools.build.lib.collect.nestedset.Order;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
import java.util.function.Consumer;
Expand Down Expand Up @@ -76,7 +77,7 @@ private static SpawnAction.Builder singleJarActionBuilder(
public static void createSourceJarAction(
RuleContext ruleContext,
JavaSemantics semantics,
ImmutableCollection<Artifact> resources,
NestedSet<Artifact> resources,
NestedSet<Artifact> resourceJars,
Artifact outputJar) {
createSourceJarAction(
Expand Down Expand Up @@ -105,7 +106,7 @@ public static void createSourceJarAction(
ActionRegistry actionRegistry,
ActionConstructionContext actionConstructionContext,
JavaSemantics semantics,
ImmutableCollection<Artifact> resources,
NestedSet<Artifact> resources,
NestedSet<Artifact> resourceJars,
Artifact outputJar,
JavaToolchainProvider toolchainProvider,
Expand Down Expand Up @@ -147,7 +148,10 @@ public static void createSingleJarAction(
.addInputs(jars)
.addCommandLine(
sourceJarCommandLine(
output, /* semantics= */ null, /* resources= */ ImmutableList.of(), jars),
output,
/* semantics= */ null,
/* resources= */ NestedSetBuilder.<Artifact>emptySet(Order.STABLE_ORDER),
jars),
ParamFileInfo.builder(ParameterFileType.SHELL_QUOTED).setUseAlways(true).build())
.setProgressMessage("Building singlejar jar %s", output.prettyPrint())
.setMnemonic("JavaSingleJar");
Expand All @@ -157,7 +161,7 @@ public static void createSingleJarAction(
private static CommandLine sourceJarCommandLine(
Artifact outputJar,
JavaSemantics semantics,
ImmutableCollection<Artifact> resources,
NestedSet<Artifact> resources,
NestedSet<Artifact> resourceJars) {
CustomCommandLine.Builder args = CustomCommandLine.builder();
args.addExecPath("--output", outputJar);
Expand Down

0 comments on commit 698c91d

Please sign in to comment.