From 5877cec1fa798bf87e1a6b76062c6b23250a7dad Mon Sep 17 00:00:00 2001 From: Ulya Trafimovich Date: Fri, 1 Nov 2019 17:50:51 +0000 Subject: [PATCH] Disable dexpreopt on targets that do not include default ART config. Dexpreopt build commands should only be generated on targets that include build/make/target/product/runtime_libart.mk, which sets the necessary variables such as PRODUCT_SYSTEM_DEFAULT_PROPERTIES that contain default values passed to dex2oat. This file also sets a variable PRODUCT_USES_DEFAULT_ART_CONFIG that is used in build/make/core/dex_preopt.mk to decide if boot images should be installed. On some targets build/make/target/product/runtime_libart.mk is not included. Prior to this patch, on such targets invalid dexpreopt commands were generated, but not used, so they did not cause any visible build failures. The invalid commands can be grepped as: lunch qemu_trusty_arm64-userdebug && m nothing \ && fgrep -e '-Xms ' $ANDROID_BUILD_TOP/out/soong/build.ninja In this case '-Xms ' is an ill-formed option passed to dex2oat (the option expects one argument, but none is passed). This patch makes the DisablePreopt variable passed from make to soong more strict: it not only requires WITH_DEXPREOPT, but also PRODUCT_USES_DEFAULT_ART_CONFIG. This means that dexpreopt commands will not be generated on targets that do not include build/make/target/product/runtime_libart.mk. Test: lunch aosp_walleye-userdebug && m \ && find $ANDROID_BUILD_TOP/out -name 'boot.art' # expect to find files in /out/target/product/walleye/system/framework/$ARCH/ Test: lunch qemu_trusty_arm64-userdebug && m \ && fgrep -e '-Xms ' $ANDROID_BUILD_TOP/out/soong/build.ninja # expect empty output Change-Id: I3d765ed0dd8b38236b8bdd5c6202bb1d3f45f904 --- core/dex_preopt_config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/dex_preopt_config.mk b/core/dex_preopt_config.mk index 387581533d..64ad8d9a3c 100644 --- a/core/dex_preopt_config.mk +++ b/core/dex_preopt_config.mk @@ -80,7 +80,7 @@ ifeq ($(WRITE_SOONG_VARIABLES),true) $(call json_start) - $(call add_json_bool, DisablePreopt, $(call invert_bool,$(filter true,$(WITH_DEXPREOPT)))) + $(call add_json_bool, DisablePreopt, $(call invert_bool,$(and $(filter true,$(PRODUCT_USES_DEFAULT_ART_CONFIG)),$(filter true,$(WITH_DEXPREOPT))))) $(call add_json_list, DisablePreoptModules, $(DEXPREOPT_DISABLED_MODULES)) $(call add_json_bool, OnlyPreoptBootImageAndSystemServer, $(filter true,$(WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY))) $(call add_json_bool, GenerateApexImage, $(filter true,$(DEXPREOPT_GENERATE_APEX_IMAGE)))