-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add option to exit early if analysis cache is discarded
- Loading branch information
Showing
12 changed files
with
91 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/main/java/com/google/devtools/build/lib/skyframe/AnalysisCacheDiscardedException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.google.devtools.build.lib.skyframe; | ||
|
||
import com.google.devtools.build.lib.server.FailureDetails; | ||
import com.google.devtools.build.lib.util.DetailedExitCode; | ||
|
||
/** | ||
* An exception thrown when the analysis cache is discarded, and the `fail_on_analysis_cache_discard` option is | ||
* set. | ||
*/ | ||
public class AnalysisCacheDiscardedException extends Exception implements DetailedException { | ||
static final String DISCARD_FLAG = "--fail_on_analysis_cache_discard"; | ||
|
||
public AnalysisCacheDiscardedException(String diff) { | ||
super(String.format("%s, analysis cache would have been discarded and %s is set.", diff, DISCARD_FLAG)); | ||
} | ||
|
||
@Override | ||
public DetailedExitCode getDetailedExitCode() { | ||
return DetailedExitCode.of( | ||
FailureDetails.FailureDetail | ||
.newBuilder() | ||
.setMessage(this.getMessage()) | ||
.setAnalysis( | ||
FailureDetails.Analysis | ||
.newBuilder() | ||
.setCode( | ||
FailureDetails.Analysis.Code.ANALYSIS_CACHE_DISCARDED | ||
).build() | ||
) | ||
.build() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters