Clean up ExecutionRequirements
- remove BaseSpawn.Local; instead, all callers pass in the full set of
execution requirements they want to set
- disable caching and sandboxing for the symlink tree action - it does not
declare outputs, so it can't be cached or sandboxed (fixes #4041)
- centralize the existing execution requirements in the ExecutionRequirements
class
- centralize checking for execution requirements in the Spawn class
(it's possible that we may need a more decentralized, extensible design in
the future, but for now having them in a single place is simple and
effective)
- update the documentation
- forward the relevant tags to execution requirements in TargetUtils (progress
on #3960)
- this also contributes to #4153
PiperOrigin-RevId: 177288598
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 342680b..d2497ff 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
@@ -26,10 +26,10 @@
import com.google.devtools.build.lib.actions.ActionInputPrefetcher;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.Artifact.ArtifactExpander;
-import com.google.devtools.build.lib.actions.BaseSpawn;
import com.google.devtools.build.lib.actions.ExecException;
import com.google.devtools.build.lib.actions.ResourceManager;
import com.google.devtools.build.lib.actions.ResourceSet;
+import com.google.devtools.build.lib.actions.SimpleSpawn;
import com.google.devtools.build.lib.actions.Spawn;
import com.google.devtools.build.lib.actions.SpawnActionContext;
import com.google.devtools.build.lib.actions.SpawnResult;
@@ -58,7 +58,6 @@
import com.google.devtools.common.options.Options;
import com.google.devtools.common.options.OptionsParser;
import java.io.IOException;
-import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import org.junit.Before;
@@ -148,10 +147,13 @@
}
private Spawn createSpawn(String... arguments) {
- return new BaseSpawn.Local(
- Arrays.asList(arguments),
- ImmutableMap.<String, String>of(),
+ return new SimpleSpawn(
new ActionsTestUtil.NullAction(),
+ ImmutableList.copyOf(arguments),
+ /*environment=*/ ImmutableMap.of(),
+ /*executionInfo=*/ ImmutableMap.of(),
+ /*inputs=*/ ImmutableList.of(),
+ /*outputs=*/ ImmutableList.of(),
ResourceSet.ZERO);
}
@@ -230,10 +232,13 @@
// down where that env var is coming from.
return;
}
- Spawn spawn = new BaseSpawn.Local(
- Arrays.asList("/usr/bin/env"),
- ImmutableMap.of("foo", "bar", "baz", "boo"),
+ 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);
run(spawn);
assertThat(Sets.newHashSet(out().split("\n"))).isEqualTo(Sets.newHashSet("foo=bar", "baz=boo"));