blob: 1bea434f5b49b0f5abc23962345ed1604662b8be [file] [log] [blame]
John Wu2abff412024-10-10 21:58:26 +00001// Copyright (C) 2024 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
15// This file hosts all the genrule and module definitions for all Android specific
16// code that needs further post-processing by hoststubgen to support Ravenwood.
17
18/////////////////////////
19// framework-minus-apex
20/////////////////////////
21
22// Process framework-minus-apex with hoststubgen for Ravenwood.
23// This step takes several tens of seconds, so we manually shard it to multiple modules.
24// All the copies have to be kept in sync.
25// TODO: Do the sharding better, either by making hostsubgen support sharding natively, or
26// making a better build rule.
27
28genrule_defaults {
29 name: "framework-minus-apex.ravenwood-base_defaults",
30 tools: ["hoststubgen"],
31 srcs: [
32 ":framework-minus-apex-for-host",
John Wu25110732024-10-10 22:40:49 +000033 ":ravenwood-common-policies",
John Wu2abff412024-10-10 21:58:26 +000034 ":ravenwood-framework-policies",
35 ":ravenwood-standard-options",
36 ":ravenwood-annotation-allowed-classes",
37 ],
38 out: [
39 "ravenwood.jar",
40 "hoststubgen_framework-minus-apex.log",
41 ],
42 visibility: ["//visibility:private"],
43}
44
45framework_minus_apex_cmd = "$(location hoststubgen) " +
46 "@$(location :ravenwood-standard-options) " +
47 "--debug-log $(location hoststubgen_framework-minus-apex.log) " +
48 "--out-jar $(location ravenwood.jar) " +
49 "--in-jar $(location :framework-minus-apex-for-host) " +
John Wu25110732024-10-10 22:40:49 +000050 "--policy-override-file $(location :ravenwood-common-policies) " +
John Wu2abff412024-10-10 21:58:26 +000051 "--policy-override-file $(location :ravenwood-framework-policies) " +
52 "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) "
53
54java_genrule {
55 name: "framework-minus-apex.ravenwood-base_X0",
56 defaults: ["framework-minus-apex.ravenwood-base_defaults"],
57 cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 0",
58}
59
60java_genrule {
61 name: "framework-minus-apex.ravenwood-base_X1",
62 defaults: ["framework-minus-apex.ravenwood-base_defaults"],
63 cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 1",
64}
65
66java_genrule {
67 name: "framework-minus-apex.ravenwood-base_X2",
68 defaults: ["framework-minus-apex.ravenwood-base_defaults"],
69 cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 2",
70}
71
72java_genrule {
73 name: "framework-minus-apex.ravenwood-base_X3",
74 defaults: ["framework-minus-apex.ravenwood-base_defaults"],
75 cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 3",
76}
77
78java_genrule {
79 name: "framework-minus-apex.ravenwood-base_X4",
80 defaults: ["framework-minus-apex.ravenwood-base_defaults"],
81 cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 4",
82}
83
84java_genrule {
85 name: "framework-minus-apex.ravenwood-base_X5",
86 defaults: ["framework-minus-apex.ravenwood-base_defaults"],
87 cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 5",
88}
89
90java_genrule {
91 name: "framework-minus-apex.ravenwood-base_X6",
92 defaults: ["framework-minus-apex.ravenwood-base_defaults"],
93 cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 6",
94}
95
96java_genrule {
97 name: "framework-minus-apex.ravenwood-base_X7",
98 defaults: ["framework-minus-apex.ravenwood-base_defaults"],
99 cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 7",
100}
101
102java_genrule {
103 name: "framework-minus-apex.ravenwood-base_X8",
104 defaults: ["framework-minus-apex.ravenwood-base_defaults"],
105 cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 8",
106}
107
108java_genrule {
109 name: "framework-minus-apex.ravenwood-base_X9",
110 defaults: ["framework-minus-apex.ravenwood-base_defaults"],
111 cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 9",
112}
113
114// Build framework-minus-apex.ravenwood-base without sharding.
115// We extract the various dump files from this one, rather than the sharded ones, because
116// some dumps use the output from other classes (e.g. base classes) which may not be in the
117// same shard. Also some of the dump files ("apis") may be slow even when sharded, because
118// the output contains the information from all the input classes, rather than the output classes.
119// Not using sharding is fine for this module because it's only used for collecting the
120// dump / stats files, which don't have to happen regularly.
121java_genrule {
122 name: "framework-minus-apex.ravenwood-base_all",
123 defaults: ["framework-minus-apex.ravenwood-base_defaults"],
124 cmd: framework_minus_apex_cmd +
125 "--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " +
126 "--supported-api-list-file $(location hoststubgen_framework-minus-apex_apis.csv) " +
127
128 "--gen-keep-all-file $(location hoststubgen_framework-minus-apex_keep_all.txt) " +
129 "--gen-input-dump-file $(location hoststubgen_framework-minus-apex_dump.txt) ",
130
131 out: [
132 "hoststubgen_framework-minus-apex_keep_all.txt",
133 "hoststubgen_framework-minus-apex_dump.txt",
134 "hoststubgen_framework-minus-apex_stats.csv",
135 "hoststubgen_framework-minus-apex_apis.csv",
136 ],
137}
138
139// Marge all the sharded jars
140java_genrule {
141 name: "framework-minus-apex.ravenwood",
142 defaults: ["ravenwood-internal-only-visibility-java"],
143 cmd: "$(location merge_zips) $(out) $(in)",
144 tools: ["merge_zips"],
145 srcs: [
146 ":framework-minus-apex.ravenwood-base_X0{ravenwood.jar}",
147 ":framework-minus-apex.ravenwood-base_X1{ravenwood.jar}",
148 ":framework-minus-apex.ravenwood-base_X2{ravenwood.jar}",
149 ":framework-minus-apex.ravenwood-base_X3{ravenwood.jar}",
150 ":framework-minus-apex.ravenwood-base_X4{ravenwood.jar}",
151 ":framework-minus-apex.ravenwood-base_X5{ravenwood.jar}",
152 ":framework-minus-apex.ravenwood-base_X6{ravenwood.jar}",
153 ":framework-minus-apex.ravenwood-base_X7{ravenwood.jar}",
154 ":framework-minus-apex.ravenwood-base_X8{ravenwood.jar}",
155 ":framework-minus-apex.ravenwood-base_X9{ravenwood.jar}",
156 ],
157 out: [
158 "framework-minus-apex.ravenwood.jar",
159 ],
160}
161
162//////////////////
163// services.core
164//////////////////
165
166java_library {
167 name: "services.core-for-host",
168 installable: false, // host only jar.
169 static_libs: [
170 "services.core",
171 ],
172 sdk_version: "core_platform",
173 visibility: ["//visibility:private"],
174}
175
176java_genrule {
177 name: "services.core.ravenwood-base",
178 tools: ["hoststubgen"],
179 cmd: "$(location hoststubgen) " +
180 "@$(location :ravenwood-standard-options) " +
181
182 "--debug-log $(location hoststubgen_services.core.log) " +
183 "--stats-file $(location hoststubgen_services.core_stats.csv) " +
184 "--supported-api-list-file $(location hoststubgen_services.core_apis.csv) " +
John Wu2abff412024-10-10 21:58:26 +0000185 "--gen-keep-all-file $(location hoststubgen_services.core_keep_all.txt) " +
186 "--gen-input-dump-file $(location hoststubgen_services.core_dump.txt) " +
187
John Wu25110732024-10-10 22:40:49 +0000188 "--out-jar $(location ravenwood.jar) " +
John Wu2abff412024-10-10 21:58:26 +0000189 "--in-jar $(location :services.core-for-host) " +
John Wu25110732024-10-10 22:40:49 +0000190
191 "--policy-override-file $(location :ravenwood-common-policies) " +
John Wu2abff412024-10-10 21:58:26 +0000192 "--policy-override-file $(location :ravenwood-services-policies) " +
193 "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ",
194 srcs: [
195 ":services.core-for-host",
John Wu25110732024-10-10 22:40:49 +0000196 ":ravenwood-common-policies",
John Wu2abff412024-10-10 21:58:26 +0000197 ":ravenwood-services-policies",
198 ":ravenwood-standard-options",
199 ":ravenwood-annotation-allowed-classes",
200 ],
201 out: [
202 "ravenwood.jar",
203
204 // Following files are created just as FYI.
205 "hoststubgen_services.core_keep_all.txt",
206 "hoststubgen_services.core_dump.txt",
207
208 "hoststubgen_services.core.log",
209 "hoststubgen_services.core_stats.csv",
210 "hoststubgen_services.core_apis.csv",
211 ],
212 visibility: ["//visibility:private"],
213}
214
215java_genrule {
216 name: "services.core.ravenwood",
217 defaults: ["ravenwood-internal-only-visibility-genrule"],
218 cmd: "cp $(in) $(out)",
219 srcs: [
220 ":services.core.ravenwood-base{ravenwood.jar}",
221 ],
222 out: [
223 "services.core.ravenwood.jar",
224 ],
225}
226
227// TODO(b/313930116) This jarjar is a bit slow. We should use hoststubgen for renaming,
228// but services.core.ravenwood has complex dependencies, so it'll take more than
229// just using hoststubgen "rename"s.
230java_library {
231 name: "services.core.ravenwood-jarjar",
232 defaults: ["ravenwood-internal-only-visibility-java"],
233 installable: false,
234 static_libs: [
235 "services.core.ravenwood",
236 ],
237 jarjar_rules: ":ravenwood-services-jarjar-rules",
238}
239
240///////////////
241// core-icu4j
242///////////////
243
244java_genrule {
245 name: "core-icu4j-for-host.ravenwood-base",
246 tools: ["hoststubgen"],
247 cmd: "$(location hoststubgen) " +
248 "@$(location :ravenwood-standard-options) " +
249
250 "--debug-log $(location hoststubgen_core-icu4j-for-host.log) " +
251 "--stats-file $(location hoststubgen_core-icu4j-for-host_stats.csv) " +
252 "--supported-api-list-file $(location hoststubgen_core-icu4j-for-host_apis.csv) " +
John Wu2abff412024-10-10 21:58:26 +0000253 "--gen-keep-all-file $(location hoststubgen_core-icu4j-for-host_keep_all.txt) " +
254 "--gen-input-dump-file $(location hoststubgen_core-icu4j-for-host_dump.txt) " +
255
John Wu25110732024-10-10 22:40:49 +0000256 "--out-jar $(location ravenwood.jar) " +
John Wu2abff412024-10-10 21:58:26 +0000257 "--in-jar $(location :core-icu4j-for-host) " +
John Wu25110732024-10-10 22:40:49 +0000258
259 "--policy-override-file $(location :ravenwood-common-policies) " +
260 "--policy-override-file $(location :icu-ravenwood-policies) ",
John Wu2abff412024-10-10 21:58:26 +0000261 srcs: [
262 ":core-icu4j-for-host",
263
John Wu25110732024-10-10 22:40:49 +0000264 ":ravenwood-common-policies",
John Wu2abff412024-10-10 21:58:26 +0000265 ":icu-ravenwood-policies",
266 ":ravenwood-standard-options",
John Wu2abff412024-10-10 21:58:26 +0000267 ],
268 out: [
269 "ravenwood.jar",
270
271 // Following files are created just as FYI.
272 "hoststubgen_core-icu4j-for-host_keep_all.txt",
273 "hoststubgen_core-icu4j-for-host_dump.txt",
274
275 "hoststubgen_core-icu4j-for-host.log",
276 "hoststubgen_core-icu4j-for-host_stats.csv",
277 "hoststubgen_core-icu4j-for-host_apis.csv",
278 ],
279 visibility: ["//visibility:private"],
280}
281
282java_genrule {
283 name: "core-icu4j-for-host.ravenwood",
284 defaults: ["ravenwood-internal-only-visibility-genrule"],
285 cmd: "cp $(in) $(out)",
286 srcs: [
287 ":core-icu4j-for-host.ravenwood-base{ravenwood.jar}",
288 ],
289 out: [
290 "core-icu4j-for-host.ravenwood.jar",
291 ],
292}
John Wu0bbc5442024-10-17 08:46:06 +0000293
294///////////////////////////////////
295// framework-configinfrastructure
296///////////////////////////////////
297
298java_genrule {
299 name: "framework-configinfrastructure.ravenwood-base",
300 tools: ["hoststubgen"],
301 cmd: "$(location hoststubgen) " +
302 "@$(location :ravenwood-standard-options) " +
303
304 "--debug-log $(location framework-configinfrastructure.log) " +
305 "--stats-file $(location framework-configinfrastructure_stats.csv) " +
306 "--supported-api-list-file $(location framework-configinfrastructure_apis.csv) " +
307 "--gen-keep-all-file $(location framework-configinfrastructure_keep_all.txt) " +
308 "--gen-input-dump-file $(location framework-configinfrastructure_dump.txt) " +
309
310 "--out-impl-jar $(location ravenwood.jar) " +
311 "--in-jar $(location :framework-configinfrastructure.impl{.jar}) " +
312
313 "--policy-override-file $(location :ravenwood-common-policies) " +
314 "--policy-override-file $(location :framework-configinfrastructure-ravenwood-policies) ",
315 srcs: [
316 ":framework-configinfrastructure.impl{.jar}",
317
318 ":ravenwood-common-policies",
319 ":framework-configinfrastructure-ravenwood-policies",
320 ":ravenwood-standard-options",
321 ],
322 out: [
323 "ravenwood.jar",
324
325 // Following files are created just as FYI.
326 "framework-configinfrastructure_keep_all.txt",
327 "framework-configinfrastructure_dump.txt",
328
329 "framework-configinfrastructure.log",
330 "framework-configinfrastructure_stats.csv",
331 "framework-configinfrastructure_apis.csv",
332 ],
333 visibility: ["//visibility:private"],
334}
335
336java_genrule {
337 name: "framework-configinfrastructure.ravenwood",
338 defaults: ["ravenwood-internal-only-visibility-genrule"],
339 cmd: "cp $(in) $(out)",
340 srcs: [
341 ":framework-configinfrastructure.ravenwood-base{ravenwood.jar}",
342 ],
343 out: [
344 "framework-configinfrastructure.ravenwood.jar",
345 ],
346}