| // Copyright (C) 2019 The Android Open Source Project |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| package { |
| default_visibility: [ |
| "//external/robolectric:__subpackages__", |
| "//test/robolectric-extensions:__subpackages__", |
| "//frameworks/base/packages/SettingsLib:__subpackages__", |
| "//packages/apps/Settings/tests/robotests:__subpackages__", |
| ], |
| default_applicable_licenses: ["external_robolectric_license"], |
| } |
| |
| // Added automatically by a large-scale-change that took the approach of |
| // 'apply every license found to every target'. While this makes sure we respect |
| // every license restriction, it may not be entirely correct. |
| // |
| // e.g. GPL in an MIT project might only apply to the contrib/ directory. |
| // |
| // Please consider splitting the single license below into multiple licenses, |
| // taking care not to lose any license_kind information, and overriding the |
| // default license using the 'licenses: [...]' property on targets as needed. |
| // |
| // For unused files, consider creating a 'fileGroup' with "//visibility:private" |
| // to attach the license to, and including a comment whether the files may be |
| // used in the current project. |
| // See: http://go/android-license-faq |
| license { |
| name: "external_robolectric_license", |
| visibility: [ |
| ":__subpackages__", |
| "//test/robolectric-extensions:__subpackages__", |
| ], |
| license_kinds: [ |
| "SPDX-license-identifier-Apache-2.0", |
| "SPDX-license-identifier-MIT", |
| ], |
| license_text: [ |
| "LICENSE", |
| ], |
| } |
| |
| // Empty library. Should be removed |
| java_library { |
| name: "robolectric_android-all-stub", |
| visibility: ["//visibility:public"], |
| } |
| |
| // build.prop file created by module type defined in soong/robolectric.go |
| robolectric_build_props { |
| name: "robolectric_build_props", |
| } |
| |
| java_genrule { |
| name: "robolectric_props_jar", |
| host_supported: true, |
| tools: ["soong_zip"], |
| srcs: [":robolectric_build_props"], |
| out: ["robolectric_props.jar"], |
| cmd: "cp $(location :robolectric_build_props) . && $(location soong_zip) " + |
| "-o $(location robolectric_props.jar) " + |
| "-f ./build.prop ", |
| } |
| |
| java_genrule { |
| name: "robolectric_framework_res", |
| host_supported: true, |
| tools: ["zip2zip"], |
| device_common_srcs: [":framework-res"], |
| out: ["robolectric_framework_res.jar"], |
| cmd: "$(location zip2zip) " + |
| "-i $(location :framework-res) " + |
| "-o $(location robolectric_framework_res.jar) " + |
| "-x classes.dex " + |
| "-x META-INF/**/* " + |
| "-0 resources.arsc", |
| } |
| |
| java_device_for_host { |
| name: "robolectric_android-all-device-deps", |
| libs: [ |
| "conscrypt-for-host", |
| "core-icu4j-for-host", |
| "core-libart-for-host", |
| "ext", |
| "framework-all", |
| "icu4j-icudata-jarjar", |
| "icu4j-icutzdata-jarjar", |
| "ims-common", |
| "libphonenumber-platform", |
| "okhttp-for-host", |
| "services", |
| "services.accessibility", |
| "telephony-common", |
| "android.car", |
| "android.car.builtin.impl", |
| ], |
| } |
| |
| java_library { |
| name: "robolectric-host-android_all", |
| host_supported: true, |
| device_supported: false, |
| static_libs: [ |
| "robolectric_android-all-device-deps", |
| "robolectric_tzdata", |
| "robolectric_framework_res", |
| "robolectric_props_jar", |
| ], |
| // WARNING: DO NOT ADD NEW DEPENDENCIES ON THIS MODULE OR ITS DIST JAR |
| // This dist jar is an internal implementation detail. For external Gradle builds (outside |
| // the platform), consumers should access robolectric via the maven repository. For |
| // platform robolectric usage (in Soong), consumers should use the |
| // android_robolectric_test module type. |
| dist: { |
| targets: [ |
| // Add android-all-robolectric.jar to private_api_stubs dist target for easier |
| // packaging by scripts. This jar is useful for running robolectric tests on |
| // platform app Gradle builds that compile against hidden platform APIs. |
| "private_api_stubs", |
| "sdk", |
| "win_sdk", |
| ], |
| dest: "android-all-robolectric.jar", |
| }, |
| visibility: [ |
| ":__subpackages__", |
| "//prebuilts/misc/common/robolectric", |
| "//test/robolectric-extensions:__subpackages__", |
| "//frameworks/base/packages/SettingsLib:__subpackages__", |
| ], |
| } |
| |
| java_library_host { |
| name: "Robolectric_all", |
| |
| static_libs: [ |
| "Robolectric-aosp-plugins", |
| "Robolectric_shadows_httpclient", |
| "Robolectric_shadows_framework", |
| "Robolectric_shadows_multidex", |
| "Robolectric_shadows_versioning", |
| "Robolectric_robolectric", |
| "Robolectric_annotations", |
| "Robolectric_resources", |
| "Robolectric_shadowapi", |
| "Robolectric_sandbox", |
| "Robolectric_junit", |
| "Robolectric_utils", |
| "Robolectric_utils_reflector", |
| "Robolectric_nativeruntime", |
| "TestParameterInjector", |
| "asm-9.6", |
| "junit", |
| "asm-tree-9.6", |
| "guava", |
| "asm-commons-9.6", |
| "bouncycastle-unbundled", |
| "conscrypt-unbundled", |
| "robolectric-sqlite4java-0.282", |
| "hamcrest", |
| "hamcrest-library", |
| "robolectric-host-androidx-test-runner", |
| "robolectric-host-org_apache_http_legacy", //TODO: remove |
| ], |
| |
| java_resource_dirs: [ |
| "shadows/framework/src/main/resources", |
| "src/main/resources", |
| ], |
| } |
| |
| java_host_for_device { |
| name: "ClearcutJunitListenerAar", |
| libs: ["ClearcutJunitListener"], |
| } |
| |
| // Make Robolectric_all available as a target jar, but treated as an aar |
| // When used for strict mode test visibility does not need to be added, |
| // as it's added with visibility rules hidden, and only available at runtime, |
| // not compile time when used via strict mode. |
| // |
| // Visibility rule additions have two use case, being added to an |
| // android_robolectric_test as either a compile time dependency for "strict_mode: false" |
| // robolectric tests, or a dependency of a library. |
| java_host_for_device { |
| name: "Robolectric_all-target", |
| libs: ["Robolectric_all"], |
| visibility: [ |
| ":__subpackages__", |
| "//vendor:__subpackages__", |
| "//cts/tests/location:__pkg__", |
| "//external/android_onboarding/java/com/android/onboarding/contracts/testing:__pkg__", |
| "//external/android_onboarding/java/com/android/onboarding/testing:__pkg__", |
| "//external/mobile-data-download/javatests:__pkg__", |
| "//frameworks/base/packages/CredentialManager/wear/robotests:__pkg__", |
| "//frameworks/base/packages/SettingsLib/DataStore/tests:__pkg__", |
| "//frameworks/base/packages/SettingsLib/Ipc:__pkg__", |
| "//frameworks/base/packages/SettingsLib/Spa/screenshot/robotests:__pkg__", |
| "//frameworks/base/packages/SettingsLib/SpaPrivileged/tests/robotests:__pkg__", |
| "//frameworks/base/packages/SettingsLib/tests/robotests:__pkg__", |
| "//frameworks/base/packages/SettingsLib/tests/robotests/fragment:__pkg__", |
| "//frameworks/base/packages/SystemUI:__pkg__", |
| "//frameworks/base/services/robotests:__pkg__", |
| "//frameworks/base/services/robotests/backup:__pkg__", |
| "//frameworks/base/tests/InputScreenshotTest/robotests:__pkg__", |
| "//frameworks/libs/systemui/animationlib:__pkg__", |
| "//frameworks/libs/systemui/tracinglib/robolectric:__pkg__", |
| "//frameworks/opt/car/setupwizard/library/main/tests/robotests:__pkg__", |
| "//frameworks/opt/localepicker/tests:__pkg__", |
| "//frameworks/opt/net/wifi/libs/WifiTrackerLib/tests:__pkg__", |
| "//frameworks/opt/net/wifi/libs/WifiTrackerLib/tests:__pkg__", |
| "//frameworks/opt/wear/robotests:__pkg__", |
| "//frameworks/opt/wear/signaldetector/robotests:__pkg__", |
| "//packages/apps/Car/Cluster/DirectRenderingCluster/tests/robotests:__pkg__", |
| "//packages/apps/Car/Launcher/libs/appgrid/lib/robotests:__pkg__", |
| "//packages/apps/Car/Notification/tests/robotests:__pkg__", |
| "//packages/apps/Car/Settings/tests/deviceless:__pkg__", |
| "//packages/apps/Car/Settings/tests/multivalent:__pkg__", |
| "//packages/apps/Car/Settings/tests/robotests:__pkg__", |
| "//packages/apps/Car/SystemUI:__pkg__", |
| "//packages/apps/CertInstaller/robotests:__pkg__", |
| "//packages/apps/EmergencyInfo/tests/robolectric:__pkg__", |
| "//packages/apps/KeyChain/robotests:__pkg__", |
| "//packages/apps/Launcher3/tests:__pkg__", |
| "//packages/apps/QuickAccessWallet/tests/robolectric:__pkg__", |
| "//packages/apps/Settings/tests/robotests:__pkg__", |
| "//packages/apps/StorageManager/robotests:__pkg__", |
| "//packages/apps/ThemePicker/tests/robotests:__pkg__", |
| "//packages/apps/TV/common/tests/robotests:__pkg__", |
| "//packages/apps/TvSettings/Settings/tests/robotests:__pkg__", |
| "//packages/apps/TV/tests/common:__pkg__", |
| "//packages/apps/WallpaperPicker2/tests/robotests:__pkg__", |
| "//packages/apps/WallpaperPicker2/tests/robotests/common:__pkg__", |
| "//packages/modules/Bluetooth/service:__pkg__", |
| "//packages/modules/DeviceLock/DeviceLockController/tests/robolectric:__pkg__", |
| "//packages/modules/DeviceLock/tests/unittests:__pkg__", |
| "//packages/services/Car/tests/CarLibTests:__pkg__", |
| "//packages/services/Mms/tests/robotests:__pkg__", |
| "//platform_testing/libraries/runner:__pkg__", |
| "//platform_testing/robolab/roboStandaloneProj/tests:__pkg__", |
| "//prebuilts/sdk/current/aaos-libs:__pkg__", |
| ], |
| } |
| |
| // Make dependencies available as host jars |
| java_device_for_host { |
| name: "robolectric-host-androidx-test-core", |
| libs: ["androidx.test.core"], |
| } |
| |
| java_device_for_host { |
| name: "robolectric-host-androidx-test-ext-junit", |
| libs: ["androidx.test.ext.junit"], |
| } |
| |
| java_device_for_host { |
| name: "robolectric-host-androidx-test-monitor", |
| libs: ["androidx.test.monitor"], |
| } |
| |
| java_device_for_host { |
| name: "robolectric-host-androidx-test-ext-truth", |
| libs: ["androidx.test.ext.truth"], |
| } |
| |
| java_device_for_host { |
| name: "robolectric-host-androidx-test-runner", |
| libs: ["androidx.test.runner"], |
| } |
| |
| java_device_for_host { |
| name: "robolectric-host-androidx", |
| libs: ["androidx.fragment_fragment"], |
| } |
| |
| java_device_for_host { |
| name: "robolectric-host-androidx_test_espresso", |
| libs: ["androidx.test.espresso.idling-resource"], |
| } |
| |
| java_device_for_host { |
| name: "robolectric-host-android-support-multidex", |
| libs: [ |
| "android-support-multidex", |
| "com.android.support.multidex_1.0.3", |
| ], |
| } |
| |
| java_device_for_host { |
| name: "robolectric-host-org_apache_http_legacy", |
| libs: ["org.apache.http.legacy.stubs"], |
| } |