-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
InvalidConfigurationException
and add FailureDetail
to `Bui…
…ldCompletingEvent`
- Loading branch information
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,11 +59,8 @@ | |
import com.google.devtools.build.lib.analysis.ToolchainCollection; | ||
import com.google.devtools.build.lib.analysis.TopLevelArtifactContext; | ||
import com.google.devtools.build.lib.analysis.ViewCreationFailedException; | ||
import com.google.devtools.build.lib.analysis.config.BuildConfigurationValue; | ||
import com.google.devtools.build.lib.analysis.config.BuildOptions; | ||
import com.google.devtools.build.lib.analysis.config.*; | ||
This comment has been minimized.
Sorry, something went wrong.
michaeledgar
Contributor
|
||
import com.google.devtools.build.lib.analysis.config.BuildOptions.OptionsDiff; | ||
import com.google.devtools.build.lib.analysis.config.ConfigConditions; | ||
import com.google.devtools.build.lib.analysis.config.StarlarkTransitionCache; | ||
import com.google.devtools.build.lib.analysis.test.AnalysisFailurePropagationException; | ||
import com.google.devtools.build.lib.bugreport.BugReport; | ||
import com.google.devtools.build.lib.bugreport.BugReporter; | ||
|
@@ -84,6 +81,7 @@ | |
import com.google.devtools.build.lib.packages.TargetUtils; | ||
import com.google.devtools.build.lib.profiler.Profiler; | ||
import com.google.devtools.build.lib.profiler.SilentCloseable; | ||
import com.google.devtools.build.lib.server.FailureDetails; | ||
import com.google.devtools.build.lib.skyframe.ArtifactConflictFinder.ConflictException; | ||
import com.google.devtools.build.lib.skyframe.AspectKeyCreator.AspectKey; | ||
import com.google.devtools.build.lib.skyframe.AspectKeyCreator.TopLevelAspectsKey; | ||
|
@@ -269,11 +267,8 @@ private ImmutableSet<OptionDefinition> getNativeCacheInvalidatingDifferences( | |
|
||
/** Sets the configuration. Not thread-safe. DO NOT CALL except from tests! */ | ||
@VisibleForTesting | ||
public void setConfigurations( | ||
EventHandler eventHandler, | ||
BuildConfigurationCollection configurations, | ||
int maxDifferencesToShow, | ||
boolean failOnAnalysisCacheDiscard) throws AnalysisCacheDiscardedException { | ||
public void setConfiguration( | ||
EventHandler eventHandler, BuildConfigurationValue configuration, int maxDifferencesToShow, boolean failOnAnalysisCacheDiscard) throws InvalidConfigurationException { | ||
if (skyframeAnalysisWasDiscarded) { | ||
eventHandler.handle( | ||
Event.info( | ||
|
@@ -284,9 +279,10 @@ public void setConfigurations( | |
String diff = describeConfigurationDifference(configuration, maxDifferencesToShow); | ||
if (diff != null) { | ||
if (failOnAnalysisCacheDiscard) { | ||
throw new AnalysisCacheDiscardedException(diff); | ||
String message = String.format("%s, analysis cache would have been discarded.", diff); | ||
throw new InvalidConfigurationException( | ||
This comment has been minimized.
Sorry, something went wrong.
michaeledgar
Contributor
|
||
message, FailureDetails.BuildConfiguration.Code.CONFIGURATION_DISCARDED_ANALYSIS_CACHE); | ||
} | ||
|
||
eventHandler.handle(Event.info(diff + ", discarding analysis cache.")); | ||
// Note that clearing the analysis cache is currently required for correctness. It is also | ||
// helpful to save memory. | ||
|
1 comment
on commit bb30682
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks great! There are a few tiny style issues to fix, but substantively this change is just about ready. I've added one comment describing how to add a new AbortReason
for this case. By adding that, the BEP will mark all the per-ConfiguredTarget events with your custom AbortReason
. Without adding that, no AbortReason
will be present at all.
Please mark the
DetailedExitCode
argument@Nullable
, matching the field.