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 15package { 16 default_visibility: [ 17 "//external/robolectric:__subpackages__", 18 "//test/robolectric-extensions:__subpackages__", 19 "//frameworks/base/packages/SettingsLib:__subpackages__", 20 "//packages/apps/Settings/tests/robotests:__subpackages__", 21 ], 22 default_applicable_licenses: ["external_robolectric_license"], 23} 24 25// Added automatically by a large-scale-change that took the approach of 26// 'apply every license found to every target'. While this makes sure we respect 27// every license restriction, it may not be entirely correct. 28// 29// e.g. GPL in an MIT project might only apply to the contrib/ directory. 30// 31// Please consider splitting the single license below into multiple licenses, 32// taking care not to lose any license_kind information, and overriding the 33// default license using the 'licenses: [...]' property on targets as needed. 34// 35// For unused files, consider creating a 'fileGroup' with "//visibility:private" 36// to attach the license to, and including a comment whether the files may be 37// used in the current project. 38// See: http://go/android-license-faq 39license { 40 name: "external_robolectric_license", 41 visibility: [ 42 ":__subpackages__", 43 "//test/robolectric-extensions:__subpackages__", 44 ], 45 license_kinds: [ 46 "SPDX-license-identifier-Apache-2.0", 47 "SPDX-license-identifier-MIT", 48 ], 49 license_text: [ 50 "LICENSE", 51 ], 52} 53 54// Empty library. Should be removed 55java_library { 56 name: "robolectric_android-all-stub_upstream", 57 visibility: ["//visibility:public"], 58} 59 60// build.prop file created by module type defined in soong/robolectric.go 61robolectric_build_props { 62 name: "robolectric_build_props", 63} 64 65java_genrule { 66 name: "robolectric_props_jar", 67 host_supported: true, 68 tools: ["soong_zip"], 69 srcs: [":robolectric_build_props"], 70 out: ["robolectric_props.jar"], 71 cmd: "cp $(location :robolectric_build_props) . && $(location soong_zip) " + 72 "-o $(location robolectric_props.jar) " + 73 "-f ./build.prop ", 74} 75 76java_genrule { 77 name: "robolectric_framework_res", 78 host_supported: true, 79 tools: ["zip2zip"], 80 device_common_srcs: [":framework-res"], 81 out: ["robolectric_framework_res.jar"], 82 cmd: "$(location zip2zip) " + 83 "-i $(location :framework-res) " + 84 "-o $(location robolectric_framework_res.jar) " + 85 "-x classes.dex " + 86 "-x META-INF/**/* " + 87 "-0 resources.arsc", 88} 89 90java_device_for_host { 91 name: "robolectric_android-all-device-deps", 92 libs: [ 93 "conscrypt-for-host", 94 "core-icu4j-for-host", 95 "core-libart-for-host", 96 "ext", 97 "framework-all", 98 "icu4j-icudata-jarjar", 99 "icu4j-icutzdata-jarjar", 100 "ims-common", 101 "libphonenumber-platform", 102 "okhttp-for-host", 103 "services", 104 "services.accessibility", 105 "telephony-common", 106 "android.car", 107 "android.car.builtin.impl", 108 ], 109} 110 111java_library { 112 name: "robolectric-host-android_all", 113 host_supported: true, 114 device_supported: false, 115 static_libs: [ 116 "robolectric_android-all-device-deps", 117 "robolectric_tzdata", 118 "robolectric_framework_res", 119 "robolectric_props_jar", 120 ], 121 // WARNING: DO NOT ADD NEW DEPENDENCIES ON THIS MODULE OR ITS DIST JAR 122 // This dist jar is an internal implementation detail. For external Gradle builds (outside 123 // the platform), consumers should access robolectric via the maven repository. For 124 // platform robolectric usage (in Soong), consumers should use the 125 // android_robolectric_test module type. 126 dist: { 127 targets: [ 128 // Add android-all-robolectric.jar to private_api_stubs dist target for easier 129 // packaging by scripts. This jar is useful for running robolectric tests on 130 // platform app Gradle builds that compile against hidden platform APIs. 131 "private_api_stubs", 132 "sdk", 133 "win_sdk", 134 ], 135 dest: "android-all-robolectric.jar", 136 }, 137 visibility: [ 138 ":__subpackages__", 139 "//prebuilts/misc/common/robolectric", 140 "//test/robolectric-extensions:__subpackages__", 141 "//frameworks/base/packages/SettingsLib:__subpackages__", 142 ], 143} 144 145java_library_host { 146 name: "Robolectric_all_upstream", 147 148 static_libs: [ 149 "Robolectric-aosp-plugins", 150 "Robolectric_shadows_httpclient_upstream", 151 "Robolectric_shadows_framework_upstream", 152 "Robolectric_shadows_multidex_upstream", 153 "Robolectric_shadows_versioning_upstream", 154 "Robolectric_robolectric_upstream", 155 "Robolectric_annotations_upstream", 156 "Robolectric_resources_upstream", 157 "Robolectric_shadowapi_upstream", 158 "Robolectric_sandbox_upstream", 159 "Robolectric_junit_upstream", 160 "Robolectric_utils_upstream", 161 "Robolectric_utils_reflector_upstream", 162 "Robolectric_nativeruntime_upstream", 163 "asm-9.6", 164 "junit", 165 "asm-tree-9.6", 166 "guava", 167 "asm-commons-9.6", 168 "bouncycastle-unbundled", 169 "conscrypt-unbundled", 170 "robolectric-sqlite4java-0.282", 171 "hamcrest", 172 "hamcrest-library", 173 "robolectric-host-androidx-test-runner_upstream", 174 "robolectric-host-org_apache_http_legacy_upstream", //TODO: remove 175 ], 176 177 java_resource_dirs: [ 178 "shadows/framework/src/main/resources", 179 "src/main/resources", 180 ], 181} 182 183// Using visibility as allow list for tests to bypass strict_mode 184java_library { 185 name: "robolectric_non_strict_mode_permission", 186 sdk_version: "current", 187 visibility: [ 188 ":__subpackages__", 189 "//vendor:__subpackages__", 190 "//platform_testing/robolab/roboStandaloneProj/tests:__pkg__", 191 "//packages/modules/DeviceLock/DeviceLockController/tests/robolectric:__pkg__", 192 "//packages/apps/StorageManager/robotests:__pkg__", 193 "//packages/apps/KeyChain/robotests:__pkg__", 194 "//packages/apps/CertInstaller/robotests:__pkg__", 195 "//packages/services/Mms/tests/robotests:__pkg__", 196 "//packages/apps/Car/Cluster/DirectRenderingCluster/tests/robotests:__pkg__", 197 "//packages/apps/QuickAccessWallet/tests/robolectric:__pkg__", 198 "//packages/services/Car/tests/CarLibTests:__pkg__", 199 "//frameworks/libs/systemui:__subpackages__", 200 "//packages/apps/WallpaperPicker2/tests/robotests:__pkg__", 201 "//frameworks/opt/wear/signaldetector/robotests:__pkg__", 202 "//packages/apps/EmergencyInfo/tests/robolectric:__pkg__", 203 "//packages/modules/Bluetooth/service:__pkg__", 204 "//frameworks/opt/wear/robotests:__pkg__", 205 "//packages/apps/ThemePicker/tests/robotests:__pkg__", 206 "//packages/modules/DeviceLock/tests/unittests:__pkg__", 207 "//external/mobile-data-download/javatests:__pkg__", 208 "//frameworks/opt/car/setupwizard/library/main/tests/robotests:__pkg__", 209 "//packages/apps/Car/Notification/tests/robotests:__pkg__", 210 "//packages/apps/TvSettings/Settings/tests/robotests:__pkg__", 211 "//packages/apps/Car/Settings/tests/deviceless:__subpackages__", 212 "//packages/apps/Car/Settings/tests/multivalent:__subpackages__", 213 "//packages/apps/Car/Settings/tests/robotests:__pkg__", 214 "//packages/apps/Car/SystemUI:__pkg__", 215 "//packages/apps/Settings/tests/robotests:__pkg__", 216 "//frameworks/base/packages/SystemUI:__pkg__", 217 "//frameworks/base/services/robotests:__pkg__", 218 "//frameworks/base/services/robotests/backup:__pkg__", 219 "//frameworks/base/packages/CredentialManager/wear/robotests", 220 "//frameworks/base/tests/InputScreenshotTest:__subpackages__", 221 "//frameworks/base/packages/SettingsLib:__subpackages__", 222 "//packages/apps/TV/common/tests/robotests:__pkg__", 223 "//packages/apps/Launcher3/tests:__pkg__", 224 "//packages/apps/Car/Launcher/libs/appgrid/lib/robotests:__pkg__", 225 "//cts/tests:__subpackages__", 226 ], 227} 228 229// Make Robolectric_all available as a target jar, but treated as an aar 230java_host_for_device { 231 name: "Robolectric_all-target_upstream", 232 libs: ["Robolectric_all_upstream"], 233 visibility: [ 234 ":__subpackages__", 235 //java references 236 "//frameworks/opt/net/wifi/libs/WifiTrackerLib/tests:__pkg__", 237 "//prebuilts/sdk/current/androidx:__pkg__", 238 "//prebuilts/sdk/current/androidx/m2repository/androidx/car/app/app-testing/1.4.0-alpha01:__pkg__", 239 "//prebuilts/sdk/current/aaos-libs:__pkg__", 240 "//packages/apps/TV/tests/common:__pkg__", 241 "//external/android_onboarding:__subpackages__", 242 //robolectric tests 243 "//platform_testing/libraries/runner:__pkg__", 244 "//platform_testing/libraries/screenshot/material_components:__pkg__", 245 "//vendor:__subpackages__", 246 "//platform_testing/robolab/roboStandaloneProj/tests:__pkg__", 247 "//external/mobile-data-download/javatests:__pkg__", 248 "//frameworks/base/services/robotests:__pkg__", 249 "//frameworks/base/services/robotests/backup:__pkg__", 250 "//frameworks/base/packages/CredentialManager:__subpackages__", 251 "//frameworks/base/packages/SettingsLib:__subpackages__", 252 "//frameworks/base/packages/SystemUI:__pkg__", 253 "//frameworks/libs/systemui:__subpackages__", 254 "//packages/apps/Launcher3/tests:__pkg__", 255 "//frameworks/base/tests/InputScreenshotTest:__subpackages__", 256 "//frameworks/opt/car/setupwizard/library/main/tests/robotests:__pkg__", 257 "//frameworks/opt/localepicker/tests:__pkg__", 258 "//frameworks/opt/wear/signaldetector/robotests:__pkg__", 259 "//frameworks/opt/wear/robotests:__pkg__", 260 "//packages/modules/Bluetooth/service:__pkg__", 261 "//packages/modules/Connectivity/nearby/tests/multidevices/clients/test_support/snippet_helper/tests:__pkg__", 262 "//packages/modules/Connectivity/nearby/tests/robotests:__pkg__", 263 "//packages/modules/DeviceLock/DeviceLockController/tests/robolectric:__pkg__", 264 "//packages/modules/DeviceLock/tests/unittests:__pkg__", 265 "//packages/services/Car/tests/CarLibTests:__pkg__", 266 "//packages/services/Mms/tests/robotests:__pkg__", 267 "//packages/apps/QuickAccessWallet/tests/robolectric:__pkg__", 268 "//packages/apps/ManagedProvisioning/tests/robotests:__pkg__", 269 "//packages/apps/Car/libs/car-media-common/tests/robotests", 270 "//packages/apps/Car/libs/car-ui-lib", 271 "//packages/apps/Car/Notification/tests/robotests:__pkg__", 272 "//packages/apps/Car/Launcher/libs/appgrid/lib/robotests:__pkg__", 273 "//packages/apps/Car/Cluster/DirectRenderingCluster/tests/robotests:__pkg__", 274 "//packages/apps/Car/Settings/tests/deviceless:__subpackages__", 275 "//packages/apps/Car/Settings/tests/multivalent:__subpackages__", 276 "//packages/apps/Car/Settings/tests/robotests:__pkg__", 277 "//packages/apps/Car/SystemUI:__pkg__", 278 "//packages/apps/EmergencyInfo/tests/robolectric:__pkg__", 279 "//packages/apps/StorageManager/robotests:__pkg__", 280 "//packages/apps/Settings/tests/robotests:__pkg__", 281 "//packages/apps/ThemePicker/tests/robotests:__pkg__", 282 "//packages/apps/WallpaperPicker2/tests/robotests:__pkg__", 283 "//packages/apps/WallpaperPicker2/tests/robotests/common:__pkg__", 284 "//packages/apps/TvSettings/Settings/tests/robotests:__pkg__", 285 "//packages/apps/KeyChain/robotests:__pkg__", 286 "//packages/apps/CertInstaller/robotests:__pkg__", 287 "//packages/providers/MediaProvider:__subpackages__", 288 "//packages/apps/TV:__subpackages__", 289 "//frameworks/base/libs/WindowManager/Shell:__subpackages__", 290 //tm-dev additions 291 "//frameworks/base/packages/BackupEncryption/test/robolectric-integration:__pkg__", 292 "//frameworks/base/packages/BackupEncryption/test/robolectric:__pkg__", 293 "//packages/apps/Settings/tests/screenshot:__pkg__", 294 "//cts/tests:__subpackages__", 295 ], 296} 297 298// Make dependencies available as host jars 299java_device_for_host { 300 name: "robolectric-host-androidx-test-core_upstream", 301 libs: ["androidx.test.core"], 302} 303 304java_device_for_host { 305 name: "robolectric-host-androidx-test-ext-junit_upstream", 306 libs: ["androidx.test.ext.junit"], 307} 308 309java_device_for_host { 310 name: "robolectric-host-androidx-test-monitor_upstream", 311 libs: ["androidx.test.monitor"], 312} 313 314java_device_for_host { 315 name: "robolectric-host-androidx-test-ext-truth_upstream", 316 libs: ["androidx.test.ext.truth"], 317} 318 319java_device_for_host { 320 name: "robolectric-host-androidx-test-runner_upstream", 321 libs: ["androidx.test.runner"], 322} 323 324java_device_for_host { 325 name: "robolectric-host-androidx_upstream", 326 libs: ["androidx.fragment_fragment"], 327} 328 329java_device_for_host { 330 name: "robolectric-host-androidx_test_espresso", 331 libs: ["androidx.test.espresso.idling-resource"], 332} 333 334java_device_for_host { 335 name: "robolectric-host-android-support-multidex_upstream", 336 libs: [ 337 "android-support-multidex", 338 "com.android.support.multidex_1.0.3", 339 ], 340} 341 342java_device_for_host { 343 name: "robolectric-host-org_apache_http_legacy_upstream", 344 libs: ["org.apache.http.legacy.stubs"], 345} 346