aboutsummaryrefslogtreecommitdiff
path: root/Android.bp
blob: 4e5cb23b252506f079dbf790f43a3cb33f731f26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
// 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",
    ],
}

// build.prop file created by module type defined in soong/robolectric.go
robolectric_build_props {
    name: "robolectric_build_props",
    visibility: [
        ":__subpackages__",
        "//external/robolectric-shadows:__subpackages__",
    ],
}

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"],
    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",
    ],
}

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__",
        "//external/robolectric-shadows:__subpackages__",
        "//prebuilts/misc/common/robolectric",
        "//test/robolectric-extensions:__subpackages__",
        "//frameworks/base/packages/SettingsLib:__subpackages__",
    ],
}

java_library_host {
    name: "Robolectric_all_upstream",

    static_libs: [
        "Robolectric-aosp-plugins",
        "Robolectric_shadows_httpclient_upstream",
        "Robolectric_shadows_framework_upstream",
        "Robolectric_shadows_multidex_upstream",
        "Robolectric_shadows_versioning_upstream",
        "Robolectric_robolectric_upstream",
        "Robolectric_annotations_upstream",
        "Robolectric_resources_upstream",
        "Robolectric_shadowapi_upstream",
        "Robolectric_sandbox_upstream",
        "Robolectric_junit_upstream",
        "Robolectric_utils_upstream",
        "Robolectric_utils_reflector_upstream",
        "Robolectric_nativeruntime_upstream",
        "asm-9.2",
        "junit",
        "asm-tree-9.2",
        "guava",
        "asm-commons-9.2",
        "bouncycastle-unbundled",
        "conscrypt-unbundled",
        "robolectric-sqlite4java-0.282",
        "hamcrest",
        "hamcrest-library",
        "robolectric-host-androidx-test-runner_upstream",
        "robolectric-host-org_apache_http_legacy_upstream", //TODO: remove
    ],

    java_resource_dirs: [
        "shadows/framework/src/main/resources",
        "src/main/resources",
    ],
}

// Make Robolectric_all available as a target jar, but treated as an aar
java_host_for_device {
    name: "Robolectric_all-target_upstream",
    libs: ["Robolectric_all_upstream"],
    visibility: [
      ":__subpackages__",
      //java references
      "//frameworks/opt/net/wifi/libs/WifiTrackerLib/tests:__pkg__",
      "//prebuilts/sdk/current/androidx:__pkg__",
      "//prebuilts/sdk/current/androidx/m2repository/androidx/car/app/app-testing/1.4.0-alpha01:__pkg__",
      "//prebuilts/sdk/current/aaos-libs:__pkg__",
      "//packages/apps/TV/tests/common:__pkg__",
      "//external/android_onboarding/src/com/android/onboarding/contracts/testing:__pkg__",
      "//external/android_onboarding/src/com/android/onboarding/testing:__pkg__",
      "//external/android_onboarding/src/com/android/onboarding/nodes/testing:__pkg__",
      //robolectric tests
      "//platform_testing/libraries/runner:__pkg__",
      "//platform_testing/libraries/screenshot/material_components:__pkg__",
      "//vendor:__subpackages__",
      "//platform_testing/robolab/roboStandaloneProj/tests:__pkg__",
      "//external/mobile-data-download/javatests:__pkg__",
      "//frameworks/base/services/robotests:__pkg__",
      "//frameworks/base/services/robotests/backup:__pkg__",
      "//frameworks/base/packages/CredentialManager:__subpackages__",
      "//frameworks/base/packages/SettingsLib:__subpackages__",
      "//frameworks/base/packages/SystemUI:__pkg__",
      "//frameworks/libs/systemui/animationlib:__pkg__",
      "//frameworks/libs/systemui/tracinglib:__pkg__",
      "//frameworks/base/tests/InputScreenshotTest:__subpackages__",
      "//frameworks/opt/car/setupwizard/library/main/tests/robotests:__pkg__",
      "//frameworks/opt/localepicker/tests:__pkg__",
      "//frameworks/opt/wear/signaldetector/robotests:__pkg__",
      "//frameworks/opt/wear/robotests:__pkg__",
      "//packages/modules/Bluetooth/service:__pkg__",
      "//packages/modules/Connectivity/nearby/tests/multidevices/clients/test_support/snippet_helper/tests:__pkg__",
      "//packages/modules/Connectivity/nearby/tests/robotests:__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__",
      "//packages/apps/QuickAccessWallet/tests/robolectric:__pkg__",
      "//packages/apps/ManagedProvisioning/tests/robotests:__pkg__",
      "//packages/apps/Car/libs/car-media-common/tests/robotests",
      "//packages/apps/Car/libs/car-ui-lib",
      "//packages/apps/Car/Notification/tests/robotests:__pkg__",
      "//packages/apps/Car/Launcher/libs/appgrid/lib/robotests:__pkg__",
      "//packages/apps/Car/Cluster/DirectRenderingCluster/tests/robotests:__pkg__",
      "//packages/apps/Car/Settings/tests/robotests:__pkg__",
      "//packages/apps/EmergencyInfo/tests/robolectric:__pkg__",
      "//packages/apps/StorageManager/robotests:__pkg__",
      "//packages/apps/Settings/tests/robotests:__pkg__",
      "//packages/apps/ThemePicker/tests/robotests:__pkg__",
      "//packages/apps/WallpaperPicker2/tests/robotests:__pkg__",
      "//packages/apps/TvSettings/Settings/tests/robotests:__pkg__",
      "//packages/apps/KeyChain/robotests:__pkg__",
      "//packages/apps/CertInstaller/robotests:__pkg__",
      "//packages/providers/MediaProvider:__subpackages__",
      "//packages/apps/TV:__subpackages__",
      "//frameworks/base/libs/WindowManager/Shell:__subpackages__",
      //tm-dev additions
      "//frameworks/base/packages/BackupEncryption/test/robolectric-integration:__pkg__",
      "//frameworks/base/packages/BackupEncryption/test/robolectric:__pkg__",
      "//packages/apps/Settings/tests/screenshot:__pkg__",
    ],
}

// Make dependencies available as host jars
java_device_for_host {
    name: "robolectric-host-androidx-test-core_upstream",
    libs: ["androidx.test.core"],
}

java_device_for_host {
    name: "robolectric-host-androidx-test-ext-junit_upstream",
    libs: ["androidx.test.ext.junit"],
}

java_device_for_host {
    name: "robolectric-host-androidx-test-monitor_upstream",
    libs: ["androidx.test.monitor"],
}

java_device_for_host {
    name: "robolectric-host-androidx-test-ext-truth_upstream",
    libs: ["androidx.test.ext.truth"],
}

java_device_for_host {
    name: "robolectric-host-androidx-test-runner_upstream",
    libs: ["androidx.test.runner"],
}

java_device_for_host {
    name: "robolectric-host-androidx_upstream",
    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_upstream",
    libs: [
        "android-support-multidex",
        "com.android.support.multidex_1.0.3",
    ],
}

java_device_for_host {
    name: "robolectric-host-org_apache_http_legacy_upstream",
    libs: ["org.apache.http.legacy.stubs"],
}