Rex Hoffman | 8f70b39 | 2022-11-13 19:32:19 +0000 | [diff] [blame] | 1 | // Copyright (C) 2019 The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package { |
| 16 | default_visibility: [":__subpackages__"], |
| 17 | default_applicable_licenses: ["external_robolectric_license"], |
| 18 | } |
| 19 | |
| 20 | // Added automatically by a large-scale-change that took the approach of |
| 21 | // 'apply every license found to every target'. While this makes sure we respect |
| 22 | // every license restriction, it may not be entirely correct. |
| 23 | // |
| 24 | // e.g. GPL in an MIT project might only apply to the contrib/ directory. |
| 25 | // |
| 26 | // Please consider splitting the single license below into multiple licenses, |
| 27 | // taking care not to lose any license_kind information, and overriding the |
| 28 | // default license using the 'licenses: [...]' property on targets as needed. |
| 29 | // |
| 30 | // For unused files, consider creating a 'fileGroup' with "//visibility:private" |
| 31 | // to attach the license to, and including a comment whether the files may be |
| 32 | // used in the current project. |
| 33 | // See: http://go/android-license-faq |
| 34 | license { |
| 35 | name: "external_robolectric_license", |
| 36 | visibility: [":__subpackages__"], |
| 37 | license_kinds: [ |
| 38 | "SPDX-license-identifier-Apache-2.0", |
| 39 | "SPDX-license-identifier-MIT", |
| 40 | ], |
| 41 | license_text: [ |
| 42 | "LICENSE", |
| 43 | ], |
| 44 | } |
| 45 | |
| 46 | // Empty library. Should be removed |
| 47 | java_library { |
| 48 | name: "robolectric_android-all-stub_upstream", |
| 49 | visibility: ["//visibility:public"], |
| 50 | } |
| 51 | |
| 52 | // build.prop file created by module type defined in soong/robolectric.go |
| 53 | robolectric_build_props { |
| 54 | name: "robolectric_build_props_upstream", |
| 55 | } |
| 56 | |
| 57 | java_genrule_host { |
| 58 | name: "robolectric_framework_res_upstream", |
| 59 | tools: ["zip2zip"], |
| 60 | srcs: [":framework-res"], |
| 61 | out: ["robolectric_framework_res_upstream.jar"], |
| 62 | cmd: "$(location zip2zip) " + |
| 63 | "-i $(location :framework-res) " + |
| 64 | "-o $(location robolectric_framework_res_upstream.jar) " + |
| 65 | "-x classes.dex " + |
| 66 | "-x META-INF/**/* " + |
| 67 | "-0 resources.arsc", |
| 68 | } |
| 69 | |
| 70 | java_device_for_host { |
| 71 | name: "robolectric_android-all-device-deps_upstream", |
| 72 | libs: [ |
| 73 | "conscrypt-for-host", |
| 74 | "core-icu4j-for-host", |
| 75 | "core-libart-for-host", |
| 76 | "ext", |
| 77 | "framework-all", |
| 78 | "icu4j-icudata-jarjar", |
| 79 | "icu4j-icutzdata-jarjar", |
| 80 | "ims-common", |
| 81 | "libphonenumber-platform", |
| 82 | "okhttp-for-host", |
| 83 | "services", |
| 84 | "services.accessibility", |
| 85 | "telephony-common", |
| 86 | "android.car", |
| 87 | "androidx.test.monitor", |
| 88 | "androidx.test.ext.truth", // -nodep? |
| 89 | ], |
| 90 | } |
| 91 | |
| 92 | java_library_host { |
| 93 | name: "robolectric-host-android_all_upstream", |
| 94 | static_libs: [ |
| 95 | "robolectric_android-all-device-deps_upstream", |
| 96 | "robolectric_tzdata", |
| 97 | "robolectric_framework_res_upstream", |
| 98 | ], |
| 99 | dist: { |
| 100 | targets: [ |
| 101 | "sdk", |
| 102 | "win_sdk", |
| 103 | ], |
| 104 | dest: "android-all-robolectric_upstream.jar", |
| 105 | }, |
| 106 | |
| 107 | java_resources: [ |
| 108 | // Copy the build.prop |
| 109 | ":robolectric_build_props_upstream", |
| 110 | ], |
| 111 | visibility: [ |
| 112 | ":__subpackages__", |
| 113 | "//prebuilts/misc/common/robolectric", |
| 114 | ], |
| 115 | } |
| 116 | |
| 117 | //############################################# |
| 118 | // Assemble Robolectric_all |
| 119 | //############################################# |
| 120 | |
| 121 | // This is a hack and should be removed with proper resource merging a la maven-shaded-plugin |
| 122 | java_genrule_host { |
| 123 | name: "robolectric_meta_service_file", |
| 124 | out: ["robolectric_meta_service_file.jar"], |
| 125 | tools: ["soong_zip"], |
| 126 | cmd: "mkdir -p $(genDir)/META-INF/services/ && " + |
| 127 | "echo -e 'org.robolectric.Shadows\norg.robolectric.shadows.httpclient.Shadows\norg.robolectric.shadows.multidex.Shadows' > " + |
| 128 | "$(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider &&" + |
| 129 | "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)/META-INF/services/", |
| 130 | } |
| 131 | |
| 132 | java_library_host { |
| 133 | name: "Robolectric_all_upstream", |
| 134 | |
| 135 | static_libs: [ |
| 136 | "robolectric_meta_service_file", |
| 137 | "Robolectric_shadows_httpclient_upstream", |
| 138 | "Robolectric_shadows_framework_upstream", |
| 139 | "Robolectric_shadows_multidex_upstream", |
| 140 | "Robolectric_robolectric_upstream", |
| 141 | "Robolectric_annotations_upstream", |
| 142 | "Robolectric_resources_upstream", |
| 143 | "Robolectric_shadowapi_upstream", |
| 144 | "Robolectric_sandbox_upstream", |
| 145 | "Robolectric_junit_upstream", |
| 146 | "Robolectric_utils_upstream", |
| 147 | "Robolectric_utils_reflector_upstream", |
Ram Peri | c38c918 | 2022-12-20 14:05:47 -0500 | [diff] [blame] | 148 | "Robolectric_nativeruntime_upstream", |
Rex Hoffman | 8f70b39 | 2022-11-13 19:32:19 +0000 | [diff] [blame] | 149 | "asm-9.2", |
| 150 | "junit", |
| 151 | "asm-tree-9.2", |
| 152 | "guava", |
| 153 | "asm-commons-9.2", |
| 154 | "bouncycastle-unbundled", |
| 155 | "conscrypt-unbundled", |
| 156 | "robolectric-sqlite4java-0.282", |
| 157 | "hamcrest", |
| 158 | "hamcrest-library", |
| 159 | "robolectric-host-androidx-test-runner_upstream", |
| 160 | "robolectric-host-org_apache_http_legacy_upstream", //TODO: remove |
| 161 | ], |
| 162 | |
| 163 | java_resource_dirs: [ |
| 164 | "shadows/framework/src/main/resources", |
| 165 | "src/main/resources", |
| 166 | ], |
| 167 | } |
| 168 | |
| 169 | // Make Robolectric_all available as a target jar, but treated as an aar |
| 170 | java_host_for_device { |
| 171 | name: "Robolectric_all-target_upstream", |
| 172 | libs: ["Robolectric_all_upstream"], |
Rex Hoffman | e6752e6 | 2023-02-23 22:37:44 +0000 | [diff] [blame] | 173 | visibility: [ |
| 174 | ":__subpackages__", |
| 175 | //java references |
| 176 | "//frameworks/opt/net/wifi/libs/WifiTrackerLib/tests:__pkg__", |
| 177 | "//prebuilts/sdk/current/androidx:__pkg__", |
| 178 | "//prebuilts/sdk/current/aaos-libs:__pkg__", |
| 179 | "//packages/apps/TV/tests/common:__pkg__", |
| 180 | //robolectric tests |
| 181 | "//vendor:__subpackages__", |
| 182 | "//platform_testing/robolab/roboStandaloneProj/tests:__pkg__", |
| 183 | "//external/mobile-data-download/javatests:__pkg__", |
| 184 | "//frameworks/base/services/robotests:__pkg__", |
| 185 | "//frameworks/base/services/robotests/backup:__pkg__", |
| 186 | "//frameworks/base/packages/SettingsLib/tests/robotests:__pkg__", |
| 187 | "//frameworks/base/packages/SystemUI:__pkg__", |
| 188 | "//frameworks/opt/car/setupwizard/library/main/tests/robotests:__pkg__", |
| 189 | "//frameworks/opt/localepicker/tests:__pkg__", |
| 190 | "//frameworks/opt/wear/signaldetector/robotests:__pkg__", |
| 191 | "//frameworks/opt/wear/robotests:__pkg__", |
| 192 | "//packages/modules/Connectivity/nearby/tests/multidevices/clients/test_support/snippet_helper/tests:__pkg__", |
| 193 | "//packages/modules/Connectivity/nearby/tests/robotests:__pkg__", |
| 194 | "//packages/modules/DeviceLock/DeviceLockController/tests/robolectric:__pkg__", |
| 195 | "//packages/services/Car/tests/CarLibTests:__pkg__", |
| 196 | "//packages/services/Mms/tests/robotests:__pkg__", |
| 197 | "//packages/apps/QuickAccessWallet/tests/robolectric:__pkg__", |
| 198 | "//packages/apps/ManagedProvisioning/tests/robotests:__pkg__", |
Rex Hoffman | 8378718 | 2023-02-27 20:33:41 +0000 | [diff] [blame] | 199 | "//packages/apps/Car/libs/car-media-common/tests/robotests", |
| 200 | "//packages/apps/Car/libs/car-ui-lib", |
Rex Hoffman | e6752e6 | 2023-02-23 22:37:44 +0000 | [diff] [blame] | 201 | "//packages/apps/Car/Notification/tests/robotests:__pkg__", |
| 202 | "//packages/apps/Car/Cluster/DirectRenderingCluster/tests/robotests:__pkg__", |
| 203 | "//packages/apps/Car/Settings/tests/robotests:__pkg__", |
| 204 | "//packages/apps/EmergencyInfo/tests/robolectric:__pkg__", |
| 205 | "//packages/apps/StorageManager/robotests:__pkg__", |
| 206 | "//packages/apps/Settings/tests/robotests:__pkg__", |
| 207 | "//packages/apps/ThemePicker/tests/robotests:__pkg__", |
| 208 | "//packages/apps/WallpaperPicker2/tests/robotests:__pkg__", |
| 209 | "//packages/apps/TvSettings/Settings/tests/robotests:__pkg__", |
| 210 | "//packages/apps/KeyChain/robotests:__pkg__", |
| 211 | "//packages/apps/CertInstaller/robotests:__pkg__", |
Rex Hoffman | 69fec4e | 2023-02-23 23:04:03 +0000 | [diff] [blame] | 212 | //tm-dev additions |
| 213 | "//frameworks/base/packages/BackupEncryption/test/robolectric-integration:__pkg__", |
| 214 | "//frameworks/base/packages/BackupEncryption/test/robolectric:__pkg__", |
Rex Hoffman | e6752e6 | 2023-02-23 22:37:44 +0000 | [diff] [blame] | 215 | ], |
Rex Hoffman | 8f70b39 | 2022-11-13 19:32:19 +0000 | [diff] [blame] | 216 | } |
| 217 | |
| 218 | // Make dependencies available as host jars |
| 219 | java_device_for_host { |
| 220 | name: "robolectric-host-androidx-test-core_upstream", |
| 221 | libs: ["androidx.test.core"], |
| 222 | } |
| 223 | |
| 224 | java_device_for_host { |
| 225 | name: "robolectric-host-androidx-test-ext-junit_upstream", |
| 226 | libs: ["androidx.test.ext.junit"], |
| 227 | } |
| 228 | |
| 229 | java_device_for_host { |
| 230 | name: "robolectric-host-androidx-test-monitor_upstream", |
| 231 | libs: ["androidx.test.monitor"], |
| 232 | } |
| 233 | |
| 234 | java_device_for_host { |
| 235 | name: "robolectric-host-androidx-test-runner_upstream", |
| 236 | libs: ["androidx.test.runner"], |
| 237 | } |
| 238 | |
| 239 | java_device_for_host { |
| 240 | name: "robolectric-host-androidx_upstream", |
| 241 | libs: ["androidx.fragment_fragment"], |
| 242 | } |
| 243 | |
| 244 | java_device_for_host { |
| 245 | name: "robolectric-host-androidx_test_espresso", |
| 246 | libs: ["androidx.test.espresso.idling-resource"], |
| 247 | } |
| 248 | |
| 249 | //java_device_for_host { |
| 250 | // name: "robolectric-host-android-support-v4_upstream", |
| 251 | // libs: ["android-support-v4"], |
| 252 | //} |
| 253 | |
| 254 | java_device_for_host { |
| 255 | name: "robolectric-host-android-support-multidex_upstream", |
| 256 | libs: [ |
| 257 | "android-support-multidex", |
| 258 | "com.android.support.multidex_1.0.3", |
| 259 | ], |
| 260 | } |
| 261 | |
| 262 | java_device_for_host { |
| 263 | name: "robolectric-host-org_apache_http_legacy_upstream", |
| 264 | libs: ["org.apache.http.legacy.stubs"], |
| 265 | } |