aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/runtime
diff options
context:
space:
mode:
authorGravatar Ulf Adams <ulfjack@google.com>2016-11-16 09:54:55 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2016-11-16 16:00:29 +0000
commitd5500a29b61764b76c09f36542ba506b9ed083ec (patch)
tree4eb701d9296f5c5b606ab6fc5f7c6a9c9ebb2e13 /src/main/java/com/google/devtools/build/lib/runtime
parent234b66acc0772ef4cb01a042751d86c1c003e51c (diff)
Merge all action input prefetchers into a single one.
It seems unnecessary to pass these lists around, so this should simplify the APIs. Also, I want to move the action input prefetcher setup to the serverInit call. -- MOS_MIGRATED_REVID=139304928
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java b/src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java
index c96c5a0b0a..e437180d09 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java
@@ -20,6 +20,7 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.eventbus.EventBus;
+import com.google.devtools.build.lib.actions.ActionInput;
import com.google.devtools.build.lib.actions.PackageRootResolver;
import com.google.devtools.build.lib.actions.cache.ActionCache;
import com.google.devtools.build.lib.actions.cache.CompactPersistentActionCache;
@@ -90,7 +91,7 @@ public final class CommandEnvironment {
private PathFragment relativeWorkingDirectory = PathFragment.EMPTY_FRAGMENT;
private long commandStartTime;
private OutputService outputService;
- private ImmutableList<ActionInputPrefetcher> actionInputPrefetchers = ImmutableList.of();
+ private ActionInputPrefetcher actionInputPrefetcher;
private Path workingDirectory;
private String commandName;
@@ -344,8 +345,8 @@ public final class CommandEnvironment {
return outputService;
}
- public ImmutableList<ActionInputPrefetcher> getActionInputPrefetchers() {
- return actionInputPrefetchers;
+ public ActionInputPrefetcher getActionInputPrefetcher() {
+ return actionInputPrefetcher == null ? ActionInputPrefetcher.NONE : actionInputPrefetcher;
}
public ActionCache getPersistentActionCache() throws IOException {
@@ -564,7 +565,16 @@ public final class CommandEnvironment {
prefetchersBuilder.add(actionInputPrefetcher);
}
}
- actionInputPrefetchers = prefetchersBuilder.build();
+ final ImmutableList<ActionInputPrefetcher> actionInputPrefetchers = prefetchersBuilder.build();
+ actionInputPrefetcher =
+ new ActionInputPrefetcher() {
+ @Override
+ public void prefetchFile(ActionInput input) {
+ for (ActionInputPrefetcher prefetcher : actionInputPrefetchers) {
+ prefetcher.prefetchFile(input);
+ }
+ }
+ };
SkyframeExecutor skyframeExecutor = getSkyframeExecutor();
skyframeExecutor.setOutputService(outputService);