Don't print "Building complete" (and save the action caches) if we're about to crash or exit abruptly. It just confuses users and could potentially cause other problems.
--
MOS_MIGRATED_REVID=109702171
diff --git a/src/main/java/com/google/devtools/build/lib/buildtool/ExecutionTool.java b/src/main/java/com/google/devtools/build/lib/buildtool/ExecutionTool.java
index 7e8795f..69d343b 100644
--- a/src/main/java/com/google/devtools/build/lib/buildtool/ExecutionTool.java
+++ b/src/main/java/com/google/devtools/build/lib/buildtool/ExecutionTool.java
@@ -387,26 +387,26 @@
request.getOptionsDescription());
Set<ConfiguredTarget> builtTargets = new HashSet<>();
- boolean interrupted = false;
+ Collection<AspectValue> aspects = analysisResult.getAspects();
+
+ Iterable<Artifact> allArtifactsForProviders =
+ Iterables.concat(
+ additionalArtifacts,
+ TopLevelArtifactHelper.getAllArtifactsToBuild(
+ analysisResult.getTargetsToBuild(), analysisResult.getTopLevelContext())
+ .getAllArtifacts(),
+ TopLevelArtifactHelper.getAllArtifactsToBuildFromAspects(
+ aspects, analysisResult.getTopLevelContext())
+ .getAllArtifacts(),
+ //TODO(dslomov): Artifacts to test from aspects?
+ TopLevelArtifactHelper.getAllArtifactsToTest(analysisResult.getTargetsToTest()));
+
+ if (request.isRunningInEmacs()) {
+ // The syntax of this message is tightly constrained by lisp/progmodes/compile.el in emacs
+ request.getOutErr().printErrLn("blaze: Entering directory `" + getExecRoot() + "/'");
+ }
+ boolean buildCompleted = false;
try {
- Collection<AspectValue> aspects = analysisResult.getAspects();
-
- Iterable<Artifact> allArtifactsForProviders =
- Iterables.concat(
- additionalArtifacts,
- TopLevelArtifactHelper.getAllArtifactsToBuild(
- analysisResult.getTargetsToBuild(), analysisResult.getTopLevelContext())
- .getAllArtifacts(),
- TopLevelArtifactHelper.getAllArtifactsToBuildFromAspects(
- aspects, analysisResult.getTopLevelContext())
- .getAllArtifacts(),
- //TODO(dslomov): Artifacts to test from aspects?
- TopLevelArtifactHelper.getAllArtifactsToTest(analysisResult.getTargetsToTest()));
-
- if (request.isRunningInEmacs()) {
- // The syntax of this message is tightly constrained by lisp/progmodes/compile.el in emacs
- request.getOutErr().printErrLn("blaze: Entering directory `" + getExecRoot() + "/'");
- }
for (ActionContextProvider actionContextProvider : actionContextProviders) {
actionContextProvider.executionPhaseStarting(
fileCache,
@@ -439,16 +439,16 @@
builtTargets,
request.getBuildOptions().explanationPath != null,
runtime.getLastExecutionTimeRange());
-
- } catch (InterruptedException e) {
- interrupted = true;
+ buildCompleted = true;
+ } catch (BuildFailedException | TestExecException e) {
+ buildCompleted = true;
throw e;
} finally {
env.recordLastExecutionTime();
if (request.isRunningInEmacs()) {
request.getOutErr().printErrLn("blaze: Leaving directory `" + getExecRoot() + "/'");
}
- if (!interrupted) {
+ if (buildCompleted) {
getReporter().handle(Event.progress("Building complete."));
}
@@ -463,7 +463,7 @@
Profiler.instance().markPhase(ProfilePhase.FINISH);
- if (!interrupted) {
+ if (buildCompleted) {
saveCaches(actionCache);
}