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 15// Binaries for which both 32- and 64-bit versions are built, if possible. 16art_runtime_binaries_both = [ 17 "dalvikvm", 18 "dex2oat", 19] 20 21// Binaries for which the "first" version is preferred. 22art_runtime_binaries_first = [ 23 "dexdump", 24 "dexlist", 25 "dexoptanalyzer", 26 "oatdump", 27 "profman", 28] 29 30// - Base requirements (libraries). 31// 32// Note: ART on-device chroot-based testing and benchmarking is not yet using 33// the ART APEX, meaning that copies of some of these libraries have to be 34// installed in `/system` for the ART Buildbot set-up to work properly. This is 35// done by the `standalone-apex-files` Make phony target, used by the ART 36// Buildbot and Golem (see `art/Android.mk`). If you add libraries to this list, 37// you may have to also add them to `PRIVATE_ART_APEX_DEPENDENCY_LIBS` in 38// `art/Android.mk`. 39// TODO(b/121117762): Remove this note when both the ART Buildbot and Golem use 40// the ART APEX. 41art_runtime_base_native_shared_libs_minus_libart = [ 42 // External API (having APEX stubs). 43 "libdexfile", 44 "libnativebridge", 45 "libnativehelper", 46 "libnativeloader", 47 "libsigchain", 48 // libadbconnection is internal and loaded with dlopen(), but it cannot use 49 // "required" because of cyclic dependency (b/124505714). 50 "libadbconnection", 51 // TODO(b/124476339): Clean up the following libraries once "required" 52 // dependencies work with APEX libraries. 53 "libdt_fd_forward", 54 "libdt_socket", 55 "libjdwp", 56 "libnpt", 57 "libopenjdkjvm", 58 "libopenjdkjvmti", 59 "libperfetto_hprof", 60 // TODO(chriswailes): Make libarttools a dependency for another target 61 // when such a target exists 62 "libarttools", 63] 64// Actual version of ART runtime base libs, used in non-test ART APEXes. 65art_runtime_base_native_shared_libs = ["libart"] + 66 art_runtime_base_native_shared_libs_minus_libart 67// "Broken" version of ART runtime base libs, used for testing purposes. 68art_runtime_base_broken_native_shared_libs = ["libart-broken"] + 69 art_runtime_base_native_shared_libs_minus_libart 70 71// - Debug variants (libraries). 72art_runtime_debug_native_shared_libs = [ 73 "libadbconnectiond", 74 "libartd", 75 "libdexfiled", 76 "libopenjdkjvmd", 77 "libopenjdkjvmtid", 78 "libperfetto_hprofd", 79 // Libraries needed to execute ART run-tests. 80 // TODO(b/124476339): When bug 124476339 is fixed, add these libraries as `runtime_libs` 81 // dependencies of `libartd-compiler`, and remove them here. 82 "libart-disassembler", 83 "libartd-disassembler", 84] 85 86// Debug binaries for which both 32- and 64-bit versions are built, if possible. 87art_debug_binaries_both = [ 88 "dex2oatd", 89 "imgdiag", 90 "imgdiagd", 91] 92 93// Debug binaries for which the "first" version is preferred. 94art_debug_binaries_first = [ 95 "dexanalyze", 96 "dexoptanalyzerd", 97 "oatdumpd", 98 "profmand", 99] 100 101// Core Java libraries. 102// This list must be the same as art-bootclasspath-fragment because it's that which is pulled in 103// through bootclasspath_fragments below. (com.android.art-defaults-minus-odrefresh) 104libcore_java_libs = [ 105 "core-oj", 106 "core-libart", 107 "okhttp", 108 "bouncycastle", 109 "apache-xml", 110] 111 112// Create combined library which is used for compiling run-tests. 113// This is much easier than trying to make the test depend on them directly, 114// or than trying to make the test compilation depend on the apex module. 115// Some of the components are only visible here (but not in test Android.bp). 116java_library { 117 name: "art-run-test-bootclasspath", 118 sdk_version: "core_platform", 119 static_libs: libcore_java_libs + [ 120 "framework-annotations-lib", 121 ], 122} 123 124// Native libraries that support the core Java libraries. 125// 126// Note: ART on-device chroot-based testing and benchmarking is not yet using 127// the ART APEX, meaning that copies of some of these libraries have to be 128// installed in `/system` for the ART Buildbot set-up to work properly. This is 129// done by the `standalone-apex-files` Make phony target, used by the ART 130// Buildbot and Golem (see `art/Android.mk`). If you add libraries to this list, 131// you may have to also add them to `PRIVATE_ART_APEX_DEPENDENCY_LIBS` in 132// `art/Android.mk`. 133// TODO(b/121117762): Remove this note when both the ART Buildbot and Golem use 134// the ART APEX. 135libcore_native_shared_libs = [ 136 // External API (having APEX stubs). 137 "libandroidio", 138 // TODO(b/124476339): Clean up the following libraries once "required" 139 // dependencies work with APEX libraries. 140 "libexpat", 141 "libjavacore", 142 "libopenjdk", 143] 144libcore_debug_native_shared_libs = [ 145 "libopenjdkd", 146] 147 148android_app_certificate { 149 name: "com.android.art.certificate", 150 certificate: "com.android.art", 151} 152 153apex_key { 154 name: "com.android.art.key", 155 public_key: "com.android.art.avbpubkey", 156 private_key: "com.android.art.pem", 157} 158 159// Default shared by all ART APEXes. 160apex_defaults { 161 name: "com.android.art-base-defaults", 162 163 target: { 164 windows: { 165 // When the Soong config variable above sets enabled:true, it 166 // overrides the default false for targets, so we need to disable 167 // windows explicitly. 168 enabled: false, 169 }, 170 }, 171} 172 173prebuilt_etc { 174 name: "com.android.art.init.rc", 175 src: "art.rc", 176 filename: "init.rc", 177 installable: false, 178} 179 180// Default values shared by APEXes except test_broken_com.android.art. 181apex_defaults { 182 name: "com.android.art-defaults-minus-odrefresh", 183 defaults: [ 184 "com.android.art-base-defaults", 185 "s-launched-apex-module", 186 ], 187 compile_multilib: "both", 188 manifest: "manifest-art.json", 189 bootclasspath_fragments: ["art-bootclasspath-fragment"], 190 systemserverclasspath_fragments: ["art-systemserverclasspath-fragment"], 191 compat_configs: ["libcore-platform-compat-config"], 192 native_shared_libs: art_runtime_base_native_shared_libs + 193 libcore_native_shared_libs, 194 jni_libs: [ 195 "libartservice", 196 ], 197 binaries: [ 198 "art_boot", 199 "art_exec", 200 "artd", 201 "dexopt_chroot_setup", 202 ], 203 multilib: { 204 both: { 205 binaries: art_runtime_binaries_both, 206 }, 207 first: { 208 binaries: art_runtime_binaries_first, 209 }, 210 }, 211 key: "com.android.art.key", 212 required: [ 213 "com.android.i18n", 214 ], 215 prebuilts: [ 216 "art-linker-config", 217 "com.android.art.init.rc", 218 "current_sdkinfo", 219 ], 220} 221 222// Default values shared by Release, Debug, and Testing APEXes. 223apex_defaults { 224 name: "com.android.art-defaults", 225 defaults: ["com.android.art-defaults-minus-odrefresh"], 226 multilib: { 227 first: { 228 binaries: ["odrefresh"], 229 }, 230 }, 231} 232 233// Default values shared by Debug and Testing ART APEXes. 234apex_defaults { 235 name: "com.android.art-devel-defaults", 236 defaults: ["com.android.art-defaults"], 237 // Use a different manifest for the Debug & Testing ART APEXes (which have 238 // no prebuilts and are thus always built from sources), with a high version 239 // number that ensures that these packages can be installed on virtually all 240 // Android dessert releases. 241 manifest: "manifest-art-debug.json", 242 native_shared_libs: art_runtime_debug_native_shared_libs + 243 libcore_debug_native_shared_libs, 244 jni_libs: [ 245 "libartserviced", 246 ], 247 multilib: { 248 both: { 249 binaries: art_debug_binaries_both, 250 }, 251 first: { 252 binaries: art_debug_binaries_first, 253 }, 254 }, 255} 256 257// "Broken" test APEX, only used for testing, including module 258// `libart-broken` instead of `libart`. 259apex_test { 260 name: "test_broken_com.android.art", 261 // Use of "s-launched-apex-module" does not imply that this is a released 262 // module. 263 defaults: [ 264 "com.android.art-base-defaults", 265 "s-launched-apex-module", 266 ], 267 268 // Only include native libraries in this test APEX. The intention 269 // was to not include binaries (and maybe other artifacts) for now, 270 // as they'd pull the "non-broken" `libart` module into this test 271 // APEX and overwrite `libart-broken`. However, with 272 // unwanted_transitive_deps we can ensure `libart` gets excluded 273 // anyway. 274 // TODO(mast): Add back the binaries and clean this up. 275 native_shared_libs: art_runtime_base_broken_native_shared_libs, 276 unwanted_transitive_deps: ["libart"], 277 compile_multilib: "both", 278 279 key: "com.android.art.key", 280 manifest: "test_apex_manifest.json", 281 file_contexts: ":com.android.art-file_contexts", 282 certificate: ":com.android.art.certificate", 283 installable: false, 284 compressible: false, 285} 286 287apex_test { 288 name: "test_jitzygote_com.android.art", 289 defaults: ["com.android.art-defaults-minus-odrefresh"], 290 multilib: { 291 first: { 292 binaries: ["odrefresh_broken"], 293 }, 294 }, 295 key: "com.android.art.key", 296 manifest: "test_apex_manifest.json", 297 file_contexts: ":com.android.art-file_contexts", 298 certificate: ":com.android.art.certificate", 299 installable: false, 300} 301 302// Release version of the ART APEX module (not containing debug 303// variants nor tools), included in user builds. Also used for 304// storage-constrained devices in userdebug and eng builds. 305apex { 306 name: "com.android.art", 307 defaults: ["com.android.art-defaults"], 308 certificate: ":com.android.art.certificate", 309 visibility: [ 310 "//art/build/sdk", 311 "//packages/modules/common/build", 312 ], 313} 314 315// "Debug" version of the ART APEX module (containing both release and 316// debug variants, as well as additional tools), included in userdebug and 317// eng build. 318apex { 319 name: "com.android.art.debug", 320 defaults: ["com.android.art-devel-defaults"], 321 certificate: ":com.android.art.certificate", 322} 323 324// ART gtests with dependencies on internal ART APEX libraries. 325art_gtests = [ 326 "art_artd_tests", 327 "art_cmdline_tests", 328 "art_compiler_tests", 329 "art_dex2oat_tests", 330 "art_dexanalyze_tests", 331 "art_dexdump_tests", 332 "art_dexlist_tests", 333 "art_disassembler_tests", 334 "art_dexoptanalyzer_tests", 335 "art_imgdiag_tests", 336 "art_libartbase_tests", 337 "art_libartpalette_tests", 338 "art_libartservice_tests", 339 "art_libarttools_tests", 340 "art_libdexfile_tests", 341 "art_libdexfile_support_tests", 342 "art_libprofile_tests", 343 "art_oatdump_tests", 344 "art_odrefresh_tests", 345 "art_profman_tests", 346 "art_runtime_tests", 347 "art_sigchain_tests", 348] 349 350// "Testing" version of the ART APEX module (containing both release 351// and debug variants, additional tools, and ART gtests), for testing 352// purposes only. 353apex_test { 354 name: "com.android.art.testing", 355 defaults: ["com.android.art-devel-defaults"], 356 file_contexts: ":com.android.art.debug-file_contexts", 357 certificate: ":com.android.art.certificate", 358 tests: art_gtests, 359 binaries: ["signal_dumper"], // Need signal_dumper for run-tests. 360 // Mark this test APEX as non-updatable, as its contains 361 // additional files (used only for testing) that would not pass 362 // dependency checks performed on updatable APEXes (see 363 // go/apex-allowed-deps-error). 364 updatable: false, 365 // Because this APEX is non-updatable, some of its native shared 366 // libraries (implicitly added as dependencies) are eligible to 367 // the symlink optimization. As we want this APEX to be 368 // self-contained (for testing purposes), we want to package 369 // these dependencies in this APEX, instead of symbolic links to 370 // their counterparts on the `system` partition, which may not 371 // even exist, as in the case of `libbacktrace` (see b/232790938 372 // and b/233357459). Marking this APEX as "future updatable" 373 // disables all symlink optimizations for it. 374 future_updatable: true, 375} 376 377// TODO(b/279835185) This is a placeholder to satisfy the current references. 378// Remove this when all references are removed. 379host_snapshot { 380 name: "com.android.art.host", 381} 382 383python_binary_host { 384 name: "art-apex-tester", 385 srcs: ["art_apex_test.py"], 386 main: "art_apex_test.py", 387} 388 389// Genrules so we can run the checker, and empty Java library so that it gets executed. 390 391art_check_apex_gen_stem = "$(location art-apex-tester)" + 392 " --deapexer $(location deapexer)" + 393 " --debugfs $(location debugfs_static)" + 394 " --fsckerofs $(location fsck.erofs)" + 395 " --tmpdir $(genDir)" 396 397// The non-flattened APEXes are always checked, as they are always generated 398// (even when APEX flattening is enabled). 399genrule_defaults { 400 name: "art-check-apex-gen-defaults", 401 tools: [ 402 "art-apex-tester", 403 "deapexer", 404 "debugfs_static", 405 "fsck.erofs", 406 ], 407} 408 409cc_defaults { 410 name: "art-check-apex-gen-fakebin-defaults", 411 host_supported: true, 412 device_supported: false, 413 414 target: { 415 darwin: { 416 enabled: false, // No python3. 417 }, 418 }, 419} 420 421genrule { 422 name: "art-check-release-apex-gen", 423 defaults: ["art-check-apex-gen-defaults"], 424 srcs: [":com.android.art"], 425 cmd: art_check_apex_gen_stem + 426 " --flavor release" + 427 " $(in)" + 428 " && touch $(out)" + 429 " && chmod a+x $(out)", 430 out: ["art-check-release-apex-gen.unused"], 431} 432 433cc_prebuilt_binary { 434 name: "art-check-release-apex-gen-fakebin", 435 defaults: ["art-check-apex-gen-fakebin-defaults"], 436 srcs: [":art-check-release-apex-gen"], 437} 438 439genrule { 440 name: "art-check-debug-apex-gen", 441 defaults: ["art-check-apex-gen-defaults"], 442 srcs: [":com.android.art.debug"], 443 cmd: art_check_apex_gen_stem + 444 " --flavor debug" + 445 " $(in)" + 446 " && touch $(out)" + 447 " && chmod a+x $(out)", 448 out: ["art-check-debug-apex-gen.unused"], 449} 450 451cc_prebuilt_binary { 452 name: "art-check-debug-apex-gen-fakebin", 453 defaults: ["art-check-apex-gen-fakebin-defaults"], 454 srcs: [":art-check-debug-apex-gen"], 455} 456 457genrule { 458 name: "art-check-testing-apex-gen", 459 defaults: ["art-check-apex-gen-defaults"], 460 srcs: [":com.android.art.testing"], 461 cmd: art_check_apex_gen_stem + 462 " --flavor testing" + 463 " $(in)" + 464 " && touch $(out)" + 465 " && chmod a+x $(out)", 466 out: ["art-check-testing-apex-gen.unused"], 467} 468 469cc_prebuilt_binary { 470 name: "art-check-testing-apex-gen-fakebin", 471 defaults: ["art-check-apex-gen-fakebin-defaults"], 472 srcs: [":art-check-testing-apex-gen"], 473} 474 475linker_config { 476 name: "art-linker-config", 477 src: "linker.config.json", 478 installable: false, 479} 480 481// sdk module types have 3 (maybe 4 for windows?) variants: linux, android, and common_os. 482// common_os depends on the linux/android variants and packages their artifacts into a zip file. 483// We want access to that zip file in art_release_zip, so we need to depend on only the common_os 484// variant of art-module-host-exports, which is what sdk_genrule does. Since sdk_genrule only has 485// 1 variant, we can then depend on it from a different type of genrule like regular genrule. 486sdk_genrule { 487 name: "art-module-host-exports-for-genrule", 488 srcs: [":art-module-host-exports"], 489 out: ["art-module-host-exports-current.zip"], 490 cmd: "cp $(in) $(out)", 491} 492 493// A zip containing ART binaries and ART bootclasspath jars. 494// At the time of writing, this is only for Compiler Explorer (https://godbolt.org). 495genrule { 496 name: "art_release_zip", 497 srcs: [ 498 ":art-module-host-exports-for-genrule", 499 ":com.android.art", 500 ], 501 out: [ 502 "art_release.zip", 503 ], 504 tools: [ 505 "deapexer", 506 "debugfs", 507 "fsck.erofs", 508 "merge_zips", 509 "soong_zip", 510 ], 511 cmd: "$(location deapexer) " + 512 "--debugfs_path $(location debugfs) " + 513 "--fsckerofs_path $(location fsck.erofs) " + 514 "extract $(location :com.android.art) $(genDir)/extracted && " + 515 516 "$(location soong_zip) -o $(out).tmp -P bootjars -j " + 517 "-f $(genDir)/extracted/javalib/core-oj.jar " + 518 "-f $(genDir)/extracted/javalib/core-libart.jar " + 519 "-f $(genDir)/extracted/javalib/okhttp.jar " + 520 "-f $(genDir)/extracted/javalib/bouncycastle.jar " + 521 "-f $(genDir)/extracted/javalib/apache-xml.jar && " + 522 523 "$(location merge_zips) $(out) $(out).tmp $(location :art-module-host-exports-for-genrule)", 524 dist: { 525 targets: ["droidcore"], 526 }, 527} 528