diff options
author | 2024-10-01 00:24:02 +0100 | |
---|---|---|
committer | 2024-10-03 20:23:19 +0100 | |
commit | c7f1c1039a7eb4abdfd3800c1b876d546c3059f8 (patch) | |
tree | 4a771521947f1c2286f0ed1591edd201c6424d5b | |
parent | 600794a64c683ed0ac70ea971e241bb72f0797c5 (diff) |
Refactor the ART APEX Soong modules to make them easier to follow.
Reduce the number of defaults and the use of variables, to make it
easier to track what goes into each APEX.
Repeat some variations in each apex or apex_test instead (libart vs
libart-broken and odrefesh vs odrefresh_broken). That gives a little
more duplication, but wins out through less boilerplate and less tricky
defaults.
#codehealth
Test: art/build/apex/runtests.sh
Test: lunch armv8
m test_broken_com.android.art test_jitzygote_com.android.art \
test_imgdiag_com.android.art com.android.art \
com.android.art.debug com.android.art.testing
Check that the .apex files remain bit identical.
Change-Id: I90955b7d97c831a5c4fe18008d678d021dc3b7f8
-rw-r--r-- | build/apex/Android.bp | 300 |
1 files changed, 137 insertions, 163 deletions
diff --git a/build/apex/Android.bp b/build/apex/Android.bp index 6164205d20..a17835652b 100644 --- a/build/apex/Android.bp +++ b/build/apex/Android.bp @@ -12,97 +12,6 @@ package { default_applicable_licenses: ["art_license"], } -// Binaries for which both 32- and 64-bit versions are built, if possible. -art_runtime_binaries_both = [ - "dalvikvm", - "dex2oat", -] - -// Binaries for which the "first" version is preferred. -art_runtime_binaries_first = [ - "art_boot", - "art_exec", - "artd", - "dexdump", - "dexlist", - "dexopt_chroot_setup", - "dexoptanalyzer", - "oatdump", - "profman", -] - -// - Base requirements (libraries). -// -// Note: ART on-device chroot-based testing and benchmarking is not yet using -// the ART 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_ART_APEX_DEPENDENCY_LIBS` in -// `art/Android.mk`. -// TODO(b/121117762): Remove this note when both the ART Buildbot and Golem use -// the ART APEX. -art_runtime_base_native_shared_libs_minus_libart = [ - // External API (having APEX stubs). - "libdexfile", - "libnativebridge", - "libnativehelper", - "libnativeloader", - "libsigchain", - // These libraries are loaded at runtime from libart (either through - // dlopen() or by instructing the user to load with -Xplugin), but they - // cannot be runtime_lib dependencies from there because of cyclic - // dependencies (b/124505714). - "libadbconnection", - "libopenjdkjvmti", - "libperfetto_hprof", - // Likewise libart is loaded at runtime from libnativeloader and also must - // be specified explicitly due to cyclic dependencies. However, it's not - // listed directly here since test_broken_com.android.art uses a different - // implementation. -] -// Actual version of ART runtime base libs, used in non-test ART APEXes. -art_runtime_base_native_shared_libs = ["libart"] + - art_runtime_base_native_shared_libs_minus_libart -// "Broken" version of ART runtime base libs, used for testing purposes. -art_runtime_base_broken_native_shared_libs = ["libart-broken"] + - art_runtime_base_native_shared_libs_minus_libart - -// - Debug variants (libraries). -art_runtime_debug_native_shared_libs = [ - "libadbconnectiond", - "libartd", - "libdexfiled", - "libopenjdkjvmtid", - "libperfetto_hprofd", -] - -// Debug binaries for which both 32- and 64-bit versions are built, if possible. -art_debug_binaries_both = [ - "dex2oatd", - "imgdiag", - "imgdiagd", -] - -// Debug binaries for which the "first" version is preferred. -art_debug_binaries_first = [ - "dexanalyze", - "dexoptanalyzerd", - "oatdumpd", - "profmand", -] - -// Core Java libraries. -// This list must be the same as art-bootclasspath-fragment because it's that which is pulled in -// through bootclasspath_fragments below. (com.android.art-defaults-minus-odrefresh) -libcore_java_libs = [ - "core-oj", - "core-libart", - "okhttp", - "bouncycastle", - "apache-xml", -] - // Create combined library which is used for compiling run-tests. // This is much easier than trying to make the test depend on them directly, // or than trying to make the test compilation depend on the apex module. @@ -110,37 +19,19 @@ libcore_java_libs = [ java_library { name: "art-run-test-bootclasspath", sdk_version: "core_platform", - static_libs: libcore_java_libs + [ + static_libs: [ "framework-annotations-lib", + // Core Java libraries. This list must be the same as + // art-bootclasspath-fragment because it's that which is pulled in + // through bootclasspath_fragments in com.android-art-base-defaults. + "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 ART 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_ART_APEX_DEPENDENCY_LIBS` in -// `art/Android.mk`. -// TODO(b/121117762): Remove this note when both the ART Buildbot and Golem use -// the ART APEX. -libcore_native_shared_libs = [ - // External API (having APEX stubs). - "libandroidio", - // This library is loaded at runtime from libart but cannot be a runtime_lib - // dependency from there because of cyclic dependencies (b/124505714). - "libopenjdk", - // These libraries are internal dependencies in libcore, but they don't get - // pulled in automatically into apex_test modules. - "libexpat", - "libopenjdkjvm", -] -libcore_debug_native_shared_libs = [ - "libopenjdkd", -] - android_app_certificate { name: "com.android.art.certificate", certificate: "com.android.art", @@ -187,12 +78,63 @@ apex_defaults { compile_multilib: "both", + // Note: ART Golem benchmarking does not use the ART APEX, meaning that + // copies of some of these libraries have to be installed in `/system` for + // the setup to work properly. This is done by the `standalone-apex-files` + // Make phony target (see `art/Android.mk`). If you add libraries to this + // list, you may have to also add them to `PRIVATE_ART_APEX_DEPENDENCY_LIBS` + // in `art/Android.mk`. + native_shared_libs: [ + // ART + // External API (having APEX stubs). + "libdexfile", + "libnativebridge", + "libnativehelper", + "libnativeloader", + "libsigchain", + // These libraries are loaded at runtime from libart (either through + // dlopen() or by instructing the user to load with -Xplugin), but they + // cannot be runtime_lib dependencies from there because of cyclic + // dependencies (b/124505714). + "libadbconnection", + "libopenjdkjvmti", + "libperfetto_hprof", + // Likewise libart is loaded at runtime from libnativeloader and also must + // be specified explicitly due to cyclic dependencies. However, it's not + // listed directly here since test_broken_com.android.art uses a different + // implementation. + + // Libcore + // External API (having APEX stubs). + "libandroidio", + // This library is loaded at runtime from libart but cannot be a runtime_lib + // dependency from there because of cyclic dependencies (b/124505714). + "libopenjdk", + // These libraries are internal dependencies in libcore, but they don't get + // pulled in automatically into apex_test modules. + "libexpat", + "libopenjdkjvm", + ], + multilib: { both: { - binaries: art_runtime_binaries_both, + binaries: [ + "dalvikvm", + "dex2oat", + ], }, first: { - binaries: art_runtime_binaries_first, + binaries: [ + "art_boot", + "art_exec", + "artd", + "dexdump", + "dexlist", + "dexopt_chroot_setup", + "dexoptanalyzer", + "oatdump", + "profman", + ], jni_libs: [ "libartservice", ], @@ -200,44 +142,33 @@ apex_defaults { }, } -// Default values shared by APEXes except test_broken_com.android.art. +// Default values shared by Debug and Testing ART APEXes. apex_defaults { - name: "com.android.art-defaults-minus-odrefresh", + name: "com.android.art-devel-defaults", defaults: ["com.android.art-base-defaults"], - native_shared_libs: art_runtime_base_native_shared_libs + - libcore_native_shared_libs, -} -// Default values shared by Release, Debug, and Testing APEXes. -apex_defaults { - name: "com.android.art-defaults", - defaults: ["com.android.art-defaults-minus-odrefresh"], - multilib: { - first: { - binaries: ["odrefresh"], - }, - }, -} + native_shared_libs: [ + "libadbconnectiond", + "libdexfiled", + "libopenjdkd", + "libopenjdkjvmtid", + "libperfetto_hprofd", + ], -// Default values shared by Debug and Testing ART APEXes. -apex_defaults { - name: "com.android.art-devel-defaults", - defaults: ["com.android.art-defaults"], - // Use a different manifest for the Debug & Testing ART APEXes (which have - // no prebuilts and are thus always built from sources), with a high version - // number that ensures that these packages can be installed on virtually all - // Android dessert releases. - manifest: "manifest-art-debug.json", - native_shared_libs: art_runtime_debug_native_shared_libs + - libcore_debug_native_shared_libs, multilib: { both: { - binaries: art_debug_binaries_both, + binaries: [ + "dex2oatd", + "imgdiag", + "imgdiagd", + ], }, first: { - binaries: art_debug_binaries_first, - jni_libs: [ - "libartserviced", + binaries: [ + "dexanalyze", + "dexoptanalyzerd", + "oatdumpd", + "profmand", ], }, }, @@ -248,42 +179,48 @@ apex_defaults { apex_test { name: "test_broken_com.android.art", defaults: ["com.android.art-base-defaults"], - - native_shared_libs: art_runtime_base_broken_native_shared_libs + libcore_native_shared_libs, - unwanted_transitive_deps: ["libart"], - manifest: "test_apex_manifest.json", file_contexts: ":com.android.art-file_contexts", installable: false, compressible: false, + + native_shared_libs: ["libart-broken"], + unwanted_transitive_deps: ["libart"], } apex_test { name: "test_jitzygote_com.android.art", - defaults: ["com.android.art-defaults-minus-odrefresh"], + defaults: ["com.android.art-base-defaults"], + manifest: "test_apex_manifest.json", + file_contexts: ":com.android.art-file_contexts", + installable: false, + + native_shared_libs: ["libart"], multilib: { first: { binaries: ["odrefresh_broken"], }, }, - manifest: "test_apex_manifest.json", - file_contexts: ":com.android.art-file_contexts", - installable: false, } // Same as "com.android.art" APEX, but also contains "imgdiag" binary. // Used to collect dirty-image-objects. apex_test { name: "test_imgdiag_com.android.art", - defaults: ["com.android.art-defaults"], + defaults: ["com.android.art-base-defaults"], + manifest: "test_apex_manifest.json", + file_contexts: ":com.android.art-file_contexts", + installable: false, + + native_shared_libs: ["libart"], multilib: { both: { binaries: ["imgdiag"], }, + first: { + binaries: ["odrefresh"], + }, }, - manifest: "test_apex_manifest.json", - file_contexts: ":com.android.art-file_contexts", - installable: false, } // Release version of the ART APEX module (not containing debug @@ -291,7 +228,15 @@ apex_test { // storage-constrained devices in userdebug and eng builds. apex { name: "com.android.art", - defaults: ["com.android.art-defaults"], + defaults: ["com.android.art-base-defaults"], + + native_shared_libs: ["libart"], + multilib: { + first: { + binaries: ["odrefresh"], + }, + }, + visibility: [ "//art/build/sdk", "//packages/modules/common/build", @@ -304,6 +249,23 @@ apex { apex { name: "com.android.art.debug", defaults: ["com.android.art-devel-defaults"], + // Use a different manifest for this APEX (which has no prebuilts and is + // thus always built from sources), with a high version number that ensures + // that these packages can be installed on virtually all Android dessert + // releases. + manifest: "manifest-art-debug.json", + + native_shared_libs: [ + "libart", + "libartd", + ], + multilib: { + first: { + binaries: ["odrefresh"], + jni_libs: ["libartserviced"], + }, + }, + visibility: [ "//packages/modules/common/build", ], @@ -344,6 +306,11 @@ apex_test { file_contexts: ":com.android.art.debug-file_contexts", tests: art_gtests, binaries: ["signal_dumper"], // Need signal_dumper for run-tests. + // Use a different manifest for this APEX (which has no prebuilts and is + // thus always built from sources), with a high version number that ensures + // that these packages can be installed on virtually all Android dessert + // releases. + manifest: "manifest-art-debug.json", // Mark this test APEX as non-updatable, as its contains // additional files (used only for testing) that would not pass // dependency checks performed on updatable APEXes (see @@ -359,9 +326,16 @@ apex_test { // and b/233357459). Marking this APEX as "future updatable" // disables all symlink optimizations for it. future_updatable: true, + + native_shared_libs: [ + "libart", + "libartd", + ], multilib: { first: { tests: art_gtests_first, + binaries: ["odrefresh"], + jni_libs: ["libartserviced"], }, }, } |