diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime/BlazeWorkspace.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/BlazeWorkspace.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeWorkspace.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeWorkspace.java index 98c56c48c8..e2d08b1298 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeWorkspace.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeWorkspace.java @@ -21,6 +21,7 @@ import com.google.common.eventbus.EventBus; import com.google.common.eventbus.SubscriberExceptionHandler; import com.google.devtools.build.lib.actions.cache.ActionCache; import com.google.devtools.build.lib.actions.cache.CompactPersistentActionCache; +import com.google.devtools.build.lib.actions.cache.StubActionCache; import com.google.devtools.build.lib.analysis.BlazeDirectories; import com.google.devtools.build.lib.analysis.WorkspaceStatusAction; import com.google.devtools.build.lib.analysis.config.BinTools; @@ -219,6 +220,16 @@ public final class BlazeWorkspace { */ public ActionCache getPersistentActionCache(Reporter reporter) throws IOException { if (actionCache == null) { + boolean useActionCache = + runtime + .getStartupOptionsProvider() + .getOptions(BlazeServerStartupOptions.class) + .useActionCache; + if (!useActionCache) { + reporter.handle(Event.info("Action cache disabled")); + actionCache = new StubActionCache(); + return actionCache; + } try (AutoProfiler p = profiledAndLogged("Loading action cache", ProfilerTask.INFO, LOG)) { try { actionCache = new CompactPersistentActionCache(getCacheDirectory(), runtime.getClock()); |