Fix the NPE when processing catastrophic analysis error.
The NPE showed that we do indeed have catastrophic errors in the analysis phase, unlike previously thought. This CL adds the BugReporter to the analysis-only error check to avoid the NPE, and also to give us information of the catastrophic error so that it can be properly rethrown later on.
PiperOrigin-RevId: 435585975
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java b/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java
index 7c5a9c7..07d0ea9 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java
@@ -398,6 +398,7 @@
memoizedConfigurationLookupSupplier,
topLevelOptions,
eventBus,
+ bugReporter,
keepGoing,
loadingPhaseThreads,
viewOptions.strictConflictChecks,
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java
index df7ceca..8297ab2 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java
@@ -372,6 +372,7 @@
Supplier<Map<BuildConfigurationKey, BuildConfigurationValue>> configurationLookupSupplier,
TopLevelArtifactContext topLevelArtifactContextForConflictPruning,
EventBus eventBus,
+ BugReporter bugReporter,
boolean keepGoing,
int numThreads,
boolean strictConflictChecks,
@@ -489,7 +490,8 @@
skyframeExecutor.getCyclesReporter(),
eventHandler,
keepGoing,
- eventBus);
+ eventBus,
+ bugReporter);
ViewCreationFailedException noKeepGoingExceptionDueToConflict = null;
// Sometimes there are action conflicts, but the actions aren't actually required to run by the
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeErrorProcessor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeErrorProcessor.java
index aa239b7..c86fe05 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeErrorProcessor.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeErrorProcessor.java
@@ -116,7 +116,8 @@
CyclesReporter cyclesReporter,
ExtendedEventHandler eventHandler,
boolean keepGoing,
- @Nullable EventBus eventBus)
+ @Nullable EventBus eventBus,
+ BugReporter bugReporter)
throws InterruptedException, ViewCreationFailedException {
try {
return processErrors(
@@ -126,7 +127,7 @@
eventHandler,
keepGoing,
eventBus,
- /*bugReporter=*/ null,
+ bugReporter,
/*includeExecutionPhase=*/ false);
} catch (BuildFailedException | TestExecException unexpected) {
throw new IllegalStateException("Unexpected execution phase exception: ", unexpected);
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java
index 752e5af..5b44c051a 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java
@@ -1865,7 +1865,8 @@
cyclesReporter,
eventHandler,
/*keepGoing=*/ true,
- /*eventBus=*/ null);
+ /*eventBus=*/ null,
+ bugReporter);
} catch (ViewCreationFailedException ignored) {
// Ignored.
}