From 36b5d1cd47c5f54406c0e01dbf04af649d42f0df Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 15 Feb 2019 12:59:09 -0800 Subject: [PATCH] Update calls to dexpreopt_gen dexpreopt_gen now requires a -out_dir argument, and does not need DexPath, StripInputPath and StripOutputPath set. Also use paths to Soong binaries for dex2oat, profman and aapt so that they can be loaded as Path objects in Soong, and let Soong handle the default for BootImageProfiles. This reapplies I97b1865fd98d5108d9c63ff7a90a5591c7622526 with fixes to disable preopt for Soong-only builds when the global dexpreopt.config doesn't exist. Test: m checkbuild Change-Id: I5af9b749235823b7e1cfcfc55e121bfec413fb2f --- core/dex_preopt_config.mk | 36 +++++++++------------------------ core/dex_preopt_odex_install.mk | 9 +++++---- core/soong_config.mk | 4 ---- 3 files changed, 15 insertions(+), 34 deletions(-) diff --git a/core/dex_preopt_config.mk b/core/dex_preopt_config.mk index 592e7fbfd..72d3345a8 100644 --- a/core/dex_preopt_config.mk +++ b/core/dex_preopt_config.mk @@ -47,9 +47,9 @@ endif # Default to debug version to help find bugs. # Set USE_DEX2OAT_DEBUG to false for only building non-debug versions. ifeq ($(USE_DEX2OAT_DEBUG),false) -DEX2OAT := $(HOST_OUT_EXECUTABLES)/dex2oat$(HOST_EXECUTABLE_SUFFIX) +DEX2OAT := $(SOONG_HOST_OUT_EXECUTABLES)/dex2oat$(HOST_EXECUTABLE_SUFFIX) else -DEX2OAT := $(HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX) +DEX2OAT := $(SOONG_HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX) endif DEX2OAT_DEPENDENCY += $(DEX2OAT) @@ -62,25 +62,6 @@ PRELOADED_CLASSES := $(call word-colon,1,$(firstword \ DIRTY_IMAGE_OBJECTS := $(call word-colon,1,$(firstword \ $(filter %system/etc/dirty-image-objects,$(PRODUCT_COPY_FILES)))) -# If we use a boot image profile. -my_use_profile_for_boot_image := $(PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE) -ifeq (,$(my_use_profile_for_boot_image)) - # If not set, set the default to true if we are not a PDK build. PDK builds - # can't build the profile since they don't have frameworks/base. - ifneq (true,$(TARGET_BUILD_PDK)) - my_use_profile_for_boot_image := true - endif -endif - -ifeq (true,$(my_use_profile_for_boot_image)) - boot_image_profiles := $(PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION) - - ifeq (,$(boot_image_profiles)) - # If not set, use the default. - boot_image_profiles := frameworks/base/config/boot-image-profile.txt - endif -endif - define get-product-default-property $(strip \ $(eval _prop := $(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))))\ @@ -107,6 +88,7 @@ ifeq ($(WRITE_SOONG_VARIABLES),true) $(call json_start) $(call add_json_bool, DefaultNoStripping, $(filter nostripping,$(DEX_PREOPT_DEFAULT))) + $(call add_json_bool, DisablePreopt, $(call invert_bool,$(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, DontUncompressPrivAppsDex, $(filter true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS))) @@ -114,6 +96,7 @@ ifeq ($(WRITE_SOONG_VARIABLES),true) $(call add_json_bool, HasSystemOther, $(BOARD_USES_SYSTEM_OTHER_ODEX)) $(call add_json_list, PatternsOnSystemOther, $(SYSTEM_OTHER_ODEX_FILTER)) $(call add_json_bool, DisableGenerateProfile, $(filter false,$(WITH_DEX_PREOPT_GENERATE_PROFILE))) + $(call add_json_str, ProfileDir, $(PRODUCT_DEX_PREOPT_PROFILE_DIR)) $(call add_json_list, BootJars, $(PRODUCT_BOOT_JARS)) $(call add_json_list, RuntimeApexJars, $(RUNTIME_APEX_JARS)) $(call add_json_list, ProductUpdatableBootModules, $(PRODUCT_UPDATABLE_BOOT_MODULES)) @@ -155,15 +138,16 @@ ifeq ($(WRITE_SOONG_VARIABLES),true) $(call add_json_str, DirtyImageObjects, $(DIRTY_IMAGE_OBJECTS)) $(call add_json_str, PreloadedClasses, $(PRELOADED_CLASSES)) - $(call add_json_list, BootImageProfiles, $(boot_image_profiles)) + $(call add_json_list, BootImageProfiles, $(PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION)) + $(call add_json_bool, UseProfileForBootImage, $(call invert_bool,$(filter false,$(PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE)))) $(call add_json_str, BootFlags, $(PRODUCT_DEX_PREOPT_BOOT_FLAGS)) $(call add_json_str, Dex2oatImageXmx, $(DEX2OAT_IMAGE_XMX)) $(call add_json_str, Dex2oatImageXms, $(DEX2OAT_IMAGE_XMS)) $(call add_json_map, Tools) - $(call add_json_str, Profman, $(PROFMAN)) + $(call add_json_str, Profman, $(SOONG_HOST_OUT_EXECUTABLES)/profman) $(call add_json_str, Dex2oat, $(DEX2OAT)) - $(call add_json_str, Aapt, $(AAPT)) + $(call add_json_str, Aapt, $(SOONG_HOST_OUT_EXECUTABLES)/aapt) $(call add_json_str, SoongZip, $(SOONG_ZIP)) $(call add_json_str, Zip2zip, $(ZIP2ZIP)) $(call add_json_str, VerifyUsesLibraries, $(BUILD_SYSTEM)/verify_uses_libraries.sh) @@ -190,9 +174,9 @@ $(DEX_PREOPT_CONFIG): @#empty DEXPREOPT_GEN_DEPS := \ - $(PROFMAN) \ + $(SOONG_HOST_OUT_EXECUTABLES)/profman \ $(DEX2OAT) \ - $(AAPT) \ + $(SOONG_HOST_OUT_EXECUTABLES)/aapt \ $(SOONG_ZIP) \ $(ZIP2ZIP) \ $(BUILD_SYSTEM)/verify_uses_libraries.sh \ diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk index 0beead90c..bda871c6a 100644 --- a/core/dex_preopt_odex_install.mk +++ b/core/dex_preopt_odex_install.mk @@ -190,10 +190,12 @@ ifdef LOCAL_DEX_PREOPT $(call json_start) + # DexPath, StripInputPath, and StripOutputPath are not set, they will + # be filled in by dexpreopt_gen. + $(call add_json_str, Name, $(LOCAL_MODULE)) $(call add_json_str, DexLocation, $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE))) $(call add_json_str, BuildPath, $(LOCAL_BUILT_MODULE)) - $(call add_json_str, DexPath, $$1) $(call add_json_str, ExtrasOutputPath, $$2) $(call add_json_bool, Privileged, $(filter true,$(LOCAL_PRIVILEGED_MODULE))) $(call add_json_bool, UncompressedDex, $(filter true,$(LOCAL_UNCOMPRESS_DEX))) @@ -218,8 +220,6 @@ ifdef LOCAL_DEX_PREOPT $(call add_json_bool, PresignedPrebuilt, $(filter PRESIGNED,$(LOCAL_CERTIFICATE))) $(call add_json_bool, NoStripping, $(filter nostripping,$(LOCAL_DEX_PREOPT))) - $(call add_json_str, StripInputPath, $$1) - $(call add_json_str, StripOutputPath, $$2) $(call json_end) @@ -244,7 +244,8 @@ ifdef LOCAL_DEX_PREOPT $(my_dexpreopt_script): $(my_dexpreopt_config) $(PRODUCT_OUT)/dexpreopt.config @echo "$(PRIVATE_MODULE) dexpreopt gen" $(DEXPREOPT_GEN) -global $(PRIVATE_GLOBAL_CONFIG) -module $(PRIVATE_MODULE_CONFIG) \ - -dexpreopt_script $@ -strip_script $(PRIVATE_STRIP_SCRIPT) + -dexpreopt_script $@ -strip_script $(PRIVATE_STRIP_SCRIPT) \ + -out_dir $(OUT_DIR) my_dexpreopt_deps := $(my_dex_jar) my_dexpreopt_deps += $(if $(my_process_profile),$(LOCAL_DEX_PREOPT_PROFILE)) diff --git a/core/soong_config.mk b/core/soong_config.mk index 1fb0c29c6..e1154fda1 100644 --- a/core/soong_config.mk +++ b/core/soong_config.mk @@ -116,10 +116,6 @@ $(call add_json_list, ModulesLoadedByPrivilegedModules, $(PRODUCT_LOADED_BY_PRI $(call add_json_list, BootJars, $(PRODUCT_BOOT_JARS)) $(call add_json_list, PreoptBootJars, $(DEXPREOPT_BOOT_JARS_MODULES)) -$(call add_json_bool, DisableDexPreopt, $(call invert_bool,$(filter true,$(WITH_DEXPREOPT)))) -$(call add_json_list, DisableDexPreoptModules, $(DEXPREOPT_DISABLED_MODULES)) -$(call add_json_str, DexPreoptProfileDir, $(PRODUCT_DEX_PREOPT_PROFILE_DIR)) - $(call add_json_bool, Product_is_iot, $(filter true,$(PRODUCT_IOT))) $(call add_json_bool, Treble_linker_namespaces, $(filter true,$(PRODUCT_TREBLE_LINKER_NAMESPACES)))