diff options
author | 2024-01-04 20:00:58 +0000 | |
---|---|---|
committer | 2024-01-04 20:00:58 +0000 | |
commit | 5cb14e12d28fd859a68a0efac992e602ae594bb6 (patch) | |
tree | 955849a46cab5e57cc4b55b5eb035402b63ab7d7 /java/lint.go | |
parent | 1f1662217a384b6d7b117a529a12cfbfa2994272 (diff) | |
parent | b765d6bd460dba905ada40be8e89db699232d569 (diff) |
Merge "Don't implicitly pick up lint-baseline.xml" into main
Diffstat (limited to 'java/lint.go')
-rw-r--r-- | java/lint.go | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/java/lint.go b/java/lint.go index 5a684a8c0..39f9df273 100644 --- a/java/lint.go +++ b/java/lint.go @@ -56,7 +56,8 @@ 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". + // The lint baseline file to use. If specified, lint warnings listed in this file will be + // suppressed during lint checks. Baseline_filename *string // If true, baselining updatability lint checks (e.g. NewApi) is prohibited. Defaults to false. @@ -365,19 +366,6 @@ func (l *linter) generateManifest(ctx android.ModuleContext, rule *android.RuleB return manifestPath } -func (l *linter) getBaselineFilepath(ctx android.ModuleContext) android.OptionalPath { - var lintBaseline android.OptionalPath - if lintFilename := proptools.StringDefault(l.properties.Lint.Baseline_filename, "lint-baseline.xml"); lintFilename != "" { - 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) - } - } - return lintBaseline -} - func (l *linter) lint(ctx android.ModuleContext) { if !l.enabled() { return @@ -518,9 +506,8 @@ func (l *linter) lint(ctx android.ModuleContext) { cmd.FlagWithArg("--check ", checkOnly) } - lintBaseline := l.getBaselineFilepath(ctx) - if lintBaseline.Valid() { - cmd.FlagWithInput("--baseline ", lintBaseline.Path()) + if l.properties.Lint.Baseline_filename != nil { + cmd.FlagWithInput("--baseline ", android.PathForModuleSrc(ctx, *l.properties.Lint.Baseline_filename)) } cmd.FlagWithOutput("--write-reference-baseline ", referenceBaseline) |