diff options
Diffstat (limited to 'java/lint.go')
-rw-r--r-- | java/lint.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/java/lint.go b/java/lint.go index cd2a904d6..a42deecdf 100644 --- a/java/lint.go +++ b/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()) |