ronnie
2022-10-14 1504bb53e29d3d46222c0b3ea994fc494b48e153
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
// Android Runtime APEX module.
 
// Modules listed in LOCAL_REQUIRED_MODULES for module art-runtime in art/Android.mk.
// - Base requirements (binaries for which both 32- and 64-bit versions are built, if relevant).
art_runtime_base_binaries_both = [
    "dalvikvm",
]
// - Base requirements (binaries for which a 32-bit version is preferred).
art_runtime_base_binaries_prefer32 = [
    "dex2oat",
    "dexoptanalyzer",
    "profman",
]
// - Base requirements (libraries).
//
// Note: ART on-device chroot-based testing and benchmarking is not yet using
// the Runtime APEX, meaning that copies of some of these libraries have to be
// installed in `/system` for the ART Buildbot set-up to work properly. This is
// done by the `standalone-apex-files` Make phony target, used by the ART
// Buildbot and Golem (see `art/Android.mk`). If you add libraries to this list,
// you may have to also add them to `PRIVATE_RUNTIME_DEPENDENCY_LIBS` in
// `art/Android.mk`.
// TODO(b/121117762): Remove this note when both the ART Buildbot and Golem use
// the Runtime APEX.
art_runtime_base_native_shared_libs = [
    // External API (having APEX stubs).
    "libdexfile_external",
    "libnativebridge",
    "libnativehelper",
    "libnativeloader",
    // libadbconnection is internal and loaded with dlopen(), but it cannot use
    // "required" because of cyclic dependency (b/124505714).
    "libadbconnection",
    // TODO(b/124476339): Clean up the following libraries once "required"
    // dependencies work with APEX libraries.
    "libart",
    "libart-compiler",
    "libdt_fd_forward",
    "libdt_socket",
    "libjdwp",
    "libnpt",
    "libopenjdkjvm",
    "libopenjdkjvmti",
]
bionic_native_shared_libs = [
    // External API (having APEX stubs).
    "libc",
    "libm",
    "libdl",
]
 
bionic_native_shared_libs_device = [
    // ... and their internal dependencies
    // These are available only on device
    "libc_malloc_debug",
    "libc_malloc_hooks",
]
 
bionic_binaries_both = [
    "linker",
]
// - Debug variants (binaries for which a 32-bit version is preferred).
art_runtime_debug_binaries_prefer32 = [
    "dexoptanalyzerd",
    "profmand",
]
art_runtime_debug_binaries_prefer32_device = [
    "dex2oatd",
]
art_runtime_debug_binaries_both_host = [
    "dex2oatd",
]
 
// - Debug variants (libraries).
art_runtime_debug_native_shared_libs = [
    "libadbconnectiond",
    "libartd",
    "libartd-compiler",
    "libopenjdkjvmd",
    "libopenjdkjvmtid",
]
 
// Data files associated with bionic / managed core library APIs.
art_runtime_data_file_prebuilts = [
    "apex_tz_version",
    "apex_tzdata",
    "apex_tzlookup.xml",
    "apex_icu.dat",
]
 
// Tools common to both device APEX and host APEX. Derived from art-tools in art/Android.mk.
art_tools_common_binaries = [
    "dexdump",
    "dexlist",
]
 
// Tools common to both device and host debug APEXes.
art_tools_debug_binaries = [
    "dexdiag",
]
 
// Tools exclusively for the device APEX derived from art-tools in art/Android.mk.
art_tools_device_only_binaries = [
    // oatdump cannot link with host linux_bionic due to not using clang lld;
    // TODO: Make it work with clang lld.
    "oatdump",
]
// Same, but for only for debug packages.
art_tools_debug_device_only_binaries = [
    // oatdumpd cannot link with host linux_bionic due to not using clang lld;
    // TODO: Make it work with clang lld.
    "oatdumpd",
]
 
// Tools exclusively for the host APEX derived from art-tools in art/Android.mk.
art_tools_host_only_binaries = [
    // FIXME: Does not work as-is, because `ahat` is defined in tools/ahat/Android.mk
    // (same issue as for `libart_fake` above).
    //"ahat",
    "hprof-conv",
]
 
// Libraries needed to use com.android.runtime.host for zipapex run-tests
art_runtime_host_run_test_libs = [
    "libartd-disassembler"
]
 
// Core Java libraries.
libcore_java_libs = [
    "core-oj",
    "core-libart",
    "okhttp",
    "bouncycastle",
    "apache-xml",
]
 
// Native libraries that support the core Java libraries.
//
// Note: ART on-device chroot-based testing and benchmarking is not yet using
// the Runtime APEX, meaning that copies of some of these libraries have to be
// installed in `/system` for the ART Buildbot set-up to work properly. This is
// done by the `standalone-apex-files` Make phony target, used by the ART
// Buildbot and Golem (see `art/Android.mk`). If you add libraries to this list,
// you may have to also add them to `PRIVATE_RUNTIME_DEPENDENCY_LIBS` in
// `art/Android.mk`.
// TODO(b/121117762): Remove this note when both the ART Buildbot and Golem use
// the Runtime APEX.
libcore_native_shared_libs = [
    // External API (having APEX stubs).
    "libandroidicu",
    "libandroidio",
    // TODO(b/124476339): Clean up the following libraries once "required"
    // dependencies work with APEX libraries.
    "libexpat",
    "libicui18n",
    "libicuuc",
    "libjavacore",
    "libopenjdk",
]
libcore_debug_native_shared_libs = [
    "libopenjdkd",
]
 
libcore_native_device_only_shared_libs = [
    // TODO(b/122876336): Remove libpac.so once it's migrated to Webview.
    // libpac is used by frameworks, not by ART host.
    "libpac",
]
 
// Temporary library includes for b/123591866 as all libraries are moved into the main art-apex.
art_runtime_libraries_zipapex = [
    "libnativebridge",
    "libnativeloader",
    "libnativehelper",
    "libcutils",
]
 
apex_key {
    name: "com.android.runtime.key",
    public_key: "com.android.runtime.avbpubkey",
    private_key: "com.android.runtime.pem",
}
 
android_app_certificate {
    name: "com.android.runtime.debug.certificate",
    certificate: "com.android.runtime.debug",
}
 
android_app_certificate {
    name: "com.android.runtime.release.certificate",
    certificate: "com.android.runtime.release",
}
 
prebuilt_etc {
    name: "com.android.runtime.ld.config.txt",
    src: "ld.config.txt",
    filename: "ld.config.txt",
    installable: false,
}
 
apex_defaults {
    name: "com.android.runtime-defaults",
    compile_multilib: "both",
    manifest: "manifest.json",
    java_libs: libcore_java_libs,
    native_shared_libs: art_runtime_base_native_shared_libs
        + bionic_native_shared_libs
        + libcore_native_device_only_shared_libs
        + libcore_native_shared_libs,
    multilib: {
        both: {
            binaries: art_runtime_base_binaries_both
                + bionic_binaries_both,
        },
        prefer32: {
            binaries: art_runtime_base_binaries_prefer32,
        },
        first: {
            binaries: art_tools_common_binaries
                + art_tools_device_only_binaries,
        }
    },
    binaries: [
        "art_postinstall_hook",
        "art_preinstall_hook",
        "art_preinstall_hook_boot",
        "art_preinstall_hook_system_server",
        "art_prepostinstall_utils",
    ],
    prebuilts: art_runtime_data_file_prebuilts
        + ["com.android.runtime.ld.config.txt"],
    key: "com.android.runtime.key",
    required: ["art_apex_boot_integrity"],
}
 
// Release version of the Runtime 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.runtime.release",
    defaults: ["com.android.runtime-defaults"],
    native_shared_libs: bionic_native_shared_libs_device,
    certificate: ":com.android.runtime.release.certificate",
}
 
// "Debug" version of the Runtime APEX module (containing both release and
// debug variants, as well as additional tools), included in userdebug and
// eng build.
apex {
    name: "com.android.runtime.debug",
    defaults: ["com.android.runtime-defaults"],
    native_shared_libs: art_runtime_debug_native_shared_libs
        + libcore_debug_native_shared_libs
        + bionic_native_shared_libs_device,
    multilib: {
        prefer32: {
            binaries: art_runtime_debug_binaries_prefer32
                + art_runtime_debug_binaries_prefer32_device,
        },
        first: {
            binaries: art_tools_debug_binaries
                + art_tools_debug_device_only_binaries,
        }
    },
    certificate: ":com.android.runtime.debug.certificate",
}
 
// TODO: Do this better. art_apex will disable host builds when
// HOST_PREFER_32_BIT is set. We cannot simply use com.android.runtime.debug
// because binaries have different multilib classes and 'multilib: {}' isn't
// supported by target: { ... }.
// See b/120617876 for more information.
art_apex_test {
    name: "com.android.runtime.host",
    compile_multilib: "both",
    payload_type: "zip",
    host_supported: true,
    device_supported: false,
    manifest: "manifest.json",
    java_libs: libcore_java_libs,
    ignore_system_library_special_case: true,
    native_shared_libs: art_runtime_base_native_shared_libs
        + art_runtime_debug_native_shared_libs
        + libcore_native_shared_libs
        + libcore_debug_native_shared_libs
        + art_runtime_libraries_zipapex
        + art_runtime_host_run_test_libs,
    multilib: {
        both: {
            binaries: art_runtime_base_binaries_both
                + art_runtime_debug_binaries_both_host,
        },
        first: {
            binaries: art_tools_common_binaries
                + art_tools_debug_binaries  // Host APEX is always debug.
                + art_tools_host_only_binaries
                + art_runtime_base_binaries_prefer32
                + art_runtime_debug_binaries_prefer32,
        }
    },
    key: "com.android.runtime.key",
    target: {
        darwin: {
            enabled: false,
        },
        linux_bionic: {
            enabled: true,
            multilib: {
                both: {
                    native_shared_libs: bionic_native_shared_libs,
                    binaries: bionic_binaries_both,
                }
            }
        },
    },
}
 
python_binary_host {
    name: "art-apex-tester",
    srcs: ["art_apex_test.py"],
    main: "art_apex_test.py",
    version: {
        py2: {
            enabled: false,
        },
        py3: {
            enabled: true,
        },
    },
}
 
// Genrules so we can run the checker, and empty Java library so that it gets executed.
 
genrule {
    name: "art-check-release-apex-gen",
    srcs: [":com.android.runtime.release"],
    tools: [
        "art-apex-tester",
        "debugfs",
    ],
    cmd: "$(location art-apex-tester)"
              + " --debugfs $(location debugfs)"
              + " --tmpdir $(genDir)"
              + " $(in)"
         + " && touch $(out)",
    out: ["art-check-release-apex-gen.dummy"],
}
cc_prebuilt_binary {
    name: "art-check-release-apex-gen-fakebin",
    srcs: [":art-check-release-apex-gen"],
    host_supported: true,
    device_supported: false,
    target: {
        darwin: {
            enabled: false,  // No python3.
        },
    },
}
 
genrule {
    name: "art-check-debug-apex-gen",
    srcs: [":com.android.runtime.debug"],
    tools: [
        "art-apex-tester",
        "debugfs",
    ],
    cmd: "$(location art-apex-tester)"
              + " --debugfs $(location debugfs)"
              + " --tmpdir $(genDir)"
              + " --debug"
              + " $(in)"
         + " && touch $(out)",
    out: ["art-check-debug-apex-gen.dummy"],
}
cc_prebuilt_binary {
    name: "art-check-debug-apex-gen-fakebin",
    srcs: [":art-check-debug-apex-gen"],
    host_supported: true,
    device_supported: false,
    target: {
        darwin: {
            enabled: false,  // No python3.
        },
    },
}
 
// Pre-install scripts.
 
sh_binary {
    name: "art_preinstall_hook",
    src: "art_preinstall_hook.sh",
}
sh_binary {
    name: "art_preinstall_hook_boot",
    src: "art_preinstall_hook_boot.sh",
}
sh_binary {
    name: "art_preinstall_hook_system_server",
    src: "art_preinstall_hook_system_server.sh",
}
sh_binary {
    name: "art_prepostinstall_utils",
    src: "art_prepostinstall_utils.sh",
}
sh_binary {
    name: "art_postinstall_hook",
    src: "art_postinstall_hook.sh",
}
 
sh_binary {
    name: "art_apex_boot_integrity",
    src: "art_apex_boot_integrity.sh",
    init_rc: ["art_apex_boot_integrity.rc"],
}