From a52ecf0c5c9a5310c4a2c01232ece0804e719618 Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Wed, 20 Dec 2023 11:57:07 -0800 Subject: [PATCH] List baseline_filename on modules that are implititly using it lintable modules currently pick up files named "lint-baseline.xml" to use as the lint baseline implicitly. This is confusing because you could end up using the baseline files in more modules than intended. Lint also has a feature where it requests you remove unnecessary findings from the baseline file, so something could be necessary for one module, but unnecessary for another that accidentally picked up the baseline. We're removing the implicit detection of the baseline file, which requires all modules using it to list the baseline file explicitly. Bug: 272769514 Test: Presubmits Change-Id: If873a4ea20d73bb6268d83589c4fb3ebe54af664 --- Tethering/Android.bp | 38 +++++++++++++++++++++++++++++--------- framework/Android.bp | 25 +++++++++++++++++++++---- nearby/service/Android.bp | 9 ++++++--- service-t/Android.bp | 9 +++++++-- service/Android.bp | 18 +++++++++++++++++- 5 files changed, 80 insertions(+), 19 deletions(-) diff --git a/Tethering/Android.bp b/Tethering/Android.bp index 414e50a103..73c11baae1 100644 --- a/Tethering/Android.bp +++ b/Tethering/Android.bp @@ -94,14 +94,17 @@ android_library { "ConnectivityNextEnableDefaults", "TetheringAndroidLibraryDefaults", "TetheringApiLevel", - "TetheringReleaseTargetSdk" + "TetheringReleaseTargetSdk", ], static_libs: [ "NetworkStackApiCurrentShims", "net-utils-device-common-struct", ], apex_available: ["com.android.tethering"], - lint: { strict_updatability_linting: true }, + lint: { + strict_updatability_linting: true, + baseline_filename: "lint-baseline.xml", + }, } android_library { @@ -109,14 +112,17 @@ android_library { defaults: [ "TetheringAndroidLibraryDefaults", "TetheringApiLevel", - "TetheringReleaseTargetSdk" + "TetheringReleaseTargetSdk", ], static_libs: [ "NetworkStackApiStableShims", "net-utils-device-common-struct", ], apex_available: ["com.android.tethering"], - lint: { strict_updatability_linting: true }, + lint: { + strict_updatability_linting: true, + baseline_filename: "lint-baseline.xml", + }, } // Due to b/143733063, APK can't access a jni lib that is in APEX (but not in the APK). @@ -189,20 +195,28 @@ java_defaults { optimize: { proguard_flags_files: ["proguard.flags"], }, - lint: { strict_updatability_linting: true }, + lint: { + strict_updatability_linting: true, + }, } // Updatable tethering packaged for finalized API android_app { name: "Tethering", - defaults: ["TetheringAppDefaults", "TetheringApiLevel"], + defaults: [ + "TetheringAppDefaults", + "TetheringApiLevel", + ], static_libs: ["TetheringApiStableLib"], certificate: "networkstack", manifest: "AndroidManifest.xml", use_embedded_native_libs: true, privapp_allowlist: ":privapp_allowlist_com.android.tethering", apex_available: ["com.android.tethering"], - lint: { strict_updatability_linting: true }, + lint: { + strict_updatability_linting: true, + baseline_filename: "lint-baseline.xml", + }, } android_app { @@ -221,6 +235,7 @@ android_app { lint: { strict_updatability_linting: true, error_checks: ["NewApi"], + baseline_filename: "lint-baseline.xml", }, } @@ -239,19 +254,24 @@ sdk { java_library_static { name: "tetheringstatsprotos", - proto: {type: "lite"}, + proto: { + type: "lite", + }, srcs: [ "src/com/android/networkstack/tethering/metrics/stats.proto", ], static_libs: ["tetheringprotos"], apex_available: ["com.android.tethering"], min_sdk_version: "30", + lint: { + baseline_filename: "lint-baseline.xml", + }, } genrule { name: "statslog-tethering-java-gen", tools: ["stats-log-api-gen"], cmd: "$(location stats-log-api-gen) --java $(out) --module network_tethering" + - " --javaPackage com.android.networkstack.tethering.metrics --javaClass TetheringStatsLog", + " --javaPackage com.android.networkstack.tethering.metrics --javaClass TetheringStatsLog", out: ["com/android/networkstack/tethering/metrics/TetheringStatsLog.java"], } diff --git a/framework/Android.bp b/framework/Android.bp index 1e6262d655..7ec397122c 100644 --- a/framework/Android.bp +++ b/framework/Android.bp @@ -105,7 +105,9 @@ java_defaults { apex_available: [ "com.android.tethering", ], - lint: { strict_updatability_linting: true }, + lint: { + strict_updatability_linting: true, + }, } java_library { @@ -134,7 +136,10 @@ java_library { "framework-tethering.impl", "framework-wifi.stubs.module_lib", ], - visibility: ["//packages/modules/Connectivity:__subpackages__"] + visibility: ["//packages/modules/Connectivity:__subpackages__"], + lint: { + baseline_filename: "lint-baseline.xml", + }, } java_defaults { @@ -189,6 +194,9 @@ java_sdk_library { "//packages/modules/NetworkStack/tests:__subpackages__", "//packages/modules/Wifi/service/tests/wifitests", ], + lint: { + baseline_filename: "lint-baseline.xml", + }, } platform_compat_config { @@ -248,6 +256,9 @@ java_library { apex_available: [ "com.android.tethering", ], + lint: { + baseline_filename: "lint-baseline.xml", + }, } java_genrule { @@ -293,9 +304,9 @@ droidstubs { ], flags: [ "--show-for-stub-purposes-annotation android.annotation.SystemApi" + - "\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\)", + "\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\)", "--show-for-stub-purposes-annotation android.annotation.SystemApi" + - "\\(client=android.annotation.SystemApi.Client.MODULE_LIBRARIES\\)", + "\\(client=android.annotation.SystemApi.Client.MODULE_LIBRARIES\\)", ], aidl: { include_dirs: [ @@ -308,6 +319,9 @@ droidstubs { java_library { name: "framework-connectivity-module-api-stubs-including-flagged", srcs: [":framework-connectivity-module-api-stubs-including-flagged-droidstubs"], + lint: { + baseline_filename: "lint-baseline.xml", + }, } // Library providing limited APIs within the connectivity module, so that R+ components like @@ -332,4 +346,7 @@ java_library { visibility: [ "//packages/modules/Connectivity/Tethering:__subpackages__", ], + lint: { + baseline_filename: "lint-baseline.xml", + }, } diff --git a/nearby/service/Android.bp b/nearby/service/Android.bp index 46309026b6..17b80b0d84 100644 --- a/nearby/service/Android.bp +++ b/nearby/service/Android.bp @@ -30,7 +30,7 @@ java_library { srcs: [":nearby-service-srcs"], defaults: [ - "framework-system-server-module-defaults" + "framework-system-server-module-defaults", ], libs: [ "androidx.annotation_annotation", @@ -66,13 +66,16 @@ java_library { apex_available: [ "com.android.tethering", ], + lint: { + baseline_filename: "lint-baseline.xml", + }, } genrule { name: "statslog-nearby-java-gen", tools: ["stats-log-api-gen"], cmd: "$(location stats-log-api-gen) --java $(out) --module nearby " + - " --javaPackage com.android.server.nearby.proto --javaClass NearbyStatsLog" + - " --minApiLevel 33", + " --javaPackage com.android.server.nearby.proto --javaClass NearbyStatsLog" + + " --minApiLevel 33", out: ["com/android/server/nearby/proto/NearbyStatsLog.java"], } diff --git a/service-t/Android.bp b/service-t/Android.bp index bc49f0e749..de879f303e 100644 --- a/service-t/Android.bp +++ b/service-t/Android.bp @@ -31,6 +31,7 @@ filegroup { ], visibility: ["//visibility:private"], } + // The above filegroup can be used to specify different sources depending // on the branch, while minimizing merge conflicts in the rest of the // build rules. @@ -78,6 +79,9 @@ java_library { "//packages/modules/Connectivity/tests:__subpackages__", "//packages/modules/IPsec/tests/iketests", ], + lint: { + baseline_filename: "lint-baseline.xml", + }, } // Test building mDNS as a standalone, so that it can be imported into other repositories as-is. @@ -94,11 +98,12 @@ java_library { min_sdk_version: "21", lint: { error_checks: ["NewApi"], + baseline_filename: "lint-baseline.xml", }, srcs: [ "src/com/android/server/connectivity/mdns/**/*.java", ":framework-connectivity-t-mdns-standalone-build-sources", - ":service-mdns-droidstubs" + ":service-mdns-droidstubs", ], exclude_srcs: [ "src/com/android/server/connectivity/mdns/internal/SocketNetlinkMonitor.java", @@ -127,7 +132,7 @@ droidstubs { srcs: ["src/com/android/server/connectivity/mdns/SocketNetLinkMonitorFactory.java"], libs: [ "net-utils-device-common-mdns-standalone-build-test", - "service-connectivity-tiramisu-pre-jarjar" + "service-connectivity-tiramisu-pre-jarjar", ], visibility: [ "//visibility:private", diff --git a/service/Android.bp b/service/Android.bp index e2dab9e15b..7c5da0ddaa 100644 --- a/service/Android.bp +++ b/service/Android.bp @@ -70,6 +70,9 @@ java_library { apex_available: [ "com.android.tethering", ], + lint: { + baseline_filename: "lint-baseline.xml", + }, } // The library name match the service-connectivity jarjar rules that put the JNI utils in the @@ -200,7 +203,10 @@ java_library { apex_available: [ "com.android.tethering", ], - lint: { strict_updatability_linting: true }, + lint: { + strict_updatability_linting: true, + baseline_filename: "lint-baseline.xml", + }, visibility: [ "//packages/modules/Connectivity/service-t", "//packages/modules/Connectivity/tests:__subpackages__", @@ -225,6 +231,7 @@ java_library { ], lint: { strict_updatability_linting: true, + baseline_filename: "lint-baseline.xml", }, } @@ -283,12 +290,18 @@ java_defaults { java_library { name: "service-connectivity-for-tests", defaults: ["service-connectivity-defaults"], + lint: { + baseline_filename: "lint-baseline.xml", + }, } java_library { name: "service-connectivity", defaults: ["service-connectivity-defaults"], installable: true, + lint: { + baseline_filename: "lint-baseline.xml", + }, } java_library_static { @@ -303,6 +316,9 @@ java_library_static { ], static_libs: ["ConnectivityServiceprotos"], apex_available: ["com.android.tethering"], + lint: { + baseline_filename: "lint-baseline.xml", + }, } genrule {