• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    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",
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// Make Robolectric_all available as a target jar, but treated as an aar
184java_host_for_device {
185    name: "Robolectric_all-target_upstream",
186    libs: ["Robolectric_all_upstream"],
187    visibility: [
188        ":__subpackages__",
189        //java references
190        "//frameworks/opt/net/wifi/libs/WifiTrackerLib/tests:__pkg__",
191        "//prebuilts/sdk/current/androidx:__pkg__",
192        "//prebuilts/sdk/current/androidx/m2repository/androidx/car/app/app-testing/1.4.0-alpha01:__pkg__",
193        "//prebuilts/sdk/current/aaos-libs:__pkg__",
194        "//packages/apps/TV/tests/common:__pkg__",
195        "//external/android_onboarding:__subpackages__",
196        //robolectric tests
197        "//platform_testing/libraries/runner:__pkg__",
198        "//platform_testing/libraries/screenshot/material_components:__pkg__",
199        "//vendor:__subpackages__",
200        "//platform_testing/robolab/roboStandaloneProj/tests:__pkg__",
201        "//external/mobile-data-download/javatests:__pkg__",
202        "//frameworks/base/services/robotests:__pkg__",
203        "//frameworks/base/services/robotests/backup:__pkg__",
204        "//frameworks/base/packages/CredentialManager:__subpackages__",
205        "//frameworks/base/packages/SettingsLib:__subpackages__",
206        "//frameworks/base/packages/SystemUI:__pkg__",
207        "//frameworks/libs/systemui:__subpackages__",
208        "//packages/apps/Launcher3/tests:__pkg__",
209        "//frameworks/base/tests/InputScreenshotTest:__subpackages__",
210        "//frameworks/opt/car/setupwizard/library/main/tests/robotests:__pkg__",
211        "//frameworks/opt/localepicker/tests:__pkg__",
212        "//frameworks/opt/wear/signaldetector/robotests:__pkg__",
213        "//frameworks/opt/wear/robotests:__pkg__",
214        "//packages/modules/Bluetooth/service:__pkg__",
215        "//packages/modules/Connectivity/nearby/tests/multidevices/clients/test_support/snippet_helper/tests:__pkg__",
216        "//packages/modules/Connectivity/nearby/tests/robotests:__pkg__",
217        "//packages/modules/DeviceLock/DeviceLockController/tests/robolectric:__pkg__",
218        "//packages/modules/DeviceLock/tests/unittests:__pkg__",
219        "//packages/services/Car/tests/CarLibTests:__pkg__",
220        "//packages/services/Mms/tests/robotests:__pkg__",
221        "//packages/apps/QuickAccessWallet/tests/robolectric:__pkg__",
222        "//packages/apps/ManagedProvisioning/tests/robotests:__pkg__",
223        "//packages/apps/Car/libs/car-media-common/tests/robotests",
224        "//packages/apps/Car/libs/car-ui-lib",
225        "//packages/apps/Car/Notification/tests/robotests:__pkg__",
226        "//packages/apps/Car/Launcher/libs/appgrid/lib/robotests:__pkg__",
227        "//packages/apps/Car/Cluster/DirectRenderingCluster/tests/robotests:__pkg__",
228        "//packages/apps/Car/Settings/tests/robotests:__pkg__",
229        "//packages/apps/EmergencyInfo/tests/robolectric:__pkg__",
230        "//packages/apps/StorageManager/robotests:__pkg__",
231        "//packages/apps/Settings/tests/robotests:__pkg__",
232        "//packages/apps/ThemePicker/tests/robotests:__pkg__",
233        "//packages/apps/WallpaperPicker2/tests/robotests:__pkg__",
234        "//packages/apps/WallpaperPicker2/tests/robotests/common:__pkg__",
235        "//packages/apps/TvSettings/Settings/tests/robotests:__pkg__",
236        "//packages/apps/KeyChain/robotests:__pkg__",
237        "//packages/apps/CertInstaller/robotests:__pkg__",
238        "//packages/providers/MediaProvider:__subpackages__",
239        "//packages/apps/TV:__subpackages__",
240        "//frameworks/base/libs/WindowManager/Shell:__subpackages__",
241        //tm-dev additions
242        "//frameworks/base/packages/BackupEncryption/test/robolectric-integration:__pkg__",
243        "//frameworks/base/packages/BackupEncryption/test/robolectric:__pkg__",
244        "//packages/apps/Settings/tests/screenshot:__pkg__",
245    ],
246}
247
248// Make dependencies available as host jars
249java_device_for_host {
250    name: "robolectric-host-androidx-test-core_upstream",
251    libs: ["androidx.test.core"],
252}
253
254java_device_for_host {
255    name: "robolectric-host-androidx-test-ext-junit_upstream",
256    libs: ["androidx.test.ext.junit"],
257}
258
259java_device_for_host {
260    name: "robolectric-host-androidx-test-monitor_upstream",
261    libs: ["androidx.test.monitor"],
262}
263
264java_device_for_host {
265    name: "robolectric-host-androidx-test-ext-truth_upstream",
266    libs: ["androidx.test.ext.truth"],
267}
268
269java_device_for_host {
270    name: "robolectric-host-androidx-test-runner_upstream",
271    libs: ["androidx.test.runner"],
272}
273
274java_device_for_host {
275    name: "robolectric-host-androidx_upstream",
276    libs: ["androidx.fragment_fragment"],
277}
278
279java_device_for_host {
280    name: "robolectric-host-androidx_test_espresso",
281    libs: ["androidx.test.espresso.idling-resource"],
282}
283
284java_device_for_host {
285    name: "robolectric-host-android-support-multidex_upstream",
286    libs: [
287        "android-support-multidex",
288        "com.android.support.multidex_1.0.3",
289    ],
290}
291
292java_device_for_host {
293    name: "robolectric-host-org_apache_http_legacy_upstream",
294    libs: ["org.apache.http.legacy.stubs"],
295}
296