From 6b76c15b9a03952e122522279fc0ada4e7a8fbbd Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 9 Sep 2021 09:36:25 -0700 Subject: [PATCH] Pass --write-reference-baseline to lint Make lint write a baseline file to the output directory that can be used as a starting point when baselining new errors. Bug: 197238141 Test: out/soong/.intermediates/cts/apps/CtsVerifier/cts-verifier-framework/android_common/lint/lint-report.html Change-Id: I72033bb870bff5a72b648737219d11315fabf134 --- java/lint.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/java/lint.go b/java/lint.go index fe3218e90..7845c336b 100644 --- a/java/lint.go +++ b/java/lint.go @@ -377,6 +377,7 @@ func (l *linter) lint(ctx android.ModuleContext) { html := android.PathForModuleOut(ctx, "lint", "lint-report.html") text := android.PathForModuleOut(ctx, "lint", "lint-report.txt") xml := android.PathForModuleOut(ctx, "lint", "lint-report.xml") + baseline := android.PathForModuleOut(ctx, "lint", "lint-baseline.xml") depSetsBuilder := NewLintDepSetBuilder().Direct(html, text, xml) @@ -447,6 +448,8 @@ func (l *linter) lint(ctx android.ModuleContext) { cmd.FlagWithInput("--baseline ", lintBaseline.Path()) } + 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())