aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib
diff options
context:
space:
mode:
authorGravatar Janak Ramakrishnan <janakr@google.com>2016-11-17 18:30:46 +0000
committerGravatar Yun Peng <pcloudy@google.com>2016-11-18 10:54:23 +0000
commit6c3ac8acf02a6fa5758dc8e67b7f6c9a428e4e67 (patch)
treec20edb2c243179e4b8ed8d29c272e735770d4cef /src/main/java/com/google/devtools/build/lib
parentbac63f2ab7069eaf809a0af9539b2a7f727f16bd (diff)
Don't get output service or action input prefetcher if not running a "build" command, to save time on the critical path of a build.
-- MOS_MIGRATED_REVID=139477157
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java29
1 files changed, 16 insertions, 13 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 d6d0c485a6..264fa22195 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
@@ -534,21 +534,24 @@ public final class CommandEnvironment {
outputService = null;
BlazeModule outputModule = null;
ImmutableList.Builder<ActionInputPrefetcher> prefetchersBuilder = ImmutableList.builder();
- for (BlazeModule module : runtime.getBlazeModules()) {
- OutputService moduleService = module.getOutputService();
- if (moduleService != null) {
- if (outputService != null) {
- throw new IllegalStateException(String.format(
- "More than one module (%s and %s) returns an output service",
- module.getClass(), outputModule.getClass()));
+ if (command.builds()) {
+ for (BlazeModule module : runtime.getBlazeModules()) {
+ OutputService moduleService = module.getOutputService();
+ if (moduleService != null) {
+ if (outputService != null) {
+ throw new IllegalStateException(
+ String.format(
+ "More than one module (%s and %s) returns an output service",
+ module.getClass(), outputModule.getClass()));
+ }
+ outputService = moduleService;
+ outputModule = module;
}
- outputService = moduleService;
- outputModule = module;
- }
- ActionInputPrefetcher actionInputPrefetcher = module.getPrefetcher();
- if (actionInputPrefetcher != null) {
- prefetchersBuilder.add(actionInputPrefetcher);
+ ActionInputPrefetcher actionInputPrefetcher = module.getPrefetcher();
+ if (actionInputPrefetcher != null) {
+ prefetchersBuilder.add(actionInputPrefetcher);
+ }
}
}
final ImmutableList<ActionInputPrefetcher> actionInputPrefetchers = prefetchersBuilder.build();