aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
index 65e5954fc9..7789605f1d 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
@@ -33,6 +33,7 @@ import com.google.devtools.build.lib.analysis.config.BuildOptions;
import com.google.devtools.build.lib.analysis.config.ConfigurationFragmentFactory;
import com.google.devtools.build.lib.analysis.test.CoverageReportActionFactory;
import com.google.devtools.build.lib.buildeventstream.PathConverter;
+import com.google.devtools.build.lib.buildtool.BuildRequestOptions;
import com.google.devtools.build.lib.clock.BlazeClock;
import com.google.devtools.build.lib.clock.Clock;
import com.google.devtools.build.lib.events.Event;
@@ -424,10 +425,7 @@ public final class BlazeRuntime {
workspace.getSkyframeExecutor().getEventBus().post(new CommandCompleteEvent(exitCode));
}
- /**
- * Hook method called by the BlazeCommandDispatcher after the dispatch of each
- * command.
- */
+ /** Hook method called by the BlazeCommandDispatcher after the dispatch of each command. */
@VisibleForTesting
public void afterCommand(CommandEnvironment env, int exitCode) {
// Remove any filters that the command might have added to the reporter.
@@ -439,6 +437,15 @@ public final class BlazeRuntime {
module.afterCommand();
}
+ // If the command just completed was or inherits from Build, wipe the dependency graph if
+ // requested. This is sufficient, as this method is always run at the end of commands unless
+ // the server crashes, in which case no inmemory state will linger for the next build anyway.
+ BuildRequestOptions buildRequestOptions =
+ env.getOptions().getOptions(BuildRequestOptions.class);
+ if (buildRequestOptions != null && !buildRequestOptions.keepStateAfterBuild) {
+ workspace.getSkyframeExecutor().resetEvaluator();
+ }
+
env.getBlazeWorkspace().clearEventBus();
try {