From 8401b6a9f09257b7fd9cc800115dd6d9807ae5e0 Mon Sep 17 00:00:00 2001 From: Jihoon Kang Date: Fri, 30 Aug 2024 00:29:58 +0000 Subject: [PATCH] Make java_sdk_library dependencies explicit modules should specify the submodule of java_sdk_library that the module actually depends on Test: CI Bug: 358613520 Change-Id: I0367068c901df98483f6cf95160d3e7801881b0a --- Tethering/Android.bp | 13 ++++++------- Tethering/common/TetheringLib/Android.bp | 1 + Tethering/tests/integration/Android.bp | 6 +++--- Tethering/tests/mts/Android.bp | 2 +- Tethering/tests/unit/Android.bp | 6 +++--- framework-t/Android.bp | 8 ++++---- framework/Android.bp | 2 ++ nearby/framework/Android.bp | 2 +- nearby/service/Android.bp | 6 +++--- nearby/tests/cts/fastpair/Android.bp | 4 ++-- nearby/tests/unit/Android.bp | 6 +++--- networksecurity/service/Android.bp | 2 +- networksecurity/tests/unit/Android.bp | 6 +++--- remoteauth/framework/Android.bp | 2 +- remoteauth/service/Android.bp | 8 ++++---- remoteauth/tests/unit/Android.bp | 6 +++--- service-t/Android.bp | 4 ++-- service/Android.bp | 16 ++++++++-------- staticlibs/Android.bp | 15 ++++++++------- staticlibs/client-libs/tests/unit/Android.bp | 4 ++-- staticlibs/tests/unit/Android.bp | 4 ++-- tests/cts/hostside/app/Android.bp | 4 ++-- tests/cts/net/Android.bp | 2 +- tests/cts/net/api23Test/Android.bp | 2 +- tests/cts/tethering/Android.bp | 2 +- tests/integration/Android.bp | 2 +- tests/unit/Android.bp | 6 +++--- thread/demoapp/Android.bp | 2 +- thread/service/Android.bp | 2 +- thread/tests/cts/Android.bp | 4 ++-- thread/tests/integration/Android.bp | 6 +++--- thread/tests/unit/Android.bp | 6 +++--- 32 files changed, 82 insertions(+), 79 deletions(-) diff --git a/Tethering/Android.bp b/Tethering/Android.bp index d04660de01..d55fef6a73 100644 --- a/Tethering/Android.bp +++ b/Tethering/Android.bp @@ -32,16 +32,19 @@ java_defaults { java_defaults { name: "TetheringExternalLibs", + defaults: [ + "TetheringApiLevel", + ], // Libraries not including Tethering's own framework-tethering (different flavors of that one // are needed depending on the build rule) libs: [ "connectivity-internal-api-util", - "framework-configinfrastructure", + "framework-configinfrastructure.stubs.module_lib", "framework-connectivity.stubs.module_lib", "framework-connectivity-t.stubs.module_lib", "framework-statsd.stubs.module_lib", - "framework-wifi", - "framework-bluetooth", + "framework-wifi.stubs.module_lib", + "framework-bluetooth.stubs.module_lib", "unsupportedappusage", ], defaults_visibility: ["//visibility:private"], @@ -89,7 +92,6 @@ android_library { defaults: [ "ConnectivityNextEnableDefaults", "TetheringAndroidLibraryDefaults", - "TetheringApiLevel", "TetheringReleaseTargetSdk", ], static_libs: [ @@ -105,7 +107,6 @@ android_library { name: "TetheringApiStableLib", defaults: [ "TetheringAndroidLibraryDefaults", - "TetheringApiLevel", "TetheringReleaseTargetSdk", ], static_libs: [ @@ -194,7 +195,6 @@ android_app { name: "Tethering", defaults: [ "TetheringAppDefaults", - "TetheringApiLevel", ], static_libs: ["TetheringApiStableLib"], certificate: "networkstack", @@ -208,7 +208,6 @@ android_app { name: "TetheringNext", defaults: [ "TetheringAppDefaults", - "TetheringApiLevel", "ConnectivityNextEnableDefaults", ], static_libs: ["TetheringApiCurrentLib"], diff --git a/Tethering/common/TetheringLib/Android.bp b/Tethering/common/TetheringLib/Android.bp index 6e00756656..3ae26ccc49 100644 --- a/Tethering/common/TetheringLib/Android.bp +++ b/Tethering/common/TetheringLib/Android.bp @@ -29,6 +29,7 @@ java_sdk_library { "//packages/modules/Connectivity/framework-t", "//packages/modules/Connectivity/service", "//packages/modules/Connectivity/service-t", + "//packages/modules/Connectivity/staticlibs", // Using for test only "//cts/tests/netlegacy22.api", diff --git a/Tethering/tests/integration/Android.bp b/Tethering/tests/integration/Android.bp index 337d408930..221154638b 100644 --- a/Tethering/tests/integration/Android.bp +++ b/Tethering/tests/integration/Android.bp @@ -38,9 +38,9 @@ java_defaults { "connectivity-net-module-utils-bpf", ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs", + "android.test.base.stubs", + "android.test.mock.stubs", ], } diff --git a/Tethering/tests/mts/Android.bp b/Tethering/tests/mts/Android.bp index c4d5636f0f..1f1929c7a0 100644 --- a/Tethering/tests/mts/Android.bp +++ b/Tethering/tests/mts/Android.bp @@ -26,7 +26,7 @@ android_test { target_sdk_version: "33", libs: [ - "android.test.base", + "android.test.base.stubs", ], srcs: [ diff --git a/Tethering/tests/unit/Android.bp b/Tethering/tests/unit/Android.bp index 24407ca57c..d0d23ac28b 100644 --- a/Tethering/tests/unit/Android.bp +++ b/Tethering/tests/unit/Android.bp @@ -62,9 +62,9 @@ java_defaults { // remove framework-minus-apex, ext, and framework-res sdk_version: "core_platform", libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs", + "android.test.base.stubs", + "android.test.mock.stubs", "ext", "framework-minus-apex", "framework-res", diff --git a/framework-t/Android.bp b/framework-t/Android.bp index a05a529d68..7551b92816 100644 --- a/framework-t/Android.bp +++ b/framework-t/Android.bp @@ -68,8 +68,8 @@ java_defaults { impl_only_libs: [ // The build system will use framework-bluetooth module_current stubs, because // of sdk_version: "module_current" above. - "framework-bluetooth", - "framework-wifi", + "framework-bluetooth.stubs.module_lib", + "framework-wifi.stubs.module_lib", // Compile against the entire implementation of framework-connectivity, // including hidden methods. This is safe because if framework-connectivity-t is // on the bootclasspath (i.e., T), then framework-connectivity is also on the @@ -103,8 +103,8 @@ java_library { name: "framework-connectivity-t-pre-jarjar", defaults: ["framework-connectivity-t-defaults"], libs: [ - "framework-bluetooth", - "framework-wifi", + "framework-bluetooth.stubs.module_lib", + "framework-wifi.stubs.module_lib", "framework-connectivity-pre-jarjar", "framework-location.stubs.module_lib", ], diff --git a/framework/Android.bp b/framework/Android.bp index 4c4f7920e5..b30979a918 100644 --- a/framework/Android.bp +++ b/framework/Android.bp @@ -178,8 +178,10 @@ java_sdk_library { // In preparation for future move "//packages/modules/Connectivity/apex", "//packages/modules/Connectivity/framework-t", + "//packages/modules/Connectivity/remoteauth/service", "//packages/modules/Connectivity/service", "//packages/modules/Connectivity/service-t", + "//packages/modules/Connectivity/staticlibs", "//frameworks/base", // Tests using hidden APIs diff --git a/nearby/framework/Android.bp b/nearby/framework/Android.bp index f84ddcf87d..6bfa54df6c 100644 --- a/nearby/framework/Android.bp +++ b/nearby/framework/Android.bp @@ -49,7 +49,7 @@ java_library { libs: [ "androidx.annotation_annotation", "framework-annotations-lib", - "framework-bluetooth", + "framework-bluetooth.stubs.module_lib", "framework-location.stubs.module_lib", ], static_libs: [ diff --git a/nearby/service/Android.bp b/nearby/service/Android.bp index 749113d933..c9c7b44444 100644 --- a/nearby/service/Android.bp +++ b/nearby/service/Android.bp @@ -35,11 +35,11 @@ java_library { ], libs: [ "androidx.annotation_annotation", - "framework-bluetooth", + "framework-bluetooth.stubs.module_lib", "error_prone_annotations", - "framework-configinfrastructure", + "framework-configinfrastructure.stubs.module_lib", "framework-connectivity-t.impl", - "framework-statsd", + "framework-statsd.stubs.module_lib", ], static_libs: [ "androidx.core_core", diff --git a/nearby/tests/cts/fastpair/Android.bp b/nearby/tests/cts/fastpair/Android.bp index 800930342c..9d42dd11b2 100644 --- a/nearby/tests/cts/fastpair/Android.bp +++ b/nearby/tests/cts/fastpair/Android.bp @@ -30,9 +30,9 @@ android_test { "truth", ], libs: [ - "android.test.base", + "android.test.base.stubs.system", "framework-bluetooth.stubs.module_lib", - "framework-configinfrastructure", + "framework-configinfrastructure.stubs.module_lib", "framework-connectivity-t.impl", "framework-location.stubs.module_lib", ], diff --git a/nearby/tests/unit/Android.bp b/nearby/tests/unit/Android.bp index 295056832c..4d2d1d5eb2 100644 --- a/nearby/tests/unit/Android.bp +++ b/nearby/tests/unit/Android.bp @@ -27,9 +27,9 @@ android_test { srcs: ["src/**/*.java"], libs: [ - "android.test.base", - "android.test.mock", - "android.test.runner", + "android.test.base.stubs.test", + "android.test.mock.stubs.test", + "android.test.runner.stubs.test", ], compile_multilib: "both", diff --git a/networksecurity/service/Android.bp b/networksecurity/service/Android.bp index e33abd5185..52667ae59f 100644 --- a/networksecurity/service/Android.bp +++ b/networksecurity/service/Android.bp @@ -27,7 +27,7 @@ java_library { ], libs: [ - "framework-configinfrastructure", + "framework-configinfrastructure.stubs.module_lib", "framework-connectivity-pre-jarjar", "service-connectivity-pre-jarjar", ], diff --git a/networksecurity/tests/unit/Android.bp b/networksecurity/tests/unit/Android.bp index 639f64457b..11263cf104 100644 --- a/networksecurity/tests/unit/Android.bp +++ b/networksecurity/tests/unit/Android.bp @@ -27,9 +27,9 @@ android_test { srcs: ["src/**/*.java"], libs: [ - "android.test.base", - "android.test.mock", - "android.test.runner", + "android.test.base.stubs.test", + "android.test.mock.stubs.test", + "android.test.runner.stubs.test", ], static_libs: [ "androidx.test.ext.junit", diff --git a/remoteauth/framework/Android.bp b/remoteauth/framework/Android.bp index 2f1737f346..33de13933b 100644 --- a/remoteauth/framework/Android.bp +++ b/remoteauth/framework/Android.bp @@ -47,7 +47,7 @@ java_library { libs: [ "androidx.annotation_annotation", "framework-annotations-lib", - "framework-bluetooth", + "framework-bluetooth.stubs.module_lib", ], static_libs: [ "modules-utils-preconditions", diff --git a/remoteauth/service/Android.bp b/remoteauth/service/Android.bp index 32ae54f5b6..52f301a39a 100644 --- a/remoteauth/service/Android.bp +++ b/remoteauth/service/Android.bp @@ -33,13 +33,13 @@ java_library { ], libs: [ "androidx.annotation_annotation", - "framework-bluetooth", - "framework-connectivity", + "framework-bluetooth.stubs.module_lib", + "framework-connectivity.impl", "error_prone_annotations", - "framework-configinfrastructure", + "framework-configinfrastructure.stubs.module_lib", "framework-connectivity-pre-jarjar", "framework-connectivity-t-pre-jarjar", - "framework-statsd", + "framework-statsd.stubs.module_lib", ], static_libs: [ "modules-utils-build", diff --git a/remoteauth/tests/unit/Android.bp b/remoteauth/tests/unit/Android.bp index 47b9e31c89..f784b8edda 100644 --- a/remoteauth/tests/unit/Android.bp +++ b/remoteauth/tests/unit/Android.bp @@ -30,9 +30,9 @@ android_test { srcs: [], libs: [ - "android.test.base", - "android.test.mock", - "android.test.runner", + "android.test.base.stubs.test", + "android.test.mock.stubs.test", + "android.test.runner.stubs.test", "framework-annotations-lib", ], compile_multilib: "both", diff --git a/service-t/Android.bp b/service-t/Android.bp index 32dbcaafd2..787e94e2a6 100644 --- a/service-t/Android.bp +++ b/service-t/Android.bp @@ -51,12 +51,12 @@ java_library { ], libs: [ "framework-annotations-lib", - "framework-configinfrastructure", + "framework-configinfrastructure.stubs.module_lib", "framework-connectivity-pre-jarjar", "framework-connectivity-t-pre-jarjar", // TODO: use framework-tethering-pre-jarjar when it is separated from framework-tethering "framework-tethering.impl", - "framework-wifi", + "framework-wifi.stubs.module_lib", "service-connectivity-pre-jarjar", "service-nearby-pre-jarjar", "service-networksecurity-pre-jarjar", diff --git a/service/Android.bp b/service/Android.bp index c68f0b8de7..94061a46e1 100644 --- a/service/Android.bp +++ b/service/Android.bp @@ -161,7 +161,7 @@ java_library { ], libs: [ "framework-annotations-lib", - "framework-configinfrastructure", + "framework-configinfrastructure.stubs.module_lib", "framework-connectivity-pre-jarjar", // The framework-connectivity-t library is only available on T+ platforms // so any calls to it must be protected with a check to ensure that it is @@ -175,12 +175,12 @@ java_library { // TODO: figure out why just using "framework-tethering" uses the stubs, even though both // service-connectivity and framework-tethering are in the same APEX. "framework-tethering.impl", - "framework-wifi", + "framework-wifi.stubs.module_lib", "unsupportedappusage", "ServiceConnectivityResources", - "framework-statsd", - "framework-permission", - "framework-permission-s", + "framework-statsd.stubs.module_lib", + "framework-permission.stubs.module_lib", + "framework-permission-s.stubs.module_lib", ], static_libs: [ // Do not add libs here if they are already included @@ -264,10 +264,10 @@ java_defaults { "framework-connectivity.impl", "framework-connectivity-t.impl", "framework-tethering.impl", - "framework-wifi", + "framework-wifi.stubs.module_lib", "libprotobuf-java-nano", - "framework-permission", - "framework-permission-s", + "framework-permission.stubs.module_lib", + "framework-permission-s.stubs.module_lib", ], jarjar_rules: ":connectivity-jarjar-rules", apex_available: [ diff --git a/staticlibs/Android.bp b/staticlibs/Android.bp index f47a23a211..85258f8ff1 100644 --- a/staticlibs/Android.bp +++ b/staticlibs/Android.bp @@ -70,7 +70,7 @@ java_library { libs: [ "androidx.annotation_annotation", "framework-annotations-lib", - "framework-configinfrastructure", + "framework-configinfrastructure.stubs.module_lib", "framework-connectivity.stubs.module_lib", ], lint: { @@ -264,7 +264,7 @@ java_library { ], libs: [ "framework-annotations-lib", - "framework-connectivity", + "framework-connectivity.stubs.module_lib", ], static_libs: [ "net-utils-device-common", @@ -342,7 +342,7 @@ java_library { min_sdk_version: "30", libs: [ "framework-annotations-lib", - "framework-connectivity", + "framework-connectivity.stubs.module_lib", "modules-utils-build_system", ], // TODO: remove "apex_available:platform". @@ -468,7 +468,7 @@ java_library { libs: [ "androidx.annotation_annotation", "framework-annotations-lib", - "framework-configinfrastructure", + "framework-configinfrastructure.stubs.module_lib", "framework-connectivity.stubs.module_lib", ], lint: { @@ -484,12 +484,11 @@ java_defaults { libs: [ "androidx.annotation_annotation", "framework-annotations-lib", - "framework-configinfrastructure", - "framework-connectivity", + "framework-configinfrastructure.stubs.module_lib", "framework-connectivity.stubs.module_lib", "framework-connectivity-t.stubs.module_lib", "framework-location.stubs.module_lib", - "framework-tethering", + "framework-tethering.stubs.module_lib", "unsupportedappusage", ], static_libs: [ @@ -522,6 +521,8 @@ java_library { ], libs: [ "net-utils-framework-connectivity", + "framework-connectivity.impl", + "framework-tethering.impl", ], defaults: ["net-utils-non-bootclasspath-defaults"], jarjar_rules: "jarjar-rules-shared.txt", diff --git a/staticlibs/client-libs/tests/unit/Android.bp b/staticlibs/client-libs/tests/unit/Android.bp index 7aafd69c58..79234f5a90 100644 --- a/staticlibs/client-libs/tests/unit/Android.bp +++ b/staticlibs/client-libs/tests/unit/Android.bp @@ -17,8 +17,8 @@ android_library { "netd-client", ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs.system", + "android.test.base.stubs.system", ], visibility: [ // Visible for Tethering and NetworkStack integration test and link NetdStaticLibTestsLib diff --git a/staticlibs/tests/unit/Android.bp b/staticlibs/tests/unit/Android.bp index 61f41f71bb..8c54e6a1de 100644 --- a/staticlibs/tests/unit/Android.bp +++ b/staticlibs/tests/unit/Android.bp @@ -30,8 +30,8 @@ android_library { "net-utils-service-connectivity", ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs", + "android.test.base.stubs", ], visibility: [ "//frameworks/base/packages/Tethering/tests/integration", diff --git a/tests/cts/hostside/app/Android.bp b/tests/cts/hostside/app/Android.bp index 40cabc4f75..2ca9adb753 100644 --- a/tests/cts/hostside/app/Android.bp +++ b/tests/cts/hostside/app/Android.bp @@ -33,8 +33,8 @@ java_defaults { "modules-utils-build", ], libs: [ - "android.test.runner", - "android.test.base", + "android.test.runner.stubs", + "android.test.base.stubs", ], srcs: [ "src/**/*.java", diff --git a/tests/cts/net/Android.bp b/tests/cts/net/Android.bp index 1cd8327133..a5ad7f2f1c 100644 --- a/tests/cts/net/Android.bp +++ b/tests/cts/net/Android.bp @@ -29,7 +29,7 @@ java_defaults { libs: [ "voip-common", - "android.test.base", + "android.test.base.stubs", ], jni_libs: [ diff --git a/tests/cts/net/api23Test/Android.bp b/tests/cts/net/api23Test/Android.bp index 587d5a5e2b..7d93c3ac7d 100644 --- a/tests/cts/net/api23Test/Android.bp +++ b/tests/cts/net/api23Test/Android.bp @@ -25,7 +25,7 @@ android_test { compile_multilib: "both", libs: [ - "android.test.base", + "android.test.base.stubs.test", ], srcs: [ diff --git a/tests/cts/tethering/Android.bp b/tests/cts/tethering/Android.bp index 10231736eb..116501862c 100644 --- a/tests/cts/tethering/Android.bp +++ b/tests/cts/tethering/Android.bp @@ -22,7 +22,7 @@ java_defaults { defaults: ["cts_defaults"], libs: [ - "android.test.base", + "android.test.base.stubs.system", ], srcs: [ diff --git a/tests/integration/Android.bp b/tests/integration/Android.bp index 349529ddb0..6c3b7a0710 100644 --- a/tests/integration/Android.bp +++ b/tests/integration/Android.bp @@ -33,7 +33,7 @@ android_test { "src/**/*.aidl", ], libs: [ - "android.test.mock", + "android.test.mock.stubs", "ServiceConnectivityResources", ], static_libs: [ diff --git a/tests/unit/Android.bp b/tests/unit/Android.bp index ef3ebb0381..00f9d05a28 100644 --- a/tests/unit/Android.bp +++ b/tests/unit/Android.bp @@ -104,9 +104,9 @@ java_defaults { ], libs: [ "android.net.ipsec.ike.stubs.module_lib", - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs", + "android.test.base.stubs", + "android.test.mock.stubs", "ServiceConnectivityResources", ], exclude_kotlinc_generated_files: false, diff --git a/thread/demoapp/Android.bp b/thread/demoapp/Android.bp index 117b4f9ac5..a786639472 100644 --- a/thread/demoapp/Android.bp +++ b/thread/demoapp/Android.bp @@ -32,7 +32,7 @@ android_app { "guava", ], libs: [ - "framework-connectivity-t", + "framework-connectivity-t.stubs.module_lib", ], required: [ "privapp-permissions-com.android.threadnetwork.demoapp", diff --git a/thread/service/Android.bp b/thread/service/Android.bp index a82a49945a..1f4e601ce6 100644 --- a/thread/service/Android.bp +++ b/thread/service/Android.bp @@ -37,7 +37,7 @@ java_library { "framework-connectivity-pre-jarjar", "framework-connectivity-t-pre-jarjar", "framework-location.stubs.module_lib", - "framework-wifi", + "framework-wifi.stubs.module_lib", "service-connectivity-pre-jarjar", "ServiceConnectivityResources", ], diff --git a/thread/tests/cts/Android.bp b/thread/tests/cts/Android.bp index 65727556a6..2630d21c94 100644 --- a/thread/tests/cts/Android.bp +++ b/thread/tests/cts/Android.bp @@ -49,8 +49,8 @@ android_test { "truth", ], libs: [ - "android.test.base", - "android.test.runner", + "android.test.base.stubs", + "android.test.runner.stubs", "framework-connectivity-module-api-stubs-including-flagged", ], // Test coverage system runs on different devices. Need to diff --git a/thread/tests/integration/Android.bp b/thread/tests/integration/Android.bp index 59e8e1901a..8f082a4383 100644 --- a/thread/tests/integration/Android.bp +++ b/thread/tests/integration/Android.bp @@ -37,9 +37,9 @@ java_defaults { "ot-daemon-aidl-java", ], libs: [ - "android.test.runner", - "android.test.base", - "android.test.mock", + "android.test.runner.stubs", + "android.test.base.stubs", + "android.test.mock.stubs", ], } diff --git a/thread/tests/unit/Android.bp b/thread/tests/unit/Android.bp index 9404d1b6ec..c6a24ea508 100644 --- a/thread/tests/unit/Android.bp +++ b/thread/tests/unit/Android.bp @@ -50,10 +50,10 @@ android_test { "service-thread-pre-jarjar", ], libs: [ - "android.test.base", - "android.test.runner", + "android.test.base.stubs.system", + "android.test.runner.stubs.system", "ServiceConnectivityResources", - "framework-wifi", + "framework-wifi.stubs.module_lib", ], jni_libs: [ "libservice-thread-jni",