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 "art_module_genrule_defaults", 21 ], 22} 23 24// Modules listed in LOCAL_REQUIRED_MODULES for module art-runtime in art/Android.mk. 25// - Base requirements (binaries for which both 32- and 64-bit versions are built, if possible). 26art_runtime_base_binaries_both = [ 27 "dalvikvm", 28] 29art_runtime_base_binaries_both_on_device_first_on_host = [ 30 "dex2oat", 31] 32// - Base requirements (binaries for which the "first" version is preferred on device 33// (likely 64-bit) and on host). 34art_runtime_base_binaries_first_on_device_first_on_host = [ 35 "dexoptanalyzer", 36 "odrefresh", 37 "profman", 38] 39 40// - Base requirements (libraries). 41// 42// Note: ART on-device chroot-based testing and benchmarking is not yet using 43// the ART APEX, meaning that copies of some of these libraries have to be 44// installed in `/system` for the ART Buildbot set-up to work properly. This is 45// done by the `standalone-apex-files` Make phony target, used by the ART 46// Buildbot and Golem (see `art/Android.mk`). If you add libraries to this list, 47// you may have to also add them to `PRIVATE_ART_APEX_DEPENDENCY_LIBS` in 48// `art/Android.mk`. 49// TODO(b/121117762): Remove this note when both the ART Buildbot and Golem use 50// the ART APEX. 51art_runtime_base_native_shared_libs = [ 52 // External API (having APEX stubs). 53 "libdexfile", 54 "libnativebridge", 55 "libnativehelper", 56 "libnativeloader", 57 "libsigchain", 58 // libadbconnection is internal and loaded with dlopen(), but it cannot use 59 // "required" because of cyclic dependency (b/124505714). 60 "libadbconnection", 61 // TODO(b/124476339): Clean up the following libraries once "required" 62 // dependencies work with APEX libraries. 63 "libart", 64 "libart-compiler", 65 "libdt_fd_forward", 66 "libdt_socket", 67 "libjdwp", 68 "libnpt", 69 "libopenjdkjvm", 70 "libopenjdkjvmti", 71] 72 73art_runtime_base_native_device_only_shared_libs = [ 74 "libperfetto_hprof", 75] 76 77bionic_native_shared_libs = [ 78 // External API (having APEX stubs). 79 "libc", 80 "libm", 81 "libdl", 82] 83 84bionic_binaries_both = [ 85 "linker", 86 // To validate the zip file generated by cloud server. 87 "ziptool", 88] 89 90// - Debug variants (binaries for which the "first" version is preferred on device 91// (likely 64-bit) and on host). 92art_runtime_debug_binaries_first_on_device_first_on_host = [ 93 "dexoptanalyzerd", 94 "profmand", 95] 96art_runtime_debug_binaries_both_on_device_first_on_host = [ 97 "dex2oatd", 98] 99 100// - Debug variants (libraries). 101art_runtime_debug_native_shared_libs = [ 102 "libadbconnectiond", 103 "libartd", 104 "libartd-compiler", 105 "libdexfiled", 106 "libopenjdkjvmd", 107 "libopenjdkjvmtid", 108] 109 110art_runtime_base_native_device_only_debug_shared_libs = [ 111 "libperfetto_hprofd", 112] 113 114// Libraries needed to execute ART run-tests. 115// TODO(b/124476339): When bug 124476339 is fixed, add these libraries as `runtime_libs` 116// dependencies of `libartd-compiler`, and remove `art_runtime_run_test_libs`. 117art_runtime_run_test_libs = [ 118 "libart-disassembler", 119 "libartd-disassembler", 120] 121 122// Tools common to both device APEX and host APEX. Derived from art-tools in art/Android.mk. 123art_tools_common_binaries = [ 124 "dexdump", 125 "dexlist", 126] 127 128// Tools common to both device and host debug APEXes. 129art_tools_debug_binaries = [ 130 "dexanalyze", 131 "dexdiag", 132 "dexlayout", 133 "dexlayoutd", 134] 135 136art_tools_debug_binaries_both = [ 137 "imgdiag", 138 "imgdiagd", 139] 140 141// Tools exclusively for the device APEX derived from art-tools in art/Android.mk. 142art_tools_device_only_binaries = [ 143 // oatdump cannot link with host linux_bionic due to not using clang lld; 144 // TODO: Make it work with clang lld. 145 "oatdump", 146] 147// Same, but for only for debug packages. 148art_tools_debug_device_only_binaries = [ 149 // oatdumpd cannot link with host linux_bionic due to not using clang lld; 150 // TODO: Make it work with clang lld. 151 "oatdumpd", 152] 153 154// Tools exclusively for the host APEX derived from art-tools in art/Android.mk. 155art_tools_host_only_binaries = [ 156 // FIXME: Does not work as-is, because `ahat` is defined in tools/ahat/Android.mk 157 // (same issue as for `libart_fake` above). 158 //"ahat", 159 "hprof-conv", 160] 161 162// Core Java libraries. 163libcore_java_libs = [ 164 "core-oj", 165 "core-libart", 166 "okhttp", 167 "bouncycastle", 168 "apache-xml", 169] 170 171// Native libraries that support the core Java libraries. 172// 173// Note: ART on-device chroot-based testing and benchmarking is not yet using 174// the ART APEX, meaning that copies of some of these libraries have to be 175// installed in `/system` for the ART Buildbot set-up to work properly. This is 176// done by the `standalone-apex-files` Make phony target, used by the ART 177// Buildbot and Golem (see `art/Android.mk`). If you add libraries to this list, 178// you may have to also add them to `PRIVATE_ART_APEX_DEPENDENCY_LIBS` in 179// `art/Android.mk`. 180// TODO(b/121117762): Remove this note when both the ART Buildbot and Golem use 181// the ART APEX. 182libcore_native_shared_libs = [ 183 // External API (having APEX stubs). 184 "libandroidio", 185 // TODO(b/124476339): Clean up the following libraries once "required" 186 // dependencies work with APEX libraries. 187 "libexpat", 188 "libjavacore", 189 "libopenjdk", 190] 191libcore_debug_native_shared_libs = [ 192 "libopenjdkd", 193] 194 195// Temporary library includes for b/123591866 as all libraries are moved into the main art-apex. 196art_runtime_libraries_zipapex = [ 197 "libnativebridge", 198 "libnativeloader", 199 "libnativehelper", 200 "libcutils", 201] 202 203android_app_certificate { 204 name: "com.android.art.certificate", 205 certificate: "com.android.art", 206} 207 208apex_key { 209 name: "com.android.art.key", 210 public_key: "com.android.art.avbpubkey", 211 private_key: "com.android.art.pem", 212} 213 214art_module_apex_defaults { 215 name: "com.android.art-defaults", 216 217 // Enable if SOONG_CONFIG_art_module_source_build is true. 218 enabled: false, 219 soong_config_variables: { 220 source_build: { 221 enabled: true, 222 }, 223 }, 224 225 target: { 226 windows: { 227 // When the Soong config variable above sets enabled:true, it 228 // overrides the default false for targets, so we need to disable 229 // windows explicitly. 230 enabled: false, 231 }, 232 }, 233} 234 235// Default values shared by device ART APEXes. 236apex_defaults { 237 name: "com.android.art-device-defaults", 238 defaults: ["com.android.art-defaults"], 239 compile_multilib: "both", 240 manifest: "manifest-art.json", 241 bootclasspath_fragments: ["art-bootclasspath-fragment"], 242 compat_configs: ["libcore-platform-compat-config"], 243 java_libs: libcore_java_libs, 244 native_shared_libs: art_runtime_base_native_shared_libs + 245 art_runtime_base_native_device_only_shared_libs + 246 libcore_native_shared_libs, 247 multilib: { 248 both: { 249 binaries: art_runtime_base_binaries_both + 250 art_runtime_base_binaries_both_on_device_first_on_host, 251 }, 252 first: { 253 binaries: art_runtime_base_binaries_first_on_device_first_on_host + 254 art_tools_common_binaries + 255 art_tools_device_only_binaries, 256 }, 257 }, 258 key: "com.android.art.key", 259 required: [ 260 "com.android.i18n", 261 ], 262 prebuilts: [ 263 "art-linker-config", 264 "current_sdkinfo", 265 ], 266 // ART APEXes depend on bouncycastle which is disabled for PDK builds. 267 // Since the dependency is disabled, ART APEXes can't be built either. 268 // Disable the APEXes too. See b/157267166. 269 product_variables: { 270 pdk: { 271 enabled: false, 272 }, 273 }, 274 min_sdk_version: "S", 275 // Indicates that pre-installed version of this apex can be compressed. 276 // Whether it actually will be compressed is controlled on per-device basis. 277 compressible: true, 278} 279 280// Default values shared by (device) Debug and Testing ART APEXes. 281apex_defaults { 282 name: "com.android.art-devel-defaults", 283 defaults: ["com.android.art-device-defaults"], 284 native_shared_libs: art_runtime_base_native_device_only_debug_shared_libs + 285 art_runtime_run_test_libs + 286 art_runtime_debug_native_shared_libs + 287 libcore_debug_native_shared_libs, 288 multilib: { 289 both: { 290 binaries: art_tools_debug_binaries_both + 291 art_runtime_debug_binaries_both_on_device_first_on_host, 292 }, 293 first: { 294 binaries: art_runtime_debug_binaries_first_on_device_first_on_host + 295 art_tools_debug_binaries + 296 art_tools_debug_device_only_binaries, 297 }, 298 }, 299} 300 301apex_test { 302 name: "test_com.android.art", 303 defaults: ["com.android.art-devel-defaults"], 304 manifest: "test_apex_manifest.json", 305 file_contexts: ":com.android.art.debug-file_contexts", 306 certificate: ":com.android.art.certificate", 307 installable: false, 308} 309 310// Release version of the ART APEX module (not containing debug 311// variants nor tools), included in user builds. Also used for 312// storage-constrained devices in userdebug and eng builds. 313art_apex { 314 name: "com.android.art", 315 defaults: ["com.android.art-device-defaults"], 316 certificate: ":com.android.art.certificate", 317} 318 319// "Debug" version of the ART APEX module (containing both release and 320// debug variants, as well as additional tools), included in userdebug and 321// eng build. 322art_apex { 323 name: "com.android.art.debug", 324 defaults: ["com.android.art-devel-defaults"], 325 certificate: ":com.android.art.certificate", 326} 327 328// ART gtests with dependencies on internal ART APEX libraries. 329art_gtests = [ 330 "art_cmdline_tests", 331 "art_compiler_tests", 332 "art_dex2oat_tests", 333 "art_dexanalyze_tests", 334 "art_dexdiag_tests", 335 "art_dexdump_tests", 336 "art_dexlayout_tests", 337 "art_dexlist_tests", 338 "art_dexoptanalyzer_tests", 339 "art_imgdiag_tests", 340 "art_libartbase_tests", 341 "art_libartpalette_tests", 342 "art_libdexfile_tests", 343 "art_libdexfile_support_tests", 344 "art_libprofile_tests", 345 "art_oatdump_tests", 346 "art_odrefresh_tests", 347 "art_profman_tests", 348 "art_runtime_compiler_tests", 349 "art_runtime_tests", 350 "art_sigchain_tests", 351] 352 353// "Testing" version of the ART APEX module (containing both release 354// and debug variants, additional tools, and ART gtests), for testing 355// purposes only. 356art_apex_test { 357 name: "com.android.art.testing", 358 defaults: ["com.android.art-devel-defaults"], 359 file_contexts: ":com.android.art.debug-file_contexts", 360 certificate: ":com.android.art.certificate", 361 tests: art_gtests, 362 binaries: ["signal_dumper"], // Need signal_dumper for run-tests. 363 updatable: false, 364} 365 366// TODO: Do this better. art_apex_test_host will disable host builds when 367// HOST_PREFER_32_BIT is set. We cannot simply use com.android.art.debug 368// because binaries have different multilib classes and 'multilib: {}' isn't 369// supported by target: { ... }. 370// See b/120617876 for more information. 371art_apex_test_host { 372 name: "com.android.art.host", 373 defaults: ["com.android.art-defaults"], 374 compile_multilib: "both", 375 payload_type: "zip", 376 host_supported: true, 377 device_supported: false, 378 manifest: "manifest-art.json", 379 updatable: false, 380 java_libs: libcore_java_libs, 381 ignore_system_library_special_case: true, 382 native_shared_libs: art_runtime_base_native_shared_libs + 383 art_runtime_debug_native_shared_libs + 384 libcore_native_shared_libs + 385 libcore_debug_native_shared_libs + 386 art_runtime_libraries_zipapex + 387 art_runtime_run_test_libs, 388 multilib: { 389 both: { 390 binaries: art_runtime_base_binaries_both + 391 art_tools_debug_binaries_both, 392 }, 393 first: { 394 binaries: art_runtime_base_binaries_both_on_device_first_on_host + 395 art_runtime_base_binaries_first_on_device_first_on_host + 396 art_runtime_debug_binaries_first_on_device_first_on_host + 397 art_runtime_debug_binaries_both_on_device_first_on_host + 398 art_tools_common_binaries + 399 art_tools_debug_binaries + // Host APEX is always debug. 400 art_tools_host_only_binaries, 401 }, 402 }, 403 key: "com.android.art.key", 404 target: { 405 darwin: { 406 enabled: false, 407 }, 408 linux_bionic: { 409 multilib: { 410 both: { 411 native_shared_libs: bionic_native_shared_libs, 412 binaries: bionic_binaries_both, 413 }, 414 }, 415 }, 416 }, 417 // ART APEXes depend on bouncycastle which is disabled for PDK builds. 418 // Since the dependency is disabled, ART APEXes can't be built either. 419 // Disable the APEXes too. See b/157267166. 420 product_variables: { 421 pdk: { 422 enabled: false, 423 }, 424 }, 425} 426 427python_binary_host { 428 name: "art-apex-tester", 429 srcs: ["art_apex_test.py"], 430 main: "art_apex_test.py", 431} 432 433// Genrules so we can run the checker, and empty Java library so that it gets executed. 434 435art_check_apex_gen_stem = "$(location art-apex-tester)" + 436 " --deapexer $(location deapexer)" + 437 " --debugfs $(location debugfs_static)" + 438 " --tmpdir $(genDir)" 439 440// The non-flattened APEXes are always checked, as they are always generated 441// (even when APEX flattening is enabled). 442art_module_genrule_defaults { 443 name: "art-check-apex-gen-defaults", 444 445 // Enable if SOONG_CONFIG_art_module_source_build is true. 446 enabled: false, 447 soong_config_variables: { 448 source_build: { 449 enabled: true, 450 }, 451 }, 452 453 tools: [ 454 "art-apex-tester", 455 "deapexer", 456 "debugfs_static", 457 ], 458} 459 460art_module_cc_defaults { 461 name: "art-check-apex-gen-fakebin-defaults", 462 host_supported: true, 463 device_supported: false, 464 465 // Enable if SOONG_CONFIG_art_module_source_build is true. 466 enabled: false, 467 soong_config_variables: { 468 source_build: { 469 enabled: true, 470 }, 471 }, 472 473 target: { 474 darwin: { 475 enabled: false, // No python3. 476 }, 477 }, 478} 479 480genrule { 481 name: "art-check-release-apex-gen", 482 defaults: ["art-check-apex-gen-defaults"], 483 srcs: [":com.android.art"], 484 cmd: art_check_apex_gen_stem + 485 " --flavor release" + 486 " $(in)" + 487 " && touch $(out)" + 488 " && chmod a+x $(out)", 489 out: ["art-check-release-apex-gen.unused"], 490} 491 492cc_prebuilt_binary { 493 name: "art-check-release-apex-gen-fakebin", 494 defaults: ["art-check-apex-gen-fakebin-defaults"], 495 srcs: [":art-check-release-apex-gen"], 496} 497 498genrule { 499 name: "art-check-debug-apex-gen", 500 defaults: ["art-check-apex-gen-defaults"], 501 srcs: [":com.android.art.debug"], 502 cmd: art_check_apex_gen_stem + 503 " --flavor debug" + 504 " $(in)" + 505 " && touch $(out)" + 506 " && chmod a+x $(out)", 507 out: ["art-check-debug-apex-gen.unused"], 508} 509 510cc_prebuilt_binary { 511 name: "art-check-debug-apex-gen-fakebin", 512 defaults: ["art-check-apex-gen-fakebin-defaults"], 513 srcs: [":art-check-debug-apex-gen"], 514} 515 516genrule { 517 name: "art-check-testing-apex-gen", 518 defaults: ["art-check-apex-gen-defaults"], 519 srcs: [":com.android.art.testing"], 520 cmd: art_check_apex_gen_stem + 521 " --flavor testing" + 522 " $(in)" + 523 " && touch $(out)" + 524 " && chmod a+x $(out)", 525 out: ["art-check-testing-apex-gen.unused"], 526} 527 528cc_prebuilt_binary { 529 name: "art-check-testing-apex-gen-fakebin", 530 defaults: ["art-check-apex-gen-fakebin-defaults"], 531 srcs: [":art-check-testing-apex-gen"], 532} 533 534linker_config { 535 name: "art-linker-config", 536 src: "linker.config.json", 537 installable: false, 538} 539