Forbid bypassing updatability lint checks.
Test: lint_test.go Bug: 182349282 Change-Id: Iac7c01493b449c2ddd6df6c68f8a74dfe72dfd7a
This commit is contained in:
16
java/lint.go
16
java/lint.go
@@ -26,6 +26,10 @@ import (
|
||||
"android/soong/remoteexec"
|
||||
)
|
||||
|
||||
// lint checks automatically enforced for modules that have different min_sdk_version than
|
||||
// sdk_version
|
||||
var updatabilityChecks = []string{"NewApi"}
|
||||
|
||||
type LintProperties struct {
|
||||
// Controls for running Android Lint on the module.
|
||||
Lint struct {
|
||||
@@ -298,7 +302,17 @@ func (l *linter) lint(ctx android.ModuleContext) {
|
||||
}
|
||||
|
||||
if l.minSdkVersion != l.compileSdkVersion {
|
||||
l.extraMainlineLintErrors = append(l.extraMainlineLintErrors, "NewApi")
|
||||
l.extraMainlineLintErrors = append(l.extraMainlineLintErrors, updatabilityChecks...)
|
||||
_, filtered := android.FilterList(l.properties.Lint.Warning_checks, updatabilityChecks)
|
||||
if len(filtered) != 0 {
|
||||
ctx.PropertyErrorf("lint.warning_checks",
|
||||
"Can't treat %v checks as warnings if min_sdk_version is different from sdk_version.", filtered)
|
||||
}
|
||||
_, filtered = android.FilterList(l.properties.Lint.Disabled_checks, updatabilityChecks)
|
||||
if len(filtered) != 0 {
|
||||
ctx.PropertyErrorf("lint.disabled_checks",
|
||||
"Can't disable %v checks if min_sdk_version is different from sdk_version.", filtered)
|
||||
}
|
||||
}
|
||||
|
||||
extraLintCheckModules := ctx.GetDirectDepsWithTag(extraLintCheckTag)
|
||||
|
Reference in New Issue
Block a user