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
This commit is contained in:
Colin Cross 2021-09-09 09:36:25 -07:00
parent a0dc31d4a2
commit 6b76c15b9a

View file

@ -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())