Merge changes I8ef31373,Ic408857d am: 7cb3f50fda

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

Change-Id: I5f2e8f2364f643fb91b617e9ada1bf75b762ebca
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2022-04-27 01:19:07 +00:00
committed by Automerger Merge Worker
3 changed files with 17 additions and 13 deletions

View File

@@ -1481,11 +1481,11 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
} }
if ctx.Device() { if ctx.Device() {
lintSDKVersionString := func(sdkSpec android.SdkSpec) string { lintSDKVersion := func(sdkSpec android.SdkSpec) android.ApiLevel {
if v := sdkSpec.ApiLevel; !v.IsPreview() { if v := sdkSpec.ApiLevel; !v.IsPreview() {
return v.String() return v
} else { } else {
return ctx.Config().DefaultAppTargetSdk(ctx).String() return ctx.Config().DefaultAppTargetSdk(ctx)
} }
} }
@@ -1494,9 +1494,9 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
j.linter.srcJars = srcJars j.linter.srcJars = srcJars
j.linter.classpath = append(append(android.Paths(nil), flags.bootClasspath...), flags.classpath...) j.linter.classpath = append(append(android.Paths(nil), flags.bootClasspath...), flags.classpath...)
j.linter.classes = j.implementationJarFile j.linter.classes = j.implementationJarFile
j.linter.minSdkVersion = lintSDKVersionString(j.MinSdkVersion(ctx)) j.linter.minSdkVersion = lintSDKVersion(j.MinSdkVersion(ctx))
j.linter.targetSdkVersion = lintSDKVersionString(j.TargetSdkVersion(ctx)) j.linter.targetSdkVersion = lintSDKVersion(j.TargetSdkVersion(ctx))
j.linter.compileSdkVersion = lintSDKVersionString(j.SdkVersion(ctx)) j.linter.compileSdkVersion = lintSDKVersion(j.SdkVersion(ctx))
j.linter.compileSdkKind = j.SdkVersion(ctx).Kind j.linter.compileSdkKind = j.SdkVersion(ctx).Kind
j.linter.javaLanguageLevel = flags.javaVersion.String() j.linter.javaLanguageLevel = flags.javaVersion.String()
j.linter.kotlinLanguageLevel = "1.3" j.linter.kotlinLanguageLevel = "1.3"

View File

@@ -75,9 +75,9 @@ type linter struct {
extraLintCheckJars android.Paths extraLintCheckJars android.Paths
test bool test bool
library bool library bool
minSdkVersion string minSdkVersion android.ApiLevel
targetSdkVersion string targetSdkVersion android.ApiLevel
compileSdkVersion string compileSdkVersion android.ApiLevel
compileSdkKind android.SdkKind compileSdkKind android.SdkKind
javaLanguageLevel string javaLanguageLevel string
kotlinLanguageLevel string kotlinLanguageLevel string
@@ -300,7 +300,7 @@ func (l *linter) generateManifest(ctx android.ModuleContext, rule *android.RuleB
Text(`echo "<manifest xmlns:android='http://schemas.android.com/apk/res/android'" &&`). Text(`echo "<manifest xmlns:android='http://schemas.android.com/apk/res/android'" &&`).
Text(`echo " android:versionCode='1' android:versionName='1' >" &&`). Text(`echo " android:versionCode='1' android:versionName='1' >" &&`).
Textf(`echo " <uses-sdk android:minSdkVersion='%s' android:targetSdkVersion='%s'/>" &&`, Textf(`echo " <uses-sdk android:minSdkVersion='%s' android:targetSdkVersion='%s'/>" &&`,
l.minSdkVersion, l.targetSdkVersion). l.minSdkVersion.String(), l.targetSdkVersion.String()).
Text(`echo "</manifest>"`). Text(`echo "</manifest>"`).
Text(") >").Output(manifestPath) Text(") >").Output(manifestPath)
@@ -325,7 +325,7 @@ func (l *linter) lint(ctx android.ModuleContext) {
return return
} }
if l.minSdkVersion != l.compileSdkVersion { if l.minSdkVersion.CompareTo(l.compileSdkVersion) == -1 {
l.extraMainlineLintErrors = append(l.extraMainlineLintErrors, updatabilityChecks...) l.extraMainlineLintErrors = append(l.extraMainlineLintErrors, updatabilityChecks...)
_, filtered := android.FilterList(l.properties.Lint.Warning_checks, updatabilityChecks) _, filtered := android.FilterList(l.properties.Lint.Warning_checks, updatabilityChecks)
if len(filtered) != 0 { if len(filtered) != 0 {
@@ -427,7 +427,7 @@ func (l *linter) lint(ctx android.ModuleContext) {
FlagWithOutput("--html ", html). FlagWithOutput("--html ", html).
FlagWithOutput("--text ", text). FlagWithOutput("--text ", text).
FlagWithOutput("--xml ", xml). FlagWithOutput("--xml ", xml).
FlagWithArg("--compile-sdk-version ", l.compileSdkVersion). FlagWithArg("--compile-sdk-version ", l.compileSdkVersion.String()).
FlagWithArg("--java-language-level ", l.javaLanguageLevel). FlagWithArg("--java-language-level ", l.javaLanguageLevel).
FlagWithArg("--kotlin-language-level ", l.kotlinLanguageLevel). FlagWithArg("--kotlin-language-level ", l.kotlinLanguageLevel).
FlagWithArg("--url ", fmt.Sprintf(".=.,%s=out", android.PathForOutput(ctx).String())). FlagWithArg("--url ", fmt.Sprintf(".=.,%s=out", android.PathForOutput(ctx).String())).

View File

@@ -28,6 +28,11 @@
--disable_check SuspiciousImport --disable_check SuspiciousImport
--disable_check UnusedResources --disable_check UnusedResources
--disable_check ViewConstructor --disable_check ViewConstructor
# Disable NewApi checks for the platform since platform is the one that implements
# the API. This prevents noisy lint warnings like b/228956345#1
# NewApi checks will continue to be enforced for apex deps since
# lint.strict_updatability_linting will be true for those Soong modules
--disable_check NewApi
# Downgrade existing errors to warnings # Downgrade existing errors to warnings
--warning_check AppCompatResource # 55 occurences in 10 modules --warning_check AppCompatResource # 55 occurences in 10 modules
@@ -66,7 +71,6 @@
--warning_check MissingTvBanner # 3 occurences in 3 modules --warning_check MissingTvBanner # 3 occurences in 3 modules
--warning_check NamespaceTypo # 3 occurences in 3 modules --warning_check NamespaceTypo # 3 occurences in 3 modules
--warning_check NetworkSecurityConfig # 46 occurences in 12 modules --warning_check NetworkSecurityConfig # 46 occurences in 12 modules
--warning_check NewApi # 1996 occurences in 122 modules
--warning_check NotSibling # 15 occurences in 10 modules --warning_check NotSibling # 15 occurences in 10 modules
--warning_check ObjectAnimatorBinding # 14 occurences in 5 modules --warning_check ObjectAnimatorBinding # 14 occurences in 5 modules
--warning_check OnClick # 49 occurences in 21 modules --warning_check OnClick # 49 occurences in 21 modules