From c481de01b7c27e183db42f571a9ad9a823a65323 Mon Sep 17 00:00:00 2001 From: Martin Stjernholm Date: Wed, 16 Dec 2020 02:55:18 +0000 Subject: [PATCH] Move ART APEX selection logic to core make. It's moved from art/Android.mk that won't be available in platform builds without ART sources. This also ensures we depend on com.android.art directly on PRODUCT_PACKAGES and not through LOCAL_REQUIRED_MODULES which was the case in com.android.art-autoselect. When com.android.art is overridden through an `overrides` field, the logic in main.mk drops it from PRODUCT_PACKAGES, but it doesn't consider overrides when processing LOCAL_REQUIRED_MODULES dependencies. Bug: 172480617 Test: `m` with PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD set to true and false Test: `m` on userdebug and eng builds Change-Id: Ia606de691fe20ac19f2ca9af362408606e71b11c --- target/product/runtime_libart.mk | 41 ++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk index d3da8fe53..b588c781c 100644 --- a/target/product/runtime_libart.mk +++ b/target/product/runtime_libart.mk @@ -30,10 +30,43 @@ PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += com.android.runtime # ART APEX module. -# Note that this package includes the minimal boot classpath JARs (listed in -# ART_APEX_JARS), which should no longer be added directly to PRODUCT_PACKAGES. -PRODUCT_PACKAGES += com.android.art-autoselect -PRODUCT_HOST_PACKAGES += com.android.art-autoselect +# +# Select either release (com.android.art) or debug (com.android.art.debug) +# variant of the ART APEX. By default, "user" build variants contain the release +# module, while the "eng" build variant contain the debug module. However, if +# `PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD` is defined, it overrides the previous +# logic: +# - if `PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD` is set to `false`, the +# build will include the release module (whatever the build +# variant); +# - if `PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD` is set to `true`, the +# build will include the debug module (whatever the build variant). +# +# Note that the ART APEX package includes the minimal boot classpath JARs +# (listed in ART_APEX_JARS), which should no longer be added directly to +# PRODUCT_PACKAGES. + +art_target_include_debug_build := $(PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD) +ifneq (false,$(art_target_include_debug_build)) + ifneq (,$(filter eng,$(TARGET_BUILD_VARIANT))) + art_target_include_debug_build := true + endif +endif + +ifeq (true,$(art_target_include_debug_build)) + PRODUCT_PACKAGES += com.android.art.debug + apex_test_module := art-check-debug-apex-gen-fakebin +else + PRODUCT_PACKAGES += com.android.art + apex_test_module := art-check-release-apex-gen-fakebin +endif + +ifeq (true,$(SOONG_CONFIG_art_module_source_build) + PRODUCT_HOST_PACKAGES += $(apex_test_module) +endif + +art_target_include_debug_build := +apex_test_module := # Certificates. PRODUCT_PACKAGES += \