blob: 250a13b33d33094ceb1d4d4e4aede10a1cf1d749 [file] [log] [blame]
Rex Hoffman8f70b392022-11-13 19:32:19 +00001// 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: [":__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
34license {
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
47java_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
53robolectric_build_props {
54 name: "robolectric_build_props_upstream",
55}
56
57java_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
70java_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
92java_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
122java_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
132java_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 Peric38c9182022-12-20 14:05:47 -0500148 "Robolectric_nativeruntime_upstream",
Rex Hoffman8f70b392022-11-13 19:32:19 +0000149 "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
170java_host_for_device {
171 name: "Robolectric_all-target_upstream",
172 libs: ["Robolectric_all_upstream"],
Rex Hoffman078e8842022-12-20 21:06:29 +0000173 visibility: ["//visibility:public"],
Rex Hoffman8f70b392022-11-13 19:32:19 +0000174}
175
176// Make dependencies available as host jars
177java_device_for_host {
178 name: "robolectric-host-androidx-test-core_upstream",
179 libs: ["androidx.test.core"],
180}
181
182java_device_for_host {
183 name: "robolectric-host-androidx-test-ext-junit_upstream",
184 libs: ["androidx.test.ext.junit"],
185}
186
187java_device_for_host {
188 name: "robolectric-host-androidx-test-monitor_upstream",
189 libs: ["androidx.test.monitor"],
190}
191
192java_device_for_host {
193 name: "robolectric-host-androidx-test-runner_upstream",
194 libs: ["androidx.test.runner"],
195}
196
197java_device_for_host {
198 name: "robolectric-host-androidx_upstream",
199 libs: ["androidx.fragment_fragment"],
200}
201
202java_device_for_host {
203 name: "robolectric-host-androidx_test_espresso",
204 libs: ["androidx.test.espresso.idling-resource"],
205}
206
207//java_device_for_host {
208// name: "robolectric-host-android-support-v4_upstream",
209// libs: ["android-support-v4"],
210//}
211
212java_device_for_host {
213 name: "robolectric-host-android-support-multidex_upstream",
214 libs: [
215 "android-support-multidex",
216 "com.android.support.multidex_1.0.3",
217 ],
218}
219
220java_device_for_host {
221 name: "robolectric-host-org_apache_http_legacy_upstream",
222 libs: ["org.apache.http.legacy.stubs"],
223}