From d9d72c46ba5b5b1ff76b9075f0531f51faadb7b6 Mon Sep 17 00:00:00 2001 From: Spandan Das Date: Thu, 6 Jun 2024 22:47:01 +0000 Subject: [PATCH] Prevent implicit outputs created during dexpreopt_config.zip $PRODUCT_OUT/dexpreopt_config.zip is created by zipping all the dexpreopt configs of individual apps. These config files are created in $PRODUCT_OUT/dexpreopt_config, and this dir is as used as -C for soong_zip. In the current implementation, this build action also implicitly copies global configuration files dexpreopt.config and dexpreopt_soong.config into $PRODUCT_OUT/dexpreopt_config with the intent of being included in the resultant zip file. These implicit outputs are unknown to ninja. This CL prevents creation of these implicit outputs. out/soong/dexpreopt_soong.config and out/soong/dexpreopt_/dexpreopt.config is now passed directly to soong_zip via -f. Bug: 333316620 Test: m out/target/product/vsoc_x86_64/dexpreopt_config.zip # no longer bit identical since the relative order changes, dexpreopt(_soong).config now appears at the bottom of the zip Test: zipcmp dexpreopt_config.zip.before dexpreopt_config.zip.after # no diffs Change-Id: Ib30c9a5c436e263231f9688129ab94664277b841 --- CleanSpec.mk | 4 ++++ core/Makefile | 13 +++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CleanSpec.mk b/CleanSpec.mk index f8c96ffffe..f56227955a 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -787,6 +787,10 @@ $(call add-clean-step, find $(OUT_DIR) -type f -name "*.jar" -print0 | xargs -0 $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/) $(call add-clean-step, find $(OUT_DIR) -type f -name "*.jar" -print0 | xargs -0 rm -f) +# Remove obsolete dexpreopt_config artifacts +$(call add-clean-step, rm -f $(PRODUCT_OUT)/dexpreopt_config/dexpreopt.config) +$(call add-clean-step, rm -f $(PRODUCT_OUT)/dexpreopt_config/dexpreopt_soong.config) + # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ diff --git a/core/Makefile b/core/Makefile index 98454371cc..a16365dcb4 100644 --- a/core/Makefile +++ b/core/Makefile @@ -7055,18 +7055,19 @@ $(DEXPREOPT_CONFIG_ZIP): $(DEX_PREOPT_CONFIG_FOR_MAKE) \ endif -$(DEXPREOPT_CONFIG_ZIP): $(SOONG_ZIP) - $(hide) mkdir -p $(dir $@) $(PRODUCT_OUT)/dexpreopt_config - +$(DEXPREOPT_CONFIG_ZIP): PRIVATE_DEXPREOPT_CONFIG_ZIP_PARAMS := ifeq (,$(TARGET_BUILD_UNBUNDLED)) ifneq (,$(DEX_PREOPT_CONFIG_FOR_MAKE)) - $(hide) cp $(DEX_PREOPT_CONFIG_FOR_MAKE) $(PRODUCT_OUT)/dexpreopt_config +$(DEXPREOPT_CONFIG_ZIP): PRIVATE_DEXPREOPT_CONFIG_ZIP_PARAMS += -e $(notdir $(DEX_PREOPT_CONFIG_FOR_MAKE)) -f $(DEX_PREOPT_CONFIG_FOR_MAKE) endif ifneq (,$(DEX_PREOPT_SOONG_CONFIG_FOR_MAKE)) - $(hide) cp $(DEX_PREOPT_SOONG_CONFIG_FOR_MAKE) $(PRODUCT_OUT)/dexpreopt_config +$(DEXPREOPT_CONFIG_ZIP): PRIVATE_DEXPREOPT_CONFIG_ZIP_PARAMS += -e $(notdir $(DEX_PREOPT_SOONG_CONFIG_FOR_MAKE)) -f $(DEX_PREOPT_SOONG_CONFIG_FOR_MAKE) endif endif #!TARGET_BUILD_UNBUNDLED - $(hide) $(SOONG_ZIP) -d -o $@ -C $(PRODUCT_OUT)/dexpreopt_config -D $(PRODUCT_OUT)/dexpreopt_config + +$(DEXPREOPT_CONFIG_ZIP): $(SOONG_ZIP) + $(hide) mkdir -p $(dir $@) $(PRODUCT_OUT)/dexpreopt_config + $(hide) $(SOONG_ZIP) -d -o $@ -C $(PRODUCT_OUT)/dexpreopt_config -D $(PRODUCT_OUT)/dexpreopt_config $(PRIVATE_DEXPREOPT_CONFIG_ZIP_PARAMS) .PHONY: dexpreopt_config_zip dexpreopt_config_zip: $(DEXPREOPT_CONFIG_ZIP)