From acb33e0b6582bebbbeeb7028b9257f373b5fcbcc Mon Sep 17 00:00:00 2001 From: Ulya Trafimovich Date: Fri, 1 Nov 2019 17:57:29 +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: If2d4fe2cdcb6a81c7c6d730d18c2b681a74fb0b7 --- java/dexpreopt_bootjars.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go index 2a142baee..508443a7e 100644 --- a/java/dexpreopt_bootjars.go +++ b/java/dexpreopt_bootjars.go @@ -123,6 +123,10 @@ func dexpreoptBootJarsFactory() android.Singleton { } func skipDexpreoptBootJars(ctx android.PathContext) bool { + if dexpreoptGlobalConfig(ctx).DisablePreopt { + return true + } + if ctx.Config().UnbundledBuild() { return true }