From a8056d6cb924ac61c5116c3e3eba1940aac4f647 Mon Sep 17 00:00:00 2001 From: Jeongik Cha Date: Wed, 7 Apr 2021 23:57:16 +0900 Subject: [PATCH] Store dexpreopt.config files to dexpreopt_config.zip To dexpreopt in post processing, store config files for dexpreopt Bug: 158843648 Test: m dist and check dexpreopt_config.zip Change-Id: I5c63a5ffc10023994b14e3a63f50defb9194739f --- core/Makefile | 16 ++++++++++++++++ core/dex_preopt_odex_install.mk | 5 +++++ core/main.mk | 1 + core/soong_app_prebuilt.mk | 9 +++++++++ core/soong_java_prebuilt.mk | 3 +++ 5 files changed, 34 insertions(+) diff --git a/core/Makefile b/core/Makefile index 7975d3a66..ac59b0863 100644 --- a/core/Makefile +++ b/core/Makefile @@ -5246,6 +5246,22 @@ $(APPCOMPAT_ZIP): $(SOONG_ZIP) $(hide) find $(PRODUCT_OUT)/appcompat | sort >$(PRIVATE_LIST_FILE) $(hide) $(SOONG_ZIP) -d -o $@ -C $(PRODUCT_OUT)/appcompat -l $(PRIVATE_LIST_FILE) +DEXPREOPT_CONFIG_ZIP := $(PRODUCT_OUT)/dexpreopt_config.zip +$(DEXPREOPT_CONFIG_ZIP): $(FULL_SYSTEMIMAGE_DEPS) \ + $(INTERNAL_RAMDISK_FILES) \ + $(INTERNAL_USERDATAIMAGE_FILES) \ + $(INTERNAL_VENDORIMAGE_FILES) \ + $(INTERNAL_PRODUCTIMAGE_FILES) \ + $(INTERNAL_SYSTEM_EXTIMAGE_FILES) \ + $(DEX_PREOPT_CONFIG_FOR_MAKE) \ + $(DEX_PREOPT_SOONG_CONFIG_FOR_MAKE) + +$(DEXPREOPT_CONFIG_ZIP): $(SOONG_ZIP) + $(hide) mkdir -p $(dir $@) $(PRODUCT_OUT)/dexpreopt_config + $(hide) cp $(DEX_PREOPT_CONFIG_FOR_MAKE) $(PRODUCT_OUT)/dexpreopt_config + $(hide) cp $(DEX_PREOPT_SOONG_CONFIG_FOR_MAKE) $(PRODUCT_OUT)/dexpreopt_config + $(hide) $(SOONG_ZIP) -d -o $@ -C $(PRODUCT_OUT)/dexpreopt_config -D $(PRODUCT_OUT)/dexpreopt_config + # ----------------------------------------------------------------- # A zip of the symbols directory. Keep the full paths to make it # more obvious where these files came from. diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk index e0f94bd41..4eeca2ba4 100644 --- a/core/dex_preopt_odex_install.mk +++ b/core/dex_preopt_odex_install.mk @@ -381,6 +381,7 @@ ifdef LOCAL_DEX_PREOPT $(call json_end) my_dexpreopt_config := $(intermediates)/dexpreopt.config + my_dexpreopt_config_for_postprocessing := $(PRODUCT_OUT)/dexpreopt_config/$(LOCAL_MODULE)_dexpreopt.config my_dexpreopt_script := $(intermediates)/dexpreopt.sh my_dexpreopt_zip := $(intermediates)/dexpreopt.zip my_dexpreopt_config_merger := $(BUILD_SYSTEM)/dex_preopt_config_merger.py @@ -410,6 +411,8 @@ ifdef LOCAL_DEX_PREOPT -dexpreopt_script $@ \ -out_dir $(OUT_DIR) + $(eval $(call copy-one-file,$(my_dexpreopt_config),$(my_dexpreopt_config_for_postprocessing))) + my_dexpreopt_deps := $(my_dex_jar) my_dexpreopt_deps += $(if $(my_process_profile),$(LOCAL_DEX_PREOPT_PROFILE)) my_dexpreopt_deps += \ @@ -445,10 +448,12 @@ ifdef LOCAL_DEX_PREOPT $(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD) $(LOCAL_INSTALLED_MODULE): $(my_dexpreopt_zip) + $(LOCAL_INSTALLED_MODULE): $(my_dexpreopt_config_for_postprocessing) $(my_all_targets): $(my_dexpreopt_zip) my_dexpreopt_config := my_dexpreopt_script := my_dexpreopt_zip := + my_dexpreopt_config_for_postprocessing := endif # LOCAL_DEX_PREOPT diff --git a/core/main.mk b/core/main.mk index 3362681b6..1c3a20e13 100644 --- a/core/main.mk +++ b/core/main.mk @@ -1694,6 +1694,7 @@ else ifeq (,$(TARGET_BUILD_UNBUNDLED)) $(PROGUARD_USAGE_ZIP) \ $(COVERAGE_ZIP) \ $(APPCOMPAT_ZIP) \ + $(DEXPREOPT_CONFIG_ZIP) \ $(INSTALLED_FILES_FILE) \ $(INSTALLED_FILES_JSON) \ $(INSTALLED_FILES_FILE_VENDOR) \ diff --git a/core/soong_app_prebuilt.mk b/core/soong_app_prebuilt.mk index 50ac93a96..295c290bf 100644 --- a/core/soong_app_prebuilt.mk +++ b/core/soong_app_prebuilt.mk @@ -13,6 +13,7 @@ # LOCAL_SOONG_JNI_LIBS_$(TARGET_ARCH) # LOCAL_SOONG_JNI_LIBS_$(TARGET_2ND_ARCH) # LOCAL_SOONG_JNI_LIBS_SYMBOLS +# LOCAL_SOONG_DEXPREOPT_CONFIG ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK)) $(call pretty-error,soong_app_prebuilt.mk may only be used from Soong) @@ -49,6 +50,14 @@ ifdef LOCAL_SOONG_CLASSES_JAR .PHONY: javac-check-$(LOCAL_MODULE) endif +ifdef LOCAL_SOONG_DEXPREOPT_CONFIG + my_dexpreopt_config := $(PRODUCT_OUT)/dexpreopt_config/$(LOCAL_MODULE)_dexpreopt.config + $(eval $(call copy-one-file,$(LOCAL_SOONG_DEXPREOPT_CONFIG), $(my_dexpreopt_config))) + $(LOCAL_BUILT_MODULE): $(my_dexpreopt_config) +endif + + + # Run veridex on product, system_ext and vendor modules. # We skip it for unbundled app builds where we cannot build veridex. module_run_appcompat := diff --git a/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk index c60017834..a94e12b04 100644 --- a/core/soong_java_prebuilt.mk +++ b/core/soong_java_prebuilt.mk @@ -151,6 +151,9 @@ endif # modules can find them. ifdef LOCAL_SOONG_DEXPREOPT_CONFIG $(eval $(call copy-one-file,$(LOCAL_SOONG_DEXPREOPT_CONFIG), $(call local-intermediates-dir,)/dexpreopt.config)) + my_dexpreopt_config := $(PRODUCT_OUT)/dexpreopt_config/$(LOCAL_MODULE)_dexpreopt.config + $(eval $(call copy-one-file,$(LOCAL_SOONG_DEXPREOPT_CONFIG), $(my_dexpreopt_config))) + $(LOCAL_BUILT_MODULE): $(my_dexpreopt_config) endif javac-check : $(full_classes_jar)