Change Spawn.get{Tool,Input}Files to NestedSet
I think this should basically be a no-op. In a few places, it delays
flattening of the nested set, and could potentially reduce peak memory
use / reduce the time we're holding onto a flattened copy of the inputs.
PiperOrigin-RevId: 288673175
diff --git a/src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java b/src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java
index 1a0ce10..f9c7b96 100644
--- a/src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java
+++ b/src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java
@@ -19,6 +19,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.common.eventbus.EventBus;
import com.google.devtools.build.lib.actions.ActionExecutionContext;
@@ -38,6 +39,8 @@
import com.google.devtools.build.lib.analysis.BlazeDirectories;
import com.google.devtools.build.lib.analysis.ServerDirectories;
import com.google.devtools.build.lib.clock.BlazeClock;
+import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
+import com.google.devtools.build.lib.collect.nestedset.Order;
import com.google.devtools.build.lib.events.PrintingEventHandler;
import com.google.devtools.build.lib.events.Reporter;
import com.google.devtools.build.lib.exec.BinTools;
@@ -158,8 +161,8 @@
ImmutableList.copyOf(arguments),
/*environment=*/ ImmutableMap.of(),
/*executionInfo=*/ ImmutableMap.of(),
- /*inputs=*/ ImmutableList.of(),
- /*outputs=*/ ImmutableList.of(),
+ /*inputs=*/ NestedSetBuilder.emptySet(Order.STABLE_ORDER),
+ /*outputs=*/ ImmutableSet.of(),
ResourceSet.ZERO);
}
@@ -240,14 +243,15 @@
// down where that env var is coming from.
return;
}
- Spawn spawn = new SimpleSpawn(
- new ActionsTestUtil.NullAction(),
- ImmutableList.of("/usr/bin/env"),
- /*environment=*/ ImmutableMap.of("foo", "bar", "baz", "boo"),
- /*executionInfo=*/ ImmutableMap.of(),
- /*inputs=*/ ImmutableList.of(),
- /*outputs=*/ ImmutableList.of(),
- ResourceSet.ZERO);
+ Spawn spawn =
+ new SimpleSpawn(
+ new ActionsTestUtil.NullAction(),
+ ImmutableList.of("/usr/bin/env"),
+ /*environment=*/ ImmutableMap.of("foo", "bar", "baz", "boo"),
+ /*executionInfo=*/ ImmutableMap.of(),
+ /*inputs=*/ NestedSetBuilder.emptySet(Order.STABLE_ORDER),
+ /*outputs=*/ ImmutableSet.of(),
+ ResourceSet.ZERO);
run(spawn);
assertThat(Sets.newHashSet(out().split("\n"))).isEqualTo(Sets.newHashSet("foo=bar", "baz=boo"));
}