summaryrefslogtreecommitdiff
path: root/java/lint.go
diff options
context:
space:
mode:
Diffstat (limited to 'java/lint.go')
-rw-r--r--java/lint.go19
1 files changed, 11 insertions, 8 deletions
diff --git a/java/lint.go b/java/lint.go
index 931820d74..fcd6d31ff 100644
--- a/java/lint.go
+++ b/java/lint.go
@@ -473,20 +473,23 @@ func (l *linter) lint(ctx android.ModuleContext) {
cmd.FlagWithOutput("--write-reference-baseline ", baseline)
- cmd.Text("|| (").Text("if [ -e").Input(text).Text("]; then cat").Input(text).Text("; fi; exit 7)")
-
- rule.Command().Text("rm -rf").Flag(lintPaths.cacheDir.String()).Flag(lintPaths.homeDir.String())
-
- // The HTML output contains a date, remove it to make the output deterministic.
- rule.Command().Text(`sed -i.tmp -e 's|Check performed at .*\(</nav>\)|\1|'`).Output(html)
+ cmd.Text("; EXITCODE=$?; ")
// The sources in the sandbox may have been modified by --apply-suggestions, zip them up and
- // export them out of the sandbox.
- rule.Command().BuiltTool("soong_zip").
+ // export them out of the sandbox. Do this before exiting so that the suggestions exit even after
+ // a fatal error.
+ cmd.BuiltTool("soong_zip").
FlagWithOutput("-o ", android.PathForModuleOut(ctx, "lint", "suggested-fixes.zip")).
FlagWithArg("-C ", cmd.PathForInput(android.PathForSource(ctx))).
FlagWithInput("-r ", srcsList)
+ cmd.Text("; if [ $EXITCODE != 0 ]; then if [ -e").Input(text).Text("]; then cat").Input(text).Text("; fi; exit $EXITCODE; fi")
+
+ rule.Command().Text("rm -rf").Flag(lintPaths.cacheDir.String()).Flag(lintPaths.homeDir.String())
+
+ // The HTML output contains a date, remove it to make the output deterministic.
+ rule.Command().Text(`sed -i.tmp -e 's|Check performed at .*\(</nav>\)|\1|'`).Output(html)
+
rule.Build("lint", "lint")
l.outputs = lintOutputs{