diff options
author | 2021-03-04 10:01:34 -0800 | |
---|---|---|
committer | 2021-03-04 10:01:34 -0800 | |
commit | 5c113d13eb64f40e5d0d4212ca112cacc7979756 (patch) | |
tree | 9ca93fe8eefb8eb2411bd24c2738e1e43e99c4aa /java/lint.go | |
parent | 00d93b143f3409241cf026be71e56dd696539e16 (diff) |
Remove lint outputs to prevent showing old lint results on error
The lint rules dumped the text output file to stdout on error. If the
lint binary exited without updating the output file it would show old
results.
Remove the output files before running lint, and only dump the text
output file if it exists.
Bug: 181681346
Test: m lint-check
Change-Id: I4fa962b1212e8715f234912a9a5e049d5c1540e8
Diffstat (limited to 'java/lint.go')
-rw-r--r-- | java/lint.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/java/lint.go b/java/lint.go index 12e412988..50b84dc71 100644 --- a/java/lint.go +++ b/java/lint.go @@ -313,6 +313,7 @@ func (l *linter) lint(ctx android.ModuleContext) { rule.Command().Text("rm -rf").Flag(cacheDir.String()).Flag(homeDir.String()) rule.Command().Text("mkdir -p").Flag(cacheDir.String()).Flag(homeDir.String()) + rule.Command().Text("rm -f").Output(html).Output(text).Output(xml) var annotationsZipPath, apiVersionsXMLPath android.Path if ctx.Config().AlwaysUsePrebuiltSdks() { @@ -361,7 +362,7 @@ func (l *linter) lint(ctx android.ModuleContext) { } } - cmd.Text("|| (").Text("cat").Input(text).Text("; exit 7)").Text(")") + cmd.Text("|| (").Text("if [ -e").Input(text).Text("]; then cat").Input(text).Text("; fi; exit 7)").Text(")") rule.Command().Text("rm -rf").Flag(cacheDir.String()).Flag(homeDir.String()) |