Merge "Zip lint reference baselines" am: 831e50f4ca

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2468261

Change-Id: I42c18e59b1df98fab18abd766627d8c2e2bbc750
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2023-03-03 17:36:40 +00:00
committed by Automerger Merge Worker

View File

@@ -96,9 +96,10 @@ type linter struct {
} }
type lintOutputs struct { type lintOutputs struct {
html android.Path html android.Path
text android.Path text android.Path
xml android.Path xml android.Path
referenceBaseline android.Path
depSets LintDepSets depSets LintDepSets
} }
@@ -450,7 +451,7 @@ func (l *linter) lint(ctx android.ModuleContext) {
html := android.PathForModuleOut(ctx, "lint", "lint-report.html") html := android.PathForModuleOut(ctx, "lint", "lint-report.html")
text := android.PathForModuleOut(ctx, "lint", "lint-report.txt") text := android.PathForModuleOut(ctx, "lint", "lint-report.txt")
xml := android.PathForModuleOut(ctx, "lint", "lint-report.xml") xml := android.PathForModuleOut(ctx, "lint", "lint-report.xml")
baseline := android.PathForModuleOut(ctx, "lint", "lint-baseline.xml") referenceBaseline := android.PathForModuleOut(ctx, "lint", "lint-baseline.xml")
depSetsBuilder := NewLintDepSetBuilder().Direct(html, text, xml) depSetsBuilder := NewLintDepSetBuilder().Direct(html, text, xml)
@@ -513,7 +514,7 @@ func (l *linter) lint(ctx android.ModuleContext) {
cmd.FlagWithInput("--baseline ", lintBaseline.Path()) cmd.FlagWithInput("--baseline ", lintBaseline.Path())
} }
cmd.FlagWithOutput("--write-reference-baseline ", baseline) cmd.FlagWithOutput("--write-reference-baseline ", referenceBaseline)
cmd.Text("; EXITCODE=$?; ") cmd.Text("; EXITCODE=$?; ")
@@ -535,9 +536,10 @@ func (l *linter) lint(ctx android.ModuleContext) {
rule.Build("lint", "lint") rule.Build("lint", "lint")
l.outputs = lintOutputs{ l.outputs = lintOutputs{
html: html, html: html,
text: text, text: text,
xml: xml, xml: xml,
referenceBaseline: referenceBaseline,
depSets: depSetsBuilder.Build(), depSets: depSetsBuilder.Build(),
} }
@@ -569,9 +571,10 @@ func BuildModuleLintReportZips(ctx android.ModuleContext, depSets LintDepSets) a
} }
type lintSingleton struct { type lintSingleton struct {
htmlZip android.WritablePath htmlZip android.WritablePath
textZip android.WritablePath textZip android.WritablePath
xmlZip android.WritablePath xmlZip android.WritablePath
referenceBaselineZip android.WritablePath
} }
func (l *lintSingleton) GenerateBuildActions(ctx android.SingletonContext) { func (l *lintSingleton) GenerateBuildActions(ctx android.SingletonContext) {
@@ -684,12 +687,15 @@ func (l *lintSingleton) generateLintReportZips(ctx android.SingletonContext) {
l.xmlZip = android.PathForOutput(ctx, "lint-report-xml.zip") l.xmlZip = android.PathForOutput(ctx, "lint-report-xml.zip")
zip(l.xmlZip, func(l *lintOutputs) android.Path { return l.xml }) zip(l.xmlZip, func(l *lintOutputs) android.Path { return l.xml })
ctx.Phony("lint-check", l.htmlZip, l.textZip, l.xmlZip) l.referenceBaselineZip = android.PathForOutput(ctx, "lint-report-reference-baselines.zip")
zip(l.referenceBaselineZip, func(l *lintOutputs) android.Path { return l.referenceBaseline })
ctx.Phony("lint-check", l.htmlZip, l.textZip, l.xmlZip, l.referenceBaselineZip)
} }
func (l *lintSingleton) MakeVars(ctx android.MakeVarsContext) { func (l *lintSingleton) MakeVars(ctx android.MakeVarsContext) {
if !ctx.Config().UnbundledBuild() { if !ctx.Config().UnbundledBuild() {
ctx.DistForGoal("lint-check", l.htmlZip, l.textZip, l.xmlZip) ctx.DistForGoal("lint-check", l.htmlZip, l.textZip, l.xmlZip, l.referenceBaselineZip)
} }
} }