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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
|
// ART APEX module
//
// Contains both the Android Managed Runtime (ART) and the Android Core Library
// (Libcore).
package {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "art_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["art_license"],
}
// Create combined library which is used for compiling run-tests.
// This is much easier than trying to make the test depend on them directly,
// or than trying to make the test compilation depend on the apex module.
// Some of the components are only visible here (but not in test Android.bp).
java_library {
name: "art-run-test-bootclasspath",
sdk_version: "core_platform",
static_libs: [
"framework-annotations-lib",
// Core Java libraries. This list must be the same as
// art-bootclasspath-fragment because it's that which is pulled in
// through bootclasspath_fragments in com.android-art-base-defaults.
"core-oj",
"core-libart",
"okhttp",
"bouncycastle",
"apache-xml",
],
}
android_app_certificate {
name: "com.android.art.certificate",
certificate: "com.android.art",
}
apex_key {
name: "com.android.art.key",
public_key: "com.android.art.avbpubkey",
private_key: "com.android.art.pem",
}
linker_config {
name: "art-linker-config",
src: "linker.config.json",
installable: false,
}
prebuilt_etc {
name: "com.android.art.init.rc",
src: "art.rc",
filename: "init.rc",
installable: false,
}
prebuilt_etc {
name: "dirty-image-objects-art",
src: "dirty-image-objects",
filename: "dirty-image-objects",
installable: false,
}
// Default shared by all ART APEXes.
apex_defaults {
name: "com.android.art-base-defaults",
defaults: ["s-launched-apex-module"],
manifest: "manifest-art.json",
key: "com.android.art.key",
certificate: ":com.android.art.certificate",
bootclasspath_fragments: ["art-bootclasspath-fragment"],
systemserverclasspath_fragments: ["art-systemserverclasspath-fragment"],
compat_configs: ["libcore-platform-compat-config"],
prebuilts: [
"art-linker-config",
"com.android.art.init.rc",
"current_sdkinfo",
"dirty-image-objects-art",
],
compile_multilib: "both",
// Note: ART Golem benchmarking does not use the ART APEX, meaning that
// copies of some of these libraries have to be installed in `/system` for
// the setup to work properly. This is done by the `standalone-apex-files`
// Make phony target (see `art/Android.mk`). If you add libraries to this
// list, you may have to also add them to `PRIVATE_ART_APEX_DEPENDENCY_LIBS`
// in `art/Android.mk`.
native_shared_libs: [
// ART
// External API (having APEX stubs).
"libdexfile",
"libnativebridge",
"libnativehelper",
"libnativeloader",
"libsigchain",
// These libraries are loaded at runtime from libart (either through
// dlopen() or by instructing the user to load with -Xplugin), but they
// cannot be runtime_lib dependencies from there because of cyclic
// dependencies (b/124505714).
"libadbconnection",
"libopenjdkjvmti",
"libperfetto_hprof",
// Likewise libart is loaded at runtime from libnativeloader and also must
// be specified explicitly due to cyclic dependencies. However, it's not
// listed directly here since test_broken_com.android.art uses a different
// implementation.
// Libcore
// External API (having APEX stubs).
"libandroidio",
// This library is loaded at runtime from libart but cannot be a runtime_lib
// dependency from there because of cyclic dependencies (b/124505714).
"libopenjdk",
// These libraries are internal dependencies in libcore, but they don't get
// pulled in automatically into apex_test modules.
"libexpat",
"libopenjdkjvm",
],
multilib: {
both: {
binaries: [
"dalvikvm",
"dex2oat",
],
},
first: {
binaries: [
"art_boot",
"art_exec",
"artd",
"dexdump",
"dexlist",
"dexopt_chroot_setup",
"dexoptanalyzer",
"oatdump",
"profman",
],
jni_libs: [
"libartservice",
],
},
},
}
// Default values shared by Debug and Testing ART APEXes.
apex_defaults {
name: "com.android.art-devel-defaults",
defaults: ["com.android.art-base-defaults"],
native_shared_libs: [
"libadbconnectiond",
"libdexfiled",
"libopenjdkd",
"libopenjdkjvmtid",
"libperfetto_hprofd",
],
multilib: {
both: {
binaries: [
"dex2oatd",
"imgdiag",
"imgdiagd",
],
},
first: {
binaries: [
"dexanalyze",
"dexoptanalyzerd",
"oatdumpd",
"profmand",
],
},
},
}
// "Broken" test APEX, only used for testing, including module
// `libart-broken` instead of `libart`.
apex_test {
name: "test_broken_com.android.art",
defaults: ["com.android.art-base-defaults"],
manifest: "test_apex_manifest.json",
file_contexts: ":com.android.art-file_contexts",
installable: false,
compressible: false,
native_shared_libs: ["libart-broken"],
unwanted_transitive_deps: ["libart"],
}
apex_test {
name: "test_jitzygote_com.android.art",
defaults: ["com.android.art-base-defaults"],
manifest: "test_apex_manifest.json",
file_contexts: ":com.android.art-file_contexts",
installable: false,
native_shared_libs: ["libart"],
multilib: {
first: {
binaries: ["odrefresh_broken"],
},
},
}
// Same as "com.android.art" APEX, but also contains "imgdiag" binary.
// Used to collect dirty-image-objects.
apex_test {
name: "test_imgdiag_com.android.art",
defaults: ["com.android.art-base-defaults"],
manifest: "test_apex_manifest.json",
file_contexts: ":com.android.art-file_contexts",
installable: false,
native_shared_libs: ["libart"],
multilib: {
both: {
binaries: [
"imgdiag",
"pageinfo",
"find_unshared_pages",
],
},
first: {
binaries: ["odrefresh"],
},
},
}
// Release version of the ART APEX module (not containing debug
// variants nor tools), included in user builds. Also used for
// storage-constrained devices in userdebug and eng builds.
apex {
name: "com.android.art",
defaults: ["com.android.art-base-defaults"],
native_shared_libs: ["libart"],
multilib: {
first: {
binaries: ["odrefresh"],
},
},
visibility: [
"//art/build/sdk",
"//packages/modules/common/build",
],
}
// "Debug" version of the ART APEX module (containing both release and
// debug variants, as well as additional tools), included in userdebug and
// eng build.
apex {
name: "com.android.art.debug",
defaults: ["com.android.art-devel-defaults"],
// Use a different manifest for this APEX (which has no prebuilts and is
// thus always built from sources), with a high version number that ensures
// that these packages can be installed on virtually all Android dessert
// releases.
manifest: "manifest-art-debug.json",
native_shared_libs: [
"libart",
"libartd",
],
multilib: {
first: {
binaries: ["odrefresh"],
jni_libs: ["libartserviced"],
},
},
visibility: [
"//packages/modules/common/build",
],
}
// ART gtests with dependencies on internal ART APEX libraries.
art_gtests = [
"art_cmdline_tests",
"art_compiler_tests",
"art_dex2oat_tests",
"art_dexanalyze_tests",
"art_dexdump_tests",
"art_dexlist_tests",
"art_disassembler_tests",
"art_dexoptanalyzer_tests",
"art_imgdiag_tests",
"art_libartbase_tests",
"art_libdexfile_tests",
"art_libdexfile_support_tests",
"art_libprofile_tests",
"art_oatdump_tests",
"art_profman_tests",
"art_runtime_tests",
"art_sigchain_tests",
]
// ART gtests for which the "first" version is preferred.
art_gtests_first = [
"art_odrefresh_tests",
]
// "Testing" version of the ART APEX module (containing both release
// and debug variants, additional tools, and ART gtests), for testing
// purposes only.
apex_test {
name: "com.android.art.testing",
defaults: ["com.android.art-devel-defaults"],
file_contexts: ":com.android.art.debug-file_contexts",
tests: art_gtests,
binaries: ["signal_dumper"], // Need signal_dumper for run-tests.
// Use a different manifest for this APEX (which has no prebuilts and is
// thus always built from sources), with a high version number that ensures
// that these packages can be installed on virtually all Android dessert
// releases.
manifest: "manifest-art-debug.json",
// Mark this test APEX as non-updatable, as its contains
// additional files (used only for testing) that would not pass
// dependency checks performed on updatable APEXes (see
// go/apex-allowed-deps-error).
updatable: false,
// Because this APEX is non-updatable, some of its native shared
// libraries (implicitly added as dependencies) are eligible to
// the symlink optimization. As we want this APEX to be
// self-contained (for testing purposes), we want to package
// these dependencies in this APEX, instead of symbolic links to
// their counterparts on the `system` partition, which may not
// even exist, as in the case of `libbacktrace` (see b/232790938
// and b/233357459). Marking this APEX as "future updatable"
// disables all symlink optimizations for it.
future_updatable: true,
native_shared_libs: [
"libart",
"libartd",
],
multilib: {
first: {
tests: art_gtests_first,
binaries: ["odrefresh"],
jni_libs: ["libartserviced"],
},
},
}
python_binary_host {
name: "art-apex-tester",
srcs: ["art_apex_test.py"],
main: "art_apex_test.py",
}
// Genrules so we can run the checker, and empty Java library so that it gets executed.
art_check_apex_gen_stem = "$(location art-apex-tester)" +
" --deapexer $(location deapexer)" +
" --debugfs $(location debugfs_static)" +
" --fsckerofs $(location fsck.erofs)" +
" --tmpdir $(genDir)"
// The non-flattened APEXes are always checked, as they are always generated
// (even when APEX flattening is enabled).
genrule_defaults {
name: "art-check-apex-gen-defaults",
tools: [
"art-apex-tester",
"deapexer",
"debugfs_static",
"fsck.erofs",
],
}
cc_defaults {
name: "art-check-apex-gen-fakebin-defaults",
host_supported: true,
device_supported: false,
target: {
darwin: {
enabled: false, // No python3.
},
},
}
java_genrule {
name: "art-check-release-apex-gen",
host_supported: true,
device_supported: false,
defaults: ["art-check-apex-gen-defaults"],
device_common_srcs: [":com.android.art"],
cmd: art_check_apex_gen_stem +
" --flavor release" +
" $(in)" +
" && touch $(out)" +
" && chmod a+x $(out)",
out: ["art-check-release-apex-gen.unused"],
}
cc_prebuilt_binary {
name: "art-check-release-apex-gen-fakebin",
defaults: ["art-check-apex-gen-fakebin-defaults"],
srcs: [":art-check-release-apex-gen"],
}
java_genrule {
name: "art-check-debug-apex-gen",
host_supported: true,
device_supported: false,
defaults: ["art-check-apex-gen-defaults"],
device_common_srcs: [":com.android.art.debug"],
cmd: art_check_apex_gen_stem +
" --flavor debug" +
" $(in)" +
" && touch $(out)" +
" && chmod a+x $(out)",
out: ["art-check-debug-apex-gen.unused"],
}
cc_prebuilt_binary {
name: "art-check-debug-apex-gen-fakebin",
defaults: ["art-check-apex-gen-fakebin-defaults"],
srcs: [":art-check-debug-apex-gen"],
}
java_genrule {
name: "art-check-testing-apex-gen",
host_supported: true,
device_supported: false,
defaults: ["art-check-apex-gen-defaults"],
device_common_srcs: [":com.android.art.testing"],
cmd: art_check_apex_gen_stem +
" --flavor testing" +
" $(in)" +
" && touch $(out)" +
" && chmod a+x $(out)",
out: ["art-check-testing-apex-gen.unused"],
}
cc_prebuilt_binary {
name: "art-check-testing-apex-gen-fakebin",
defaults: ["art-check-apex-gen-fakebin-defaults"],
srcs: [":art-check-testing-apex-gen"],
}
// A zip containing ART binaries and ART bootclasspath jars.
// At the time of writing, this is only for Compiler Explorer (https://godbolt.org).
java_genrule {
name: "art_release_zip",
srcs: [
":com.android.art",
],
common_os_srcs: [
":art-module-host-exports",
],
out: [
"art_release.zip",
],
tools: [
"deapexer",
"debugfs",
"fsck.erofs",
"merge_zips",
"soong_zip",
],
cmd: "$(location deapexer) " +
"--debugfs_path $(location debugfs) " +
"--fsckerofs_path $(location fsck.erofs) " +
"extract $(location :com.android.art) $(genDir)/extracted && " +
"$(location soong_zip) -o $(out).tmp -P bootjars -j " +
"-f $(genDir)/extracted/javalib/core-oj.jar " +
"-f $(genDir)/extracted/javalib/core-libart.jar " +
"-f $(genDir)/extracted/javalib/okhttp.jar " +
"-f $(genDir)/extracted/javalib/bouncycastle.jar " +
"-f $(genDir)/extracted/javalib/apache-xml.jar && " +
"$(location merge_zips) $(out) $(out).tmp $(location :art-module-host-exports)",
dist: {
targets: ["droidcore"],
},
}
|