Home | History | Annotate | Download | only in apex
      1 // Android Runtime APEX module.
      2 
      3 // Modules listed in LOCAL_REQUIRED_MODULES for module art-runtime in art/Android.mk.
      4 // - Base requirements (binaries for which both 32- and 64-bit versions are built, if relevant).
      5 art_runtime_base_binaries_both = [
      6     "dalvikvm",
      7 ]
      8 // - Base requirements (binaries for which a 32-bit version is preferred).
      9 art_runtime_base_binaries_prefer32 = [
     10     "dex2oat",
     11     "dexoptanalyzer",
     12     "profman",
     13 ]
     14 // - Base requirements (libraries).
     15 //
     16 // Note: ART on-device chroot-based testing and benchmarking is not yet using
     17 // the Runtime APEX, meaning that copies of some of these libraries have to be
     18 // installed in `/system` for the ART Buildbot set-up to work properly. This is
     19 // done by the `standalone-apex-files` Make phony target, used by the ART
     20 // Buildbot and Golem (see `art/Android.mk`). If you add libraries to this list,
     21 // you may have to also add them to `PRIVATE_RUNTIME_DEPENDENCY_LIBS` in
     22 // `art/Android.mk`.
     23 // TODO(b/121117762): Remove this note when both the ART Buildbot and Golem use
     24 // the Runtime APEX.
     25 art_runtime_base_native_shared_libs = [
     26     // External API (having APEX stubs).
     27     "libdexfile_external",
     28     "libnativebridge",
     29     "libnativehelper",
     30     "libnativeloader",
     31     // libadbconnection is internal and loaded with dlopen(), but it cannot use
     32     // "required" because of cyclic dependency (b/124505714).
     33     "libadbconnection",
     34     // TODO(b/124476339): Clean up the following libraries once "required"
     35     // dependencies work with APEX libraries.
     36     "libart",
     37     "libart-compiler",
     38     "libdt_fd_forward",
     39     "libdt_socket",
     40     "libjdwp",
     41     "libnpt",
     42     "libopenjdkjvm",
     43     "libopenjdkjvmti",
     44 ]
     45 bionic_native_shared_libs = [
     46     // External API (having APEX stubs).
     47     "libc",
     48     "libm",
     49     "libdl",
     50 ]
     51 
     52 bionic_native_shared_libs_device = [
     53     // ... and their internal dependencies
     54     // These are available only on device
     55     "libc_malloc_debug",
     56     "libc_malloc_hooks",
     57 ]
     58 
     59 bionic_binaries_both = [
     60     "linker",
     61 ]
     62 // - Debug variants (binaries for which a 32-bit version is preferred).
     63 art_runtime_debug_binaries_prefer32 = [
     64     "dexoptanalyzerd",
     65     "profmand",
     66 ]
     67 art_runtime_debug_binaries_prefer32_device = [
     68     "dex2oatd",
     69 ]
     70 art_runtime_debug_binaries_both_host = [
     71     "dex2oatd",
     72 ]
     73 
     74 // - Debug variants (libraries).
     75 art_runtime_debug_native_shared_libs = [
     76     "libadbconnectiond",
     77     "libartd",
     78     "libartd-compiler",
     79     "libopenjdkjvmd",
     80     "libopenjdkjvmtid",
     81 ]
     82 
     83 // Data files associated with bionic / managed core library APIs.
     84 art_runtime_data_file_prebuilts = [
     85     "apex_tz_version",
     86     "apex_tzdata",
     87     "apex_tzlookup.xml",
     88     "apex_icu.dat",
     89 ]
     90 
     91 // Tools common to both device APEX and host APEX. Derived from art-tools in art/Android.mk.
     92 art_tools_common_binaries = [
     93     "dexdump",
     94     "dexlist",
     95 ]
     96 
     97 // Tools common to both device and host debug APEXes.
     98 art_tools_debug_binaries = [
     99     "dexdiag",
    100 ]
    101 
    102 // Tools exclusively for the device APEX derived from art-tools in art/Android.mk.
    103 art_tools_device_only_binaries = [
    104     // oatdump cannot link with host linux_bionic due to not using clang lld;
    105     // TODO: Make it work with clang lld.
    106     "oatdump",
    107 ]
    108 // Same, but for only for debug packages.
    109 art_tools_debug_device_only_binaries = [
    110     // oatdumpd cannot link with host linux_bionic due to not using clang lld;
    111     // TODO: Make it work with clang lld.
    112     "oatdumpd",
    113 ]
    114 
    115 // Tools exclusively for the host APEX derived from art-tools in art/Android.mk.
    116 art_tools_host_only_binaries = [
    117     // FIXME: Does not work as-is, because `ahat` is defined in tools/ahat/Android.mk
    118     // (same issue as for `libart_fake` above).
    119     //"ahat",
    120     "hprof-conv",
    121 ]
    122 
    123 // Libraries needed to use com.android.runtime.host for zipapex run-tests
    124 art_runtime_host_run_test_libs = [
    125     "libartd-disassembler"
    126 ]
    127 
    128 // Core Java libraries.
    129 libcore_java_libs = [
    130     "core-oj",
    131     "core-libart",
    132     "okhttp",
    133     "bouncycastle",
    134     "apache-xml",
    135 ]
    136 
    137 // Native libraries that support the core Java libraries.
    138 //
    139 // Note: ART on-device chroot-based testing and benchmarking is not yet using
    140 // the Runtime APEX, meaning that copies of some of these libraries have to be
    141 // installed in `/system` for the ART Buildbot set-up to work properly. This is
    142 // done by the `standalone-apex-files` Make phony target, used by the ART
    143 // Buildbot and Golem (see `art/Android.mk`). If you add libraries to this list,
    144 // you may have to also add them to `PRIVATE_RUNTIME_DEPENDENCY_LIBS` in
    145 // `art/Android.mk`.
    146 // TODO(b/121117762): Remove this note when both the ART Buildbot and Golem use
    147 // the Runtime APEX.
    148 libcore_native_shared_libs = [
    149     // External API (having APEX stubs).
    150     "libandroidicu",
    151     "libandroidio",
    152     // TODO(b/124476339): Clean up the following libraries once "required"
    153     // dependencies work with APEX libraries.
    154     "libexpat",
    155     "libicui18n",
    156     "libicuuc",
    157     "libjavacore",
    158     "libopenjdk",
    159 ]
    160 libcore_debug_native_shared_libs = [
    161     "libopenjdkd",
    162 ]
    163 
    164 libcore_native_device_only_shared_libs = [
    165     // TODO(b/122876336): Remove libpac.so once it's migrated to Webview.
    166     // libpac is used by frameworks, not by ART host.
    167     "libpac",
    168 ]
    169 
    170 // Temporary library includes for b/123591866 as all libraries are moved into the main art-apex.
    171 art_runtime_libraries_zipapex = [
    172     "libnativebridge",
    173     "libnativeloader",
    174     "libnativehelper",
    175     "libcutils",
    176 ]
    177 
    178 apex_key {
    179     name: "com.android.runtime.key",
    180     public_key: "com.android.runtime.avbpubkey",
    181     private_key: "com.android.runtime.pem",
    182 }
    183 
    184 android_app_certificate {
    185     name: "com.android.runtime.debug.certificate",
    186     certificate: "com.android.runtime.debug",
    187 }
    188 
    189 android_app_certificate {
    190     name: "com.android.runtime.release.certificate",
    191     certificate: "com.android.runtime.release",
    192 }
    193 
    194 prebuilt_etc {
    195     name: "com.android.runtime.ld.config.txt",
    196     src: "ld.config.txt",
    197     filename: "ld.config.txt",
    198     installable: false,
    199 }
    200 
    201 apex_defaults {
    202     name: "com.android.runtime-defaults",
    203     compile_multilib: "both",
    204     manifest: "manifest.json",
    205     java_libs: libcore_java_libs,
    206     native_shared_libs: art_runtime_base_native_shared_libs
    207         + bionic_native_shared_libs
    208         + libcore_native_device_only_shared_libs
    209         + libcore_native_shared_libs,
    210     multilib: {
    211         both: {
    212             binaries: art_runtime_base_binaries_both
    213                 + bionic_binaries_both,
    214         },
    215         prefer32: {
    216             binaries: art_runtime_base_binaries_prefer32,
    217         },
    218         first: {
    219             binaries: art_tools_common_binaries
    220                 + art_tools_device_only_binaries,
    221         }
    222     },
    223     binaries: [
    224         "art_postinstall_hook",
    225         "art_preinstall_hook",
    226         "art_preinstall_hook_boot",
    227         "art_preinstall_hook_system_server",
    228         "art_prepostinstall_utils",
    229     ],
    230     prebuilts: art_runtime_data_file_prebuilts
    231         + ["com.android.runtime.ld.config.txt"],
    232     key: "com.android.runtime.key",
    233     required: ["art_apex_boot_integrity"],
    234 }
    235 
    236 // Release version of the Runtime APEX module (not containing debug
    237 // variants nor tools), included in user builds. Also used for
    238 // storage-constrained devices in userdebug and eng builds.
    239 apex {
    240     name: "com.android.runtime.release",
    241     defaults: ["com.android.runtime-defaults"],
    242     native_shared_libs: bionic_native_shared_libs_device,
    243     certificate: ":com.android.runtime.release.certificate",
    244 }
    245 
    246 // "Debug" version of the Runtime APEX module (containing both release and
    247 // debug variants, as well as additional tools), included in userdebug and
    248 // eng build.
    249 apex {
    250     name: "com.android.runtime.debug",
    251     defaults: ["com.android.runtime-defaults"],
    252     native_shared_libs: art_runtime_debug_native_shared_libs
    253         + libcore_debug_native_shared_libs
    254         + bionic_native_shared_libs_device,
    255     multilib: {
    256         prefer32: {
    257             binaries: art_runtime_debug_binaries_prefer32
    258                 + art_runtime_debug_binaries_prefer32_device,
    259         },
    260         first: {
    261             binaries: art_tools_debug_binaries
    262                 + art_tools_debug_device_only_binaries,
    263         }
    264     },
    265     certificate: ":com.android.runtime.debug.certificate",
    266 }
    267 
    268 // TODO: Do this better. art_apex will disable host builds when
    269 // HOST_PREFER_32_BIT is set. We cannot simply use com.android.runtime.debug
    270 // because binaries have different multilib classes and 'multilib: {}' isn't
    271 // supported by target: { ... }.
    272 // See b/120617876 for more information.
    273 art_apex_test {
    274     name: "com.android.runtime.host",
    275     compile_multilib: "both",
    276     payload_type: "zip",
    277     host_supported: true,
    278     device_supported: false,
    279     manifest: "manifest.json",
    280     java_libs: libcore_java_libs,
    281     ignore_system_library_special_case: true,
    282     native_shared_libs: art_runtime_base_native_shared_libs
    283         + art_runtime_debug_native_shared_libs
    284         + libcore_native_shared_libs
    285         + libcore_debug_native_shared_libs
    286         + art_runtime_libraries_zipapex
    287         + art_runtime_host_run_test_libs,
    288     multilib: {
    289         both: {
    290             binaries: art_runtime_base_binaries_both
    291                 + art_runtime_debug_binaries_both_host,
    292         },
    293         first: {
    294             binaries: art_tools_common_binaries
    295                 + art_tools_debug_binaries  // Host APEX is always debug.
    296                 + art_tools_host_only_binaries
    297                 + art_runtime_base_binaries_prefer32
    298                 + art_runtime_debug_binaries_prefer32,
    299         }
    300     },
    301     key: "com.android.runtime.key",
    302     target: {
    303         darwin: {
    304             enabled: false,
    305         },
    306         linux_bionic: {
    307             enabled: true,
    308             multilib: {
    309                 both: {
    310                     native_shared_libs: bionic_native_shared_libs,
    311                     binaries: bionic_binaries_both,
    312                 }
    313             }
    314         },
    315     },
    316 }
    317 
    318 python_binary_host {
    319     name: "art-apex-tester",
    320     srcs: ["art_apex_test.py"],
    321     main: "art_apex_test.py",
    322     version: {
    323         py2: {
    324             enabled: false,
    325         },
    326         py3: {
    327             enabled: true,
    328         },
    329     },
    330 }
    331 
    332 // Genrules so we can run the checker, and empty Java library so that it gets executed.
    333 
    334 genrule {
    335     name: "art-check-release-apex-gen",
    336     srcs: [":com.android.runtime.release"],
    337     tools: [
    338         "art-apex-tester",
    339         "debugfs",
    340     ],
    341     cmd: "$(location art-apex-tester)"
    342               + " --debugfs $(location debugfs)"
    343               + " --tmpdir $(genDir)"
    344               + " $(in)"
    345          + " && touch $(out)",
    346     out: ["art-check-release-apex-gen.dummy"],
    347 }
    348 cc_prebuilt_binary {
    349     name: "art-check-release-apex-gen-fakebin",
    350     srcs: [":art-check-release-apex-gen"],
    351     host_supported: true,
    352     device_supported: false,
    353     target: {
    354         darwin: {
    355             enabled: false,  // No python3.
    356         },
    357     },
    358 }
    359 
    360 genrule {
    361     name: "art-check-debug-apex-gen",
    362     srcs: [":com.android.runtime.debug"],
    363     tools: [
    364         "art-apex-tester",
    365         "debugfs",
    366     ],
    367     cmd: "$(location art-apex-tester)"
    368               + " --debugfs $(location debugfs)"
    369               + " --tmpdir $(genDir)"
    370               + " --debug"
    371               + " $(in)"
    372          + " && touch $(out)",
    373     out: ["art-check-debug-apex-gen.dummy"],
    374 }
    375 cc_prebuilt_binary {
    376     name: "art-check-debug-apex-gen-fakebin",
    377     srcs: [":art-check-debug-apex-gen"],
    378     host_supported: true,
    379     device_supported: false,
    380     target: {
    381         darwin: {
    382             enabled: false,  // No python3.
    383         },
    384     },
    385 }
    386 
    387 // Pre-install scripts.
    388 
    389 sh_binary {
    390     name: "art_preinstall_hook",
    391     src: "art_preinstall_hook.sh",
    392 }
    393 sh_binary {
    394     name: "art_preinstall_hook_boot",
    395     src: "art_preinstall_hook_boot.sh",
    396 }
    397 sh_binary {
    398     name: "art_preinstall_hook_system_server",
    399     src: "art_preinstall_hook_system_server.sh",
    400 }
    401 sh_binary {
    402     name: "art_prepostinstall_utils",
    403     src: "art_prepostinstall_utils.sh",
    404 }
    405 sh_binary {
    406     name: "art_postinstall_hook",
    407     src: "art_postinstall_hook.sh",
    408 }
    409 
    410 sh_binary {
    411     name: "art_apex_boot_integrity",
    412     src: "art_apex_boot_integrity.sh",
    413     init_rc: ["art_apex_boot_integrity.rc"],
    414 }
    415