Add support for lint baseline files
Test: m droid Test: go test ^TestJavaLint # (from soong/build/java) Change-Id: I249a0a0597b0bf8495460ed283b476ad2eb36edc
This commit is contained in:
18
java/lint.go
18
java/lint.go
@@ -19,6 +19,8 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/google/blueprint/proptools"
|
||||
|
||||
"android/soong/android"
|
||||
)
|
||||
|
||||
@@ -46,6 +48,9 @@ type LintProperties struct {
|
||||
|
||||
// Modules that provide extra lint checks
|
||||
Extra_check_modules []string
|
||||
|
||||
// Name of the file that lint uses as the baseline. Defaults to "lint-baseline.xml".
|
||||
Baseline_filename *string
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,6 +348,19 @@ func (l *linter) lint(ctx android.ModuleContext) {
|
||||
cmd.FlagWithArg("--check ", checkOnly)
|
||||
}
|
||||
|
||||
if lintFilename := proptools.StringDefault(l.properties.Lint.Baseline_filename, "lint-baseline.xml"); lintFilename != "" {
|
||||
var lintBaseline android.OptionalPath
|
||||
if String(l.properties.Lint.Baseline_filename) != "" {
|
||||
// if manually specified, we require the file to exist
|
||||
lintBaseline = android.OptionalPathForPath(android.PathForModuleSrc(ctx, lintFilename))
|
||||
} else {
|
||||
lintBaseline = android.ExistentPathForSource(ctx, ctx.ModuleDir(), lintFilename)
|
||||
}
|
||||
if lintBaseline.Valid() {
|
||||
cmd.FlagWithInput("--baseline ", lintBaseline.Path())
|
||||
}
|
||||
}
|
||||
|
||||
cmd.Text("|| (").Text("cat").Input(text).Text("; exit 7)").Text(")")
|
||||
|
||||
rule.Command().Text("rm -rf").Flag(cacheDir.String()).Flag(homeDir.String())
|
||||
|
Reference in New Issue
Block a user