Skip to content

Commit

Permalink
Add SpawnBuilder#with{Inputs,Tools} overloads accepting a NestedSet.
Browse files Browse the repository at this point in the history
This makes it possible to write tests that are sensitive to the nested set structure of the inputs.

PiperOrigin-RevId: 588790161
Change-Id: I79595c1f8b2a72adb02dcb91599addda54c72f43
  • Loading branch information
tjgq authored and copybara-github committed Dec 7, 2023
1 parent 564a399 commit dbd5c6e
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.google.devtools.build.lib.actions.SimpleSpawn;
import com.google.devtools.build.lib.actions.Spawn;
import com.google.devtools.build.lib.analysis.platform.PlatformInfo;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.ArrayList;
Expand Down Expand Up @@ -191,6 +192,12 @@ public SpawnBuilder withInputs(String... names) {
return this;
}

@CanIgnoreReturnValue
public SpawnBuilder withInputs(NestedSet<ActionInput> inputs) {
this.inputs.addTransitive(inputs);
return this;
}

@CanIgnoreReturnValue
public SpawnBuilder withOutput(ActionInput output) {
outputs.add(output);
Expand Down Expand Up @@ -251,6 +258,12 @@ public SpawnBuilder withTools(ActionInput... tools) {
return this;
}

@CanIgnoreReturnValue
public SpawnBuilder withTools(NestedSet<ActionInput> tools) {
this.tools.addTransitive(tools);
return this;
}

@CanIgnoreReturnValue
public SpawnBuilder withLocalResources(ResourceSet resourceSet) {
this.resourceSet = resourceSet;
Expand Down

0 comments on commit dbd5c6e

Please sign in to comment.