forked from aosp-mirror/platform_frameworks_base
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Ravenwood.bp
267 lines (236 loc) · 9.92 KB
/
Ravenwood.bp
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
// Copyright (C) 2023 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.
// We need this "trampoline" rule to force soong to give a host-side jar to
// framework-minus-apex.ravenwood-base. Otherwise, soong would mix up the arch (?) and we'd get
// a dex jar.
java_library {
name: "framework-minus-apex-for-hoststubgen",
installable: false, // host only jar.
static_libs: [
"framework-minus-apex",
],
sdk_version: "core_platform",
visibility: ["//visibility:private"],
}
// Process framework-all with hoststubgen for Ravenwood.
// This step takes several tens of seconds, so we manually shard it to multiple modules.
// All the copies have to be kept in sync.
// TODO: Do the sharding better, either by making hostsubgen support sharding natively, or
// making a better build rule.
genrule_defaults {
name: "framework-minus-apex.ravenwood-base_defaults",
defaults: ["ravenwood-internal-only-visibility-genrule"],
tools: ["hoststubgen"],
srcs: [
":framework-minus-apex-for-hoststubgen",
":ravenwood-framework-policies",
":ravenwood-standard-options",
":ravenwood-annotation-allowed-classes",
],
out: [
"ravenwood.jar",
"hoststubgen_framework-minus-apex.log",
],
}
framework_minus_apex_cmd = "$(location hoststubgen) " +
"@$(location :ravenwood-standard-options) " +
"--debug-log $(location hoststubgen_framework-minus-apex.log) " +
"--out-jar $(location ravenwood.jar) " +
"--in-jar $(location :framework-minus-apex-for-hoststubgen) " +
"--policy-override-file $(location :ravenwood-framework-policies) " +
"--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) "
java_genrule {
name: "framework-minus-apex.ravenwood-base_X0",
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 0",
}
java_genrule {
name: "framework-minus-apex.ravenwood-base_X1",
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 1",
}
java_genrule {
name: "framework-minus-apex.ravenwood-base_X2",
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 2",
}
java_genrule {
name: "framework-minus-apex.ravenwood-base_X3",
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 3",
}
java_genrule {
name: "framework-minus-apex.ravenwood-base_X4",
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 4",
}
java_genrule {
name: "framework-minus-apex.ravenwood-base_X5",
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 5",
}
java_genrule {
name: "framework-minus-apex.ravenwood-base_X6",
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 6",
}
java_genrule {
name: "framework-minus-apex.ravenwood-base_X7",
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 7",
}
java_genrule {
name: "framework-minus-apex.ravenwood-base_X8",
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 8",
}
java_genrule {
name: "framework-minus-apex.ravenwood-base_X9",
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 9",
}
// Build framework-minus-apex.ravenwood-base without sharding.
// We extract the various dump files from this one, rather than the sharded ones, because
// some dumps use the output from other classes (e.g. base classes) which may not be in the
// same shard. Also some of the dump files ("apis") may be slow even when sharded, because
// the output contains the information from all the input classes, rather than the output classes.
// Not using sharding is fine for this module because it's only used for collecting the
// dump / stats files, which don't have to happen regularly.
java_genrule {
name: "framework-minus-apex.ravenwood-base_all",
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
cmd: framework_minus_apex_cmd +
"--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " +
"--supported-api-list-file $(location hoststubgen_framework-minus-apex_apis.csv) " +
"--gen-keep-all-file $(location hoststubgen_framework-minus-apex_keep_all.txt) " +
"--gen-input-dump-file $(location hoststubgen_framework-minus-apex_dump.txt) ",
out: [
"hoststubgen_framework-minus-apex_keep_all.txt",
"hoststubgen_framework-minus-apex_dump.txt",
"hoststubgen_framework-minus-apex_stats.csv",
"hoststubgen_framework-minus-apex_apis.csv",
],
}
// Marge all the sharded jars
java_genrule {
name: "framework-minus-apex.ravenwood",
defaults: ["ravenwood-internal-only-visibility-java"],
cmd: "$(location merge_zips) $(out) $(in)",
tools: ["merge_zips"],
srcs: [
":framework-minus-apex.ravenwood-base_X0{ravenwood.jar}",
":framework-minus-apex.ravenwood-base_X1{ravenwood.jar}",
":framework-minus-apex.ravenwood-base_X2{ravenwood.jar}",
":framework-minus-apex.ravenwood-base_X3{ravenwood.jar}",
":framework-minus-apex.ravenwood-base_X4{ravenwood.jar}",
":framework-minus-apex.ravenwood-base_X5{ravenwood.jar}",
":framework-minus-apex.ravenwood-base_X6{ravenwood.jar}",
":framework-minus-apex.ravenwood-base_X7{ravenwood.jar}",
":framework-minus-apex.ravenwood-base_X8{ravenwood.jar}",
":framework-minus-apex.ravenwood-base_X9{ravenwood.jar}",
],
out: [
"framework-minus-apex.ravenwood.jar",
],
}
java_library {
name: "services.core-for-hoststubgen",
installable: false, // host only jar.
static_libs: [
"services.core",
],
sdk_version: "core_platform",
visibility: ["//visibility:private"],
}
java_genrule {
name: "services.core.ravenwood-base",
tools: ["hoststubgen"],
cmd: "$(location hoststubgen) " +
"@$(location :ravenwood-standard-options) " +
"--debug-log $(location hoststubgen_services.core.log) " +
"--stats-file $(location hoststubgen_services.core_stats.csv) " +
"--supported-api-list-file $(location hoststubgen_services.core_apis.csv) " +
"--out-jar $(location ravenwood.jar) " +
"--gen-keep-all-file $(location hoststubgen_services.core_keep_all.txt) " +
"--gen-input-dump-file $(location hoststubgen_services.core_dump.txt) " +
"--in-jar $(location :services.core-for-hoststubgen) " +
"--policy-override-file $(location :ravenwood-services-policies) " +
"--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ",
srcs: [
":services.core-for-hoststubgen",
":ravenwood-services-policies",
":ravenwood-standard-options",
":ravenwood-annotation-allowed-classes",
],
out: [
"ravenwood.jar",
// Following files are created just as FYI.
"hoststubgen_services.core_keep_all.txt",
"hoststubgen_services.core_dump.txt",
"hoststubgen_services.core.log",
"hoststubgen_services.core_stats.csv",
"hoststubgen_services.core_apis.csv",
],
defaults: ["ravenwood-internal-only-visibility-genrule"],
}
java_genrule {
name: "services.core.ravenwood",
defaults: ["ravenwood-internal-only-visibility-genrule"],
cmd: "cp $(in) $(out)",
srcs: [
":services.core.ravenwood-base{ravenwood.jar}",
],
out: [
"services.core.ravenwood.jar",
],
}
// TODO(b/313930116) This jarjar is a bit slow. We should use hoststubgen for renaming,
// but services.core.ravenwood has complex dependencies, so it'll take more than
// just using hoststubgen "rename"s.
java_library {
name: "services.core.ravenwood-jarjar",
defaults: ["ravenwood-internal-only-visibility-java"],
installable: false,
static_libs: [
"services.core.ravenwood",
],
jarjar_rules: ":ravenwood-services-jarjar-rules",
}
// Jars in "ravenwood-runtime" are set to the classpath, sorted alphabetically.
// Rename some of the dependencies to make sure they're included in the intended order.
java_library {
name: "100-framework-minus-apex.ravenwood",
defaults: ["ravenwood-internal-only-visibility-java"],
static_libs: [
"framework-minus-apex.ravenwood",
],
sdk_version: "core_platform",
// See b/313930116. Jarjar is too slow on this jar. We use HostStubGen to do the rename.
// jarjar_rules: ":ravenwood-framework-jarjar-rules",
}
java_genrule {
// Use 200 to make sure it comes before the mainline stub ("all-updatable...").
name: "200-kxml2-android",
defaults: ["ravenwood-internal-only-visibility-genrule"],
cmd: "cp $(in) $(out)",
srcs: [":kxml2-android"],
out: ["200-kxml2-android.jar"],
}
java_genrule {
name: "z00-all-updatable-modules-system-stubs",
defaults: ["ravenwood-internal-only-visibility-genrule"],
cmd: "cp $(in) $(out)",
srcs: [":all-updatable-modules-system-stubs"],
out: ["z00-all-updatable-modules-system-stubs.jar"],
}