1// 2// Copyright (C) 2021 The Android Open Source Project 3// 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15 16package { 17 default_applicable_licenses: ["Android-Apache-2.0"], 18} 19 20java_library { 21 name: "modules-utils-native-coverage-listener", 22 srcs: ["NativeCoverageHackInstrumentationListener.java"], 23 static_libs: [ 24 "androidx.test.rules", 25 ], 26 sdk_version: "test_current", 27 min_sdk_version: "29", 28 visibility: ["//visibility:public"], 29} 30 31// Utility for mocking DeviceConfig and other device state. 32// 33// NOTE: clients should depend on modules-utils-testable-device-config-defaults 34// instead of using this library directly (so it sets the proper JNI dependencies) 35java_library { 36 name: "modules-utils-testable-device-config", 37 srcs: [ 38 "TestableDeviceConfig.java", 39 ], 40 static_libs: [ 41 "modules-utils-build", 42 "modules-utils-extended-mockito-rule", 43 ], 44 libs: [ 45 "framework-configinfrastructure", 46 ], 47 visibility: ["//visibility:public"], 48} 49 50// Utility for mocking DeviceConfig and other device state. 51// 52// NOTE: if you're only using ExtendedMockitoRule (without TestableDevicConfig), you should use 53// modules-utils-extended-mockito-rule-defaults instead 54// 55// In order to use these utils successfully, both Java code and native libraries will be required. 56// If your code is in a library, you will have to depend on these defaults both in the library as 57// well as in the android_test that it gets linked into. 58// You will also need to specify android:debuggable="true" in the test's manifest. 59java_defaults { 60 name: "modules-utils-testable-device-config-defaults", 61 static_libs: ["modules-utils-testable-device-config"], 62 compile_multilib: "both", 63 defaults: ["modules-utils-extended-mockito-rule-defaults"], 64 defaults_visibility: ["//visibility:public"], 65} 66 67// Utility for using ExtendedMockitoRule. 68// 69// NOTE: most clients should depend on modules-utils-extended-mockito-rule-defaults 70// instead of using this library directly (so it sets the proper JNI dependencies) 71java_library { 72 name: "modules-utils-extended-mockito-rule", 73 srcs: [ 74 "AbstractExtendedMockitoRule.java", 75 "StaticMockFixture.java", 76 "ExtendedMockitoRule.java", 77 ], 78 static_libs: [ 79 "junit", 80 "mockito-target-extended-minus-junit4", 81 ], 82 libs: [ 83 "framework-annotations-lib", // @VisibleForTesting 84 ], 85 sdk_version: "module_current", 86 min_sdk_version: "29", 87 visibility: ["//visibility:public"], 88 lint: { 89 baseline_filename: "lint-baseline.xml", 90 }, 91} 92 93// Utility for using ExtendedMockitoRule. 94// 95// In order to use these utils successfully, both Java code and native libraries will be required. 96// If your code is in a library, you will have to depend on these defaults both in the library as 97// well as in the android_test that it gets linked into. 98// You will also need to specify android:debuggable="true" in the test's manifest. 99java_defaults { 100 name: "modules-utils-extended-mockito-rule-defaults", 101 static_libs: ["modules-utils-extended-mockito-rule"], 102 compile_multilib: "both", 103 jni_libs: [ 104 "libdexmakerjvmtiagent", 105 "libstaticjvmtiagent", 106 ], 107 defaults_visibility: ["//visibility:public"], 108} 109