Simplify RemoteActionContextProvider
@@ -17,8 +17,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.actions.ActionContext;
-import com.google.devtools.build.lib.actions.ActionInputFileCache;
-import com.google.devtools.build.lib.actions.ActionInputPrefetcher;
import com.google.devtools.build.lib.actions.ResourceManager;
import com.google.devtools.build.lib.exec.ActionContextProvider;
import com.google.devtools.build.lib.exec.ExecutionOptions;
@@ -40,7 +38,6 @@ final class RemoteActionContextProvider extends ActionContextProvider {
private final GrpcRemoteExecutor executor;
private RemoteSpawnRunner spawnRunner;
- private RemoteSpawnStrategy spawnStrategy;
RemoteActionContextProvider(CommandEnvironment env, @Nullable RemoteActionCache cache,
@Nullable GrpcRemoteExecutor executor) {
@@ -50,8 +47,7 @@ final class RemoteActionContextProvider extends ActionContextProvider {
}
@Override
- public void init(
- ActionInputFileCache actionInputFileCache, ActionInputPrefetcher actionInputPrefetcher) {
+ public Iterable<? extends ActionContext> getActionContexts() {
ExecutionOptions executionOptions =
checkNotNull(env.getOptions().getOptions(ExecutionOptions.class));
RemoteOptions remoteOptions = checkNotNull(env.getOptions().getOptions(RemoteOptions.class));
@@ -62,10 +58,11 @@ final class RemoteActionContextProvider extends ActionContextProvider {
createFallbackRunner(env),
cache,
executor);
- spawnStrategy =
+ RemoteSpawnStrategy spawnStrategy =
new RemoteSpawnStrategy(
spawnRunner,
executionOptions.verboseFailures);
+ return ImmutableList.of(checkNotNull(spawnStrategy));
}
private static SpawnRunner createFallbackRunner(CommandEnvironment env) {
@@ -83,17 +80,11 @@ final class RemoteActionContextProvider extends ActionContextProvider {
localEnvProvider);
}
- @Override
- public Iterable<? extends ActionContext> getActionContexts() {
- return ImmutableList.of(checkNotNull(spawnStrategy));
- }
-
@Override
public void executionPhaseEnding() {
if (spawnRunner != null) {
spawnRunner.close();
}
spawnRunner = null;
- spawnStrategy = null;
}
}
