• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// ART APEX module
2//
3// Contains both the Android Managed Runtime (ART) and the Android Core Library
4// (Libcore).
5
6package {
7    // See: http://go/android-license-faq
8    // A large-scale-change added 'default_applicable_licenses' to import
9    // all of the 'license_kinds' from "art_license"
10    // to get the below license kinds:
11    //   SPDX-license-identifier-Apache-2.0
12    default_applicable_licenses: ["art_license"],
13}
14
15soong_config_module_type_import {
16    from: "art/build/SoongConfig.bp",
17    module_types: [
18        "art_module_apex_defaults",
19        "art_module_cc_defaults",
20    ],
21}
22
23// Modules listed in LOCAL_REQUIRED_MODULES for module art-runtime in art/Android.mk.
24// - Base requirements (binaries for which both 32- and 64-bit versions are built, if possible).
25art_runtime_base_binaries_both = [
26    "dalvikvm",
27]
28art_runtime_base_binaries_both_on_device_first_on_host = [
29    "dex2oat",
30]
31// - Base requirements (binaries for which the "first" version is preferred on device
32//  (likely 64-bit) and on host).
33art_runtime_base_binaries_first_on_device_first_on_host = [
34    "dexoptanalyzer",
35    "profman",
36]
37
38// - Base requirements (libraries).
39//
40// Note: ART on-device chroot-based testing and benchmarking is not yet using
41// the ART APEX, meaning that copies of some of these libraries have to be
42// installed in `/system` for the ART Buildbot set-up to work properly. This is
43// done by the `standalone-apex-files` Make phony target, used by the ART
44// Buildbot and Golem (see `art/Android.mk`). If you add libraries to this list,
45// you may have to also add them to `PRIVATE_ART_APEX_DEPENDENCY_LIBS` in
46// `art/Android.mk`.
47// TODO(b/121117762): Remove this note when both the ART Buildbot and Golem use
48// the ART APEX.
49art_runtime_base_native_shared_libs_minus_libart = [
50    // External API (having APEX stubs).
51    "libdexfile",
52    "libnativebridge",
53    "libnativehelper",
54    "libnativeloader",
55    "libsigchain",
56    // libadbconnection is internal and loaded with dlopen(), but it cannot use
57    // "required" because of cyclic dependency (b/124505714).
58    "libadbconnection",
59    // TODO(b/124476339): Clean up the following libraries once "required"
60    // dependencies work with APEX libraries.
61    "libart-compiler",
62    "libdt_fd_forward",
63    "libdt_socket",
64    "libjdwp",
65    "libnpt",
66    "libopenjdkjvm",
67    "libopenjdkjvmti",
68    // TODO(chriswailes): Make libarttools a dependency for another target
69    // when such a target exists
70    "libarttools",
71]
72// Actual version of ART runtime base libs, used in non-test ART APEXes.
73art_runtime_base_native_shared_libs = ["libart"] +
74    art_runtime_base_native_shared_libs_minus_libart
75// "Broken" version of ART runtime base libs, used for testing purposes.
76art_runtime_base_broken_native_shared_libs = ["libart-broken"] +
77    art_runtime_base_native_shared_libs_minus_libart
78
79art_runtime_base_native_device_only_shared_libs = [
80    "libperfetto_hprof",
81]
82
83bionic_native_shared_libs = [
84    // External API (having APEX stubs).
85    "libc",
86    "libm",
87    "libdl",
88]
89
90bionic_binaries_both = [
91    "linker",
92    // To validate the zip file generated by cloud server.
93    "ziptool",
94]
95
96// - Debug variants (binaries for which the "first" version is preferred on device
97//  (likely 64-bit) and on host).
98art_runtime_debug_binaries_first_on_device_first_on_host = [
99    "dexoptanalyzerd",
100    "profmand",
101]
102art_runtime_debug_binaries_both_on_device_first_on_host = [
103    "dex2oatd",
104]
105
106// - Debug variants (libraries).
107art_runtime_debug_native_shared_libs = [
108    "libadbconnectiond",
109    "libartd",
110    "libartd-compiler",
111    "libdexfiled",
112    "libopenjdkjvmd",
113    "libopenjdkjvmtid",
114]
115
116art_runtime_base_native_device_only_debug_shared_libs = [
117    "libperfetto_hprofd",
118]
119
120// Libraries needed to execute ART run-tests.
121// TODO(b/124476339): When bug 124476339 is fixed, add these libraries as `runtime_libs`
122// dependencies of `libartd-compiler`, and remove `art_runtime_run_test_libs`.
123art_runtime_run_test_libs = [
124    "libart-disassembler",
125    "libartd-disassembler",
126]
127
128// Tools common to both device APEX and host APEX. Derived from art-tools in art/Android.mk.
129art_tools_common_binaries = [
130    "dexdump",
131    "dexlist",
132]
133
134// Tools common to both device and host debug APEXes.
135art_tools_debug_binaries = [
136    "dexanalyze",
137    "dexdiag",
138    "dexlayout",
139    "dexlayoutd",
140]
141
142art_tools_debug_binaries_both = [
143    "imgdiag",
144    "imgdiagd",
145]
146
147// Tools exclusively for the device APEX derived from art-tools in art/Android.mk.
148art_tools_device_only_binaries = [
149    // oatdump cannot link with host linux_bionic due to not using clang lld;
150    // TODO: Make it work with clang lld.
151    "oatdump",
152]
153// Same, but for only for debug packages.
154art_tools_debug_device_only_binaries = [
155    // oatdumpd cannot link with host linux_bionic due to not using clang lld;
156    // TODO: Make it work with clang lld.
157    "oatdumpd",
158]
159
160// Tools exclusively for the host APEX derived from art-tools in art/Android.mk.
161art_tools_host_only_binaries = [
162    // FIXME: Does not work as-is, because `ahat` is defined in tools/ahat/Android.mk
163    // (same issue as for `libart_fake` above).
164    //"ahat",
165    "hprof-conv",
166]
167
168// Core Java libraries.
169// This list must be the same as art-bootclasspath-fragment because it's that which is pulled in
170// through bootclasspath_fragments below. (com.android.art-device-defaults-minus-odrefresh)
171libcore_java_libs = [
172    "core-oj",
173    "core-libart",
174    "okhttp",
175    "bouncycastle",
176    "apache-xml",
177]
178
179// Create combined library which is used for compiling run-tests.
180// This is much easier than trying to make the test depend on them directly,
181// or than trying to make the test compilation depend on the apex module.
182// Some of the components are only visible here (but not in test Android.bp).
183java_library {
184    name: "art-run-test-bootclasspath",
185    sdk_version: "core_platform",
186    static_libs: libcore_java_libs + [
187        "framework-annotations-lib",
188    ],
189}
190
191// Native libraries that support the core Java libraries.
192//
193// Note: ART on-device chroot-based testing and benchmarking is not yet using
194// the ART APEX, meaning that copies of some of these libraries have to be
195// installed in `/system` for the ART Buildbot set-up to work properly. This is
196// done by the `standalone-apex-files` Make phony target, used by the ART
197// Buildbot and Golem (see `art/Android.mk`). If you add libraries to this list,
198// you may have to also add them to `PRIVATE_ART_APEX_DEPENDENCY_LIBS` in
199// `art/Android.mk`.
200// TODO(b/121117762): Remove this note when both the ART Buildbot and Golem use
201// the ART APEX.
202libcore_native_shared_libs = [
203    // External API (having APEX stubs).
204    "libandroidio",
205    // TODO(b/124476339): Clean up the following libraries once "required"
206    // dependencies work with APEX libraries.
207    "libexpat",
208    "libjavacore",
209    "libopenjdk",
210]
211libcore_debug_native_shared_libs = [
212    "libopenjdkd",
213]
214
215// Temporary library includes for b/123591866 as all libraries are moved into the main art-apex.
216art_runtime_libraries_zipapex = [
217    "libnativebridge",
218    "libnativeloader",
219    "libnativehelper",
220    "libcutils",
221]
222
223android_app_certificate {
224    name: "com.android.art.certificate",
225    certificate: "com.android.art",
226}
227
228apex_key {
229    name: "com.android.art.key",
230    public_key: "com.android.art.avbpubkey",
231    private_key: "com.android.art.pem",
232}
233
234art_module_apex_defaults {
235    name: "com.android.art-defaults",
236
237    // Enable if ART_MODULE_BUILD_FROM_SOURCE is true
238    enabled: false,
239    soong_config_variables: {
240        source_build: {
241            enabled: true,
242        },
243    },
244
245    target: {
246        windows: {
247            // When the Soong config variable above sets enabled:true, it
248            // overrides the default false for targets, so we need to disable
249            // windows explicitly.
250            enabled: false,
251        },
252    },
253}
254
255prebuilt_etc {
256    name: "com.android.art.init.rc",
257    src: "art.rc",
258    filename: "init.rc",
259    installable: false,
260}
261
262// Default values shared by device ART APEXes.
263apex_defaults {
264    name: "com.android.art-device-defaults-minus-odrefresh",
265    defaults: [
266        "com.android.art-defaults",
267        "s-launched-apex-module",
268    ],
269    compile_multilib: "both",
270    manifest: "manifest-art.json",
271    bootclasspath_fragments: ["art-bootclasspath-fragment"],
272    systemserverclasspath_fragments: ["art-systemserverclasspath-fragment"],
273    compat_configs: ["libcore-platform-compat-config"],
274    native_shared_libs: art_runtime_base_native_shared_libs +
275        art_runtime_base_native_device_only_shared_libs +
276        libcore_native_shared_libs,
277    jni_libs: [
278        "libartservice",
279    ],
280    binaries: [
281        "art_boot",
282        "art_exec",
283        "artd",
284    ],
285    multilib: {
286        both: {
287            binaries: art_runtime_base_binaries_both +
288                art_runtime_base_binaries_both_on_device_first_on_host,
289        },
290        first: {
291            binaries: art_runtime_base_binaries_first_on_device_first_on_host +
292                art_tools_common_binaries +
293                art_tools_device_only_binaries,
294        },
295    },
296    key: "com.android.art.key",
297    required: [
298        "com.android.i18n",
299    ],
300    prebuilts: [
301        "art-linker-config",
302        "com.android.art.init.rc",
303        "current_sdkinfo",
304    ],
305    // ART APEXes depend on bouncycastle which is disabled for PDK builds.
306    // Since the dependency is disabled, ART APEXes can't be built either.
307    // Disable the APEXes too. See b/157267166.
308    product_variables: {
309        pdk: {
310            enabled: false,
311        },
312    },
313}
314
315apex_defaults {
316    name: "com.android.art-device-defaults",
317    defaults: ["com.android.art-device-defaults-minus-odrefresh"],
318    multilib: {
319        first: {
320            binaries: ["odrefresh"],
321        },
322    },
323}
324
325// Default values shared by (device) Debug and Testing ART APEXes.
326apex_defaults {
327    name: "com.android.art-devel-defaults",
328    defaults: ["com.android.art-device-defaults"],
329    native_shared_libs: art_runtime_base_native_device_only_debug_shared_libs +
330        art_runtime_run_test_libs +
331        art_runtime_debug_native_shared_libs +
332        libcore_debug_native_shared_libs,
333    jni_libs: [
334        "libartserviced",
335    ],
336    multilib: {
337        both: {
338            binaries: art_tools_debug_binaries_both +
339                art_runtime_debug_binaries_both_on_device_first_on_host,
340        },
341        first: {
342            binaries: art_runtime_debug_binaries_first_on_device_first_on_host +
343                art_tools_debug_binaries +
344                art_tools_debug_device_only_binaries,
345        },
346    },
347}
348
349// "Broken" test APEX, only used for testing, including module
350// `libart-broken` instead of `libart`.
351apex_test {
352    name: "test_broken_com.android.art",
353    // Use of "s-launched-apex-module" does not imply that this is a released
354    // module.
355    defaults: [
356        "com.android.art-defaults",
357        "s-launched-apex-module",
358    ],
359
360    // Only include native libraries in this test APEX. Don't include
361    // binaries (and maybe other artifacts) for now, as they pull
362    // the "non-broken" `libart` module into this test APEX and
363    // overwrite `libart-broken`. Maybe consider creating "broken"
364    // variants of binaries (and other artifacts)?
365    native_shared_libs: art_runtime_base_broken_native_shared_libs,
366    compile_multilib: "both",
367
368    key: "com.android.art.key",
369    manifest: "test_apex_manifest.json",
370    file_contexts: ":com.android.art-file_contexts",
371    certificate: ":com.android.art.certificate",
372    installable: false,
373    compressible: false,
374}
375
376apex_test {
377    name: "test_jitzygote_com.android.art",
378    defaults: ["com.android.art-device-defaults-minus-odrefresh"],
379    multilib: {
380        first: {
381            binaries: ["odrefresh_broken"],
382        },
383    },
384    key: "com.android.art.key",
385    manifest: "test_apex_manifest.json",
386    file_contexts: ":com.android.art-file_contexts",
387    certificate: ":com.android.art.certificate",
388    installable: false,
389}
390
391// Release version of the ART APEX module (not containing debug
392// variants nor tools), included in user builds. Also used for
393// storage-constrained devices in userdebug and eng builds.
394apex {
395    name: "com.android.art",
396    defaults: ["com.android.art-device-defaults"],
397    certificate: ":com.android.art.certificate",
398}
399
400// "Debug" version of the ART APEX module (containing both release and
401// debug variants, as well as additional tools), included in userdebug and
402// eng build.
403apex {
404    name: "com.android.art.debug",
405    defaults: ["com.android.art-devel-defaults"],
406    certificate: ":com.android.art.certificate",
407}
408
409// ART gtests with dependencies on internal ART APEX libraries.
410art_gtests = [
411    "art_artd_tests",
412    "art_cmdline_tests",
413    "art_compiler_tests",
414    "art_dex2oat_tests",
415    "art_dexanalyze_tests",
416    "art_dexdiag_tests",
417    "art_dexdump_tests",
418    "art_dexlayout_tests",
419    "art_dexlist_tests",
420    "art_disassembler_tests",
421    "art_dexoptanalyzer_tests",
422    "art_imgdiag_tests",
423    "art_libartbase_tests",
424    "art_libartpalette_tests",
425    "art_libartservice_tests",
426    "art_libarttools_tests",
427    "art_libdexfile_tests",
428    "art_libdexfile_support_tests",
429    "art_libprofile_tests",
430    "art_oatdump_tests",
431    "art_odrefresh_tests",
432    "art_profman_tests",
433    "art_runtime_tests",
434    "art_sigchain_tests",
435]
436
437// "Testing" version of the ART APEX module (containing both release
438// and debug variants, additional tools, and ART gtests), for testing
439// purposes only.
440apex_test {
441    name: "com.android.art.testing",
442    defaults: ["com.android.art-devel-defaults"],
443    file_contexts: ":com.android.art.debug-file_contexts",
444    certificate: ":com.android.art.certificate",
445    tests: art_gtests,
446    binaries: ["signal_dumper"], // Need signal_dumper for run-tests.
447    // Mark this test APEX as non-updatable, as its contains
448    // additional files (used only for testing) that would not pass
449    // dependency checks performed on updatable APEXes (see
450    // go/apex-allowed-deps-error).
451    updatable: false,
452    // Because this APEX is non-updatable, some of its native shared
453    // libraries (implicitly added as dependencies) are eligible to
454    // the symlink optimization. As we want this APEX to be
455    // self-contained (for testing purposes), we want to package
456    // these dependencies in this APEX, instead of symbolic links to
457    // their counterparts on the `system` partition, which may not
458    // even exist, as in the case of `libbacktrace` (see b/232790938
459    // and b/233357459). Marking this APEX as "future updatable"
460    // disables all symlink optimizations for it.
461    future_updatable: true,
462}
463
464// TODO: Do this better. art_apex_test_host will disable host builds when
465// HOST_PREFER_32_BIT is set. We cannot simply use com.android.art.debug
466// because binaries have different multilib classes and 'multilib: {}' isn't
467// supported by target: { ... }.
468// See b/120617876 for more information.
469art_apex_test_host {
470    name: "com.android.art.host",
471    defaults: ["com.android.art-defaults"],
472    compile_multilib: "both",
473    payload_type: "zip",
474    host_supported: true,
475    device_supported: false,
476    manifest: "manifest-art.json",
477    updatable: false,
478    java_libs: libcore_java_libs,
479    ignore_system_library_special_case: true,
480    native_shared_libs: art_runtime_base_native_shared_libs +
481        art_runtime_debug_native_shared_libs +
482        libcore_native_shared_libs +
483        libcore_debug_native_shared_libs +
484        art_runtime_libraries_zipapex +
485        art_runtime_run_test_libs,
486    multilib: {
487        both: {
488            binaries: art_runtime_base_binaries_both +
489                art_tools_debug_binaries_both,
490        },
491        first: {
492            binaries: art_runtime_base_binaries_both_on_device_first_on_host +
493                art_runtime_base_binaries_first_on_device_first_on_host +
494                art_runtime_debug_binaries_first_on_device_first_on_host +
495                art_runtime_debug_binaries_both_on_device_first_on_host +
496                art_tools_common_binaries +
497                art_tools_debug_binaries + // Host APEX is always debug.
498                art_tools_host_only_binaries,
499        },
500    },
501    key: "com.android.art.key",
502    target: {
503        darwin: {
504            enabled: false,
505        },
506        linux_bionic: {
507            multilib: {
508                both: {
509                    native_shared_libs: bionic_native_shared_libs,
510                    binaries: bionic_binaries_both,
511                },
512            },
513        },
514    },
515    // ART APEXes depend on bouncycastle which is disabled for PDK builds.
516    // Since the dependency is disabled, ART APEXes can't be built either.
517    // Disable the APEXes too. See b/157267166.
518    product_variables: {
519        pdk: {
520            enabled: false,
521        },
522    },
523}
524
525python_binary_host {
526    name: "art-apex-tester",
527    srcs: ["art_apex_test.py"],
528    main: "art_apex_test.py",
529}
530
531// Genrules so we can run the checker, and empty Java library so that it gets executed.
532
533art_check_apex_gen_stem = "$(location art-apex-tester)" +
534    " --deapexer $(location deapexer)" +
535    " --debugfs $(location debugfs_static)" +
536    " --fsckerofs $(location fsck.erofs)" +
537    " --blkid $(location blkid_static)" +
538    " --tmpdir $(genDir)"
539
540// The non-flattened APEXes are always checked, as they are always generated
541// (even when APEX flattening is enabled).
542genrule_defaults {
543    name: "art-check-apex-gen-defaults",
544    defaults: ["art_module_source_build_genrule_defaults"],
545    tools: [
546        "art-apex-tester",
547        "blkid_static",
548        "deapexer",
549        "debugfs_static",
550        "fsck.erofs",
551    ],
552}
553
554art_module_cc_defaults {
555    name: "art-check-apex-gen-fakebin-defaults",
556    host_supported: true,
557    device_supported: false,
558
559    // Enable if ART_MODULE_BUILD_FROM_SOURCE is true
560    enabled: false,
561    soong_config_variables: {
562        source_build: {
563            enabled: true,
564        },
565    },
566
567    target: {
568        darwin: {
569            enabled: false, // No python3.
570        },
571    },
572}
573
574genrule {
575    name: "art-check-release-apex-gen",
576    defaults: ["art-check-apex-gen-defaults"],
577    srcs: [":com.android.art"],
578    cmd: art_check_apex_gen_stem +
579        " --flavor release" +
580        " $(in)" +
581        " && touch $(out)" +
582        " && chmod a+x $(out)",
583    out: ["art-check-release-apex-gen.unused"],
584}
585
586cc_prebuilt_binary {
587    name: "art-check-release-apex-gen-fakebin",
588    defaults: ["art-check-apex-gen-fakebin-defaults"],
589    srcs: [":art-check-release-apex-gen"],
590}
591
592genrule {
593    name: "art-check-debug-apex-gen",
594    defaults: ["art-check-apex-gen-defaults"],
595    srcs: [":com.android.art.debug"],
596    cmd: art_check_apex_gen_stem +
597        " --flavor debug" +
598        " $(in)" +
599        " && touch $(out)" +
600        " && chmod a+x $(out)",
601    out: ["art-check-debug-apex-gen.unused"],
602}
603
604cc_prebuilt_binary {
605    name: "art-check-debug-apex-gen-fakebin",
606    defaults: ["art-check-apex-gen-fakebin-defaults"],
607    srcs: [":art-check-debug-apex-gen"],
608}
609
610genrule {
611    name: "art-check-testing-apex-gen",
612    defaults: ["art-check-apex-gen-defaults"],
613    srcs: [":com.android.art.testing"],
614    cmd: art_check_apex_gen_stem +
615        " --flavor testing" +
616        " $(in)" +
617        " && touch $(out)" +
618        " && chmod a+x $(out)",
619    out: ["art-check-testing-apex-gen.unused"],
620}
621
622cc_prebuilt_binary {
623    name: "art-check-testing-apex-gen-fakebin",
624    defaults: ["art-check-apex-gen-fakebin-defaults"],
625    srcs: [":art-check-testing-apex-gen"],
626}
627
628linker_config {
629    name: "art-linker-config",
630    src: "linker.config.json",
631    installable: false,
632}
633