aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-05-09 01:16:23 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-05-09 01:16:23 +0000
commit8f18dba376b18957652abe3d8f1359bd7a402be6 (patch)
tree28e46b650f9ba36cfee8e93e362023505f43358b
parent3e13fa903c92f0a090861091b5ad7c7a9eaf682c (diff)
parent5e0b24a0eab14ea6d4628cd641153ea0e34b17ef (diff)
downloadmodules-utils-sdk-release.tar.gz
Snap for 11819063 from 5e0b24a0eab14ea6d4628cd641153ea0e34b17ef to sdk-releasesdk-release
Change-Id: I7fc968d55853d1d3119478d2af8c7fc2a1afda8e
-rw-r--r--java/com/android/modules/utils/testing/Android.bp60
1 files changed, 48 insertions, 12 deletions
diff --git a/java/com/android/modules/utils/testing/Android.bp b/java/com/android/modules/utils/testing/Android.bp
index 4b285f1..f866d8d 100644
--- a/java/com/android/modules/utils/testing/Android.bp
+++ b/java/com/android/modules/utils/testing/Android.bp
@@ -28,45 +28,81 @@ java_library {
visibility: ["//visibility:public"],
}
-// TODO(b/281577492): split in 2 (one for just ExtendedMockito stuff)
+// Utility for mocking DeviceConfig and other device state.
+//
// NOTE: clients should depend on modules-utils-testable-device-config-defaults
// instead of using this library directly (so it sets the proper JNI dependencies)
java_library {
name: "modules-utils-testable-device-config",
srcs: [
+ "TestableDeviceConfig.java",
+ ],
+ static_libs: [
+ "modules-utils-build",
+ "modules-utils-extended-mockito-rule",
+ ],
+ libs: [
+ "framework-configinfrastructure",
+ ],
+ visibility: ["//visibility:public"],
+}
+
+// Utility for mocking DeviceConfig and other device state.
+//
+// NOTE: if you're only using ExtendedMockitoRule (without TestableDevicConfig), you should use
+// modules-utils-extended-mockito-rule-defaults instead
+//
+// In order to use these utils successfully, both Java code and native libraries will be required.
+// If your code is in a library, you will have to depend on these defaults both in the library as
+// well as in the android_test that it gets linked into.
+// You will also need to specify android:debuggable="true" in the test's manifest.
+java_defaults {
+ name: "modules-utils-testable-device-config-defaults",
+ static_libs: ["modules-utils-testable-device-config"],
+ defaults: ["modules-utils-extended-mockito-rule-defaults"],
+ defaults_visibility: ["//visibility:public"],
+}
+
+// Utility for using ExtendedMockitoRule.
+//
+// NOTE: most clients should depend on modules-utils-extended-mockito-rule-defaults
+// instead of using this library directly (so it sets the proper JNI dependencies)
+java_library {
+ name: "modules-utils-extended-mockito-rule",
+ srcs: [
"AbstractExtendedMockitoRule.java",
"StaticMockFixture.java",
"ExtendedMockitoRule.java",
- "TestableDeviceConfig.java",
],
static_libs: [
- "androidx.test.rules",
+ "junit",
"mockito-target-extended-minus-junit4",
- "modules-utils-build",
- "modules-utils-preconditions",
],
libs: [
- "framework-configinfrastructure",
- "framework-annotations-lib",
+ "framework-annotations-lib", // @VisibleForTesting
],
sdk_version: "module_current",
min_sdk_version: "29",
+ // compile_multilib: "both",
+ // TODO(b/338434399): figure out why adding compile_multib causes a failure:
+ // In file included from build/make/core/soong_java_prebuilt.mk:38:
+ // build/make/core/base_rules.mk:300: error: frameworks/libs/modules-utils/java/com/android/modules/utils/testing:
+ // MODULE.TARGET.JAVA_LIBRARIES.modules-utils-extended-mockito-rule already defined by frameworks/libs/modules-utils/java/com/android/modules/utils/testing.
visibility: ["//visibility:public"],
lint: {
baseline_filename: "lint-baseline.xml",
},
}
-// TODO(b/281577492): split in 2 (one for just ExtendedMockito stuff)
-// Utility for mocking DeviceConfig and other device state.
+// Utility for using ExtendedMockitoRule.
+//
// In order to use these utils successfully, both Java code and native libraries will be required.
// If your code is in a library, you will have to depend on these defaults both in the library as
// well as in the android_test that it gets linked into.
// You will also need to specify android:debuggable="true" in the test's manifest.
java_defaults {
- name: "modules-utils-testable-device-config-defaults",
- static_libs: ["modules-utils-testable-device-config"],
- compile_multilib: "both",
+ name: "modules-utils-extended-mockito-rule-defaults",
+ static_libs: ["modules-utils-extended-mockito-rule"],
jni_libs: [
"libdexmakerjvmtiagent",
"libstaticjvmtiagent",