From d5cce4c3602524e10d3b0558b8f92c4096596344 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 27 Oct 2017 16:10:18 -0700 Subject: [PATCH] Remove PRODUCT_AAPT2_CFLAGS and PRODUCT_AAPT_FLAGS PRODUCT_AAPT2_CFLAGS and PRODUCT_AAPT_FLAGS are only used to pass --pseudo-localize. The flag doesn't need to be conditional on the product, because the pseudo locale will be stripped out later if it is not wanted. Having it conditional on the product causes the AAPT2-compiled resources to vary between products, which causes unnecessary rebuilds when swithcing products. Remove the variables, always add --pseudo-localize, and move the AAPT2 compiled output to the common intermediates. Test: m checkbuild Change-Id: Iacc914114616b5bd19d9a1011802f4f9bca9bc19 --- CleanSpec.mk | 2 ++ core/aapt2.mk | 4 +++- core/dpi_specific_apk.mk | 2 +- core/package_internal.mk | 2 +- core/product_config.mk | 9 --------- 5 files changed, 7 insertions(+), 12 deletions(-) diff --git a/CleanSpec.mk b/CleanSpec.mk index 23eba4f25b..3ba1f45e93 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -442,6 +442,8 @@ $(call add-clean-step, rm -f $(OUT_DIR)/target/common/obj/*/*_intermediates/java $(call add-clean-step, rm -rf $(OUT_DIR)/host/common/obj/*/*_intermediates/src) $(call add-clean-step, rm -f $(OUT_DIR)/host/common/obj/*/*_intermediates/java-source-list) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*/flat-res) + # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ diff --git a/core/aapt2.mk b/core/aapt2.mk index c7cae44596..8bb2d4b4a8 100644 --- a/core/aapt2.mk +++ b/core/aapt2.mk @@ -47,8 +47,10 @@ $(my_generated_resources_flata) : $(my_generated_res_dirs_deps) $(AAPT2) my_generated_resources_flata += $(my_generated_resources_flata) endif +# Always set --pseudo-localize, it will be stripped out later for release +# builds that don't want it. $(my_res_resources_flat) $(my_overlay_resources_flat) $(my_generated_resources_flata): \ - PRIVATE_AAPT2_CFLAGS := $(PRODUCT_AAPT2_CFLAGS) + PRIVATE_AAPT2_CFLAGS := --pseudo-localize my_static_library_resources := $(foreach l, $(call reverse-list,$(LOCAL_STATIC_ANDROID_LIBRARIES)),\ $(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/package-res.apk) diff --git a/core/dpi_specific_apk.mk b/core/dpi_specific_apk.mk index 18c8d6e772..ac5c4a916b 100644 --- a/core/dpi_specific_apk.mk +++ b/core/dpi_specific_apk.mk @@ -9,7 +9,7 @@ additional_certificates := $(foreach c,$(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x5 # Set up all the target-specific variables. $(built_dpi_apk): PRIVATE_MODULE := $(dpi_apk_name) -$(built_dpi_apk): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) $(PRODUCT_AAPT_FLAGS) $($(LOCAL_PACKAGE_NAME)_aapt_flags_$(my_dpi)) +$(built_dpi_apk): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --pseudo-localize $($(LOCAL_PACKAGE_NAME)_aapt_flags_$(my_dpi)) # Clear PRIVATE_PRODUCT_AAPT_CONFIG to include everything by default. $(built_dpi_apk): PRIVATE_PRODUCT_AAPT_CONFIG := $(built_dpi_apk): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(my_dpi) diff --git a/core/package_internal.mk b/core/package_internal.mk index 01e246366f..16563afab5 100644 --- a/core/package_internal.mk +++ b/core/package_internal.mk @@ -353,7 +353,7 @@ installed_apk_splits := $(foreach s,$(my_split_suffixes),$(my_module_path)/$(LOC endif ifdef LOCAL_USE_AAPT2 -my_compiled_res_base_dir := $(intermediates)/flat-res +my_compiled_res_base_dir := $(intermediates.COMMON)/flat-res renderscript_target_api := ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API)) renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API) diff --git a/core/product_config.mk b/core/product_config.mk index 04f02da5a4..d7881df0ba 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -295,15 +295,6 @@ PRODUCT_AAPT_CONFIG_SP := $(PRODUCT_AAPT_CONFIG) PRODUCT_AAPT_CONFIG := \ $(subst $(space),$(comma),$(strip $(PRODUCT_AAPT_CONFIG))) -# product-scoped aapt flags -PRODUCT_AAPT_FLAGS := -PRODUCT_AAPT2_CFLAGS := -ifneq ($(filter en_XA ar_XB,$(PRODUCT_LOCALES)),) - # Force generating resources for pseudo-locales. - PRODUCT_AAPT2_CFLAGS += --pseudo-localize - PRODUCT_AAPT_FLAGS += --pseudo-localize -endif - PRODUCT_BRAND := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_BRAND)) PRODUCT_MODEL := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_MODEL))