From 4f1ab92aac00a73276793ed25af669d112618a32 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Tue, 15 Mar 2011 13:19:30 -0700 Subject: [PATCH] Move screen density config from PRODUCT_LOCALES to PRODUCT_AAPT_CONFIG With this change, PRODUCT_LOCALES will contain only locales. Other aapt config flags, such as *dpi, small/normal/large/xlarge, should go to PRODUCT_AAPT_CONFIGS. Bug: 4086309 Change-Id: I922f153d79777a9522c542a3907111193b40e7b7 --- core/cleanbuild.mk | 8 ++++---- core/definitions.mk | 6 +++--- core/package.mk | 8 +++++--- core/product.mk | 1 + core/product_config.mk | 17 +++++++++-------- 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/core/cleanbuild.mk b/core/cleanbuild.mk index 821b03a26..2639caec2 100644 --- a/core/cleanbuild.mk +++ b/core/cleanbuild.mk @@ -117,13 +117,13 @@ else building_sdk := endif -# A change in the list of locales warrants an installclean, too. -locale_list := $(subst $(space),$(comma),$(strip $(PRODUCT_LOCALES))) +# A change in the list of aapt configs warrants an installclean, too. +aapt_config_list := $(strip $(PRODUCT_AAPT_CONFIG)) current_build_config := \ - $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)$(building_sdk)-{$(locale_list)} + $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)$(building_sdk)-{$(aapt_config_list)} building_sdk := -locale_list := +aapt_config_list := force_installclean := false # Read the current state from the file, if present. diff --git a/core/definitions.mk b/core/definitions.mk index 120236206..3c710989c 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -1322,12 +1322,12 @@ endef # Maybe we should just use approach (1). # This rule creates the R.java and Manifest.java files, both of which -# are PRODUCT-neutral. Don't pass PRODUCT_AAPT_CONFIG to this invocation. +# are PRODUCT-neutral. Don't pass PRIVATE_PRODUCT_AAPT_CONFIG to this invocation. define create-resource-java-files @mkdir -p $(PRIVATE_SOURCE_INTERMEDIATES_DIR) @mkdir -p $(dir $(PRIVATE_RESOURCE_PUBLICS_OUTPUT)) $(hide) $(AAPT) package $(PRIVATE_AAPT_FLAGS) -m \ - $(eval # PRODUCT_AAPT_CONFIG is intentionally missing-- see comment.) \ + $(eval # PRIVATE_PRODUCT_AAPT_CONFIG is intentionally missing-- see comment.) \ $(addprefix -J , $(PRIVATE_SOURCE_INTERMEDIATES_DIR)) \ $(addprefix -M , $(PRIVATE_ANDROID_MANIFEST)) \ $(addprefix -P , $(PRIVATE_RESOURCE_PUBLICS_OUTPUT)) \ @@ -1539,7 +1539,7 @@ endef #them in their manifest. define add-assets-to-package $(hide) $(AAPT) package -u $(PRIVATE_AAPT_FLAGS) \ - $(addprefix -c , $(PRODUCT_AAPT_CONFIG)) \ + $(addprefix -c , $(PRIVATE_PRODUCT_AAPT_CONFIG)) \ $(addprefix -M , $(PRIVATE_ANDROID_MANIFEST)) \ $(addprefix -S , $(PRIVATE_RESOURCE_DIR)) \ $(addprefix -A , $(PRIVATE_ASSET_DIR)) \ diff --git a/core/package.mk b/core/package.mk index 8ca903379..87c5ae933 100644 --- a/core/package.mk +++ b/core/package.mk @@ -19,7 +19,7 @@ ## ## Additional inputs from base_rules.make: ## LOCAL_PACKAGE_NAME: The name of the package; the directory -## will be called this. +## will be called this. ## ## MODULE, MODULE_PATH, and MODULE_SUFFIX will ## be set for you. @@ -214,7 +214,7 @@ $(R_file_stamp): $(resource_export_package) # add-assets-to-package looks at PRODUCT_AAPT_CONFIG, but this target # can't know anything about PRODUCT. Clear it out just for this target. -$(resource_export_package): PRODUCT_AAPT_CONFIG := +$(resource_export_package): PRIVATE_PRODUCT_AAPT_CONFIG := $(resource_export_package): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT) @echo "target Export Resources: $(PRIVATE_MODULE) ($@)" $(create-empty-package) @@ -330,7 +330,9 @@ ifneq ($(TARGET_BUILD_APPS),) LOCAL_AAPT_INCLUDE_ALL_RESOURCES := true endif ifeq ($(LOCAL_AAPT_INCLUDE_ALL_RESOURCES),true) - $(LOCAL_BUILT_MODULE): PRODUCT_AAPT_CONFIG := + $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_CONFIG := +else + $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_CONFIG := $(PRODUCT_AAPT_CONFIG) endif $(LOCAL_BUILT_MODULE): $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest) @echo "target Package: $(PRIVATE_MODULE) ($@)" diff --git a/core/product.mk b/core/product.mk index cc62e10d1..7182b8187 100644 --- a/core/product.mk +++ b/core/product.mk @@ -63,6 +63,7 @@ _product_var_list := \ PRODUCT_NAME \ PRODUCT_MODEL \ PRODUCT_LOCALES \ + PRODUCT_AAPT_CONFIG \ PRODUCT_PACKAGES \ PRODUCT_DEVICE \ PRODUCT_MANUFACTURER \ diff --git a/core/product_config.mk b/core/product_config.mk index 433fae293..f03db3e26 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -226,17 +226,18 @@ ifneq (,$(extra_locales)) extra_locales := endif +# Add PRODUCT_LOCALES to PRODUCT_AAPT_CONFIG +PRODUCT_AAPT_CONFIG := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_AAPT_CONFIG)) +PRODUCT_AAPT_CONFIG := $(PRODUCT_LOCALES) $(PRODUCT_AAPT_CONFIG) + # Default to medium-density assets. -# (Can be overridden in the device config, e.g.: PRODUCT_LOCALES += hdpi) -PRODUCT_LOCALES := $(strip \ - $(PRODUCT_LOCALES) \ - $(if $(filter %dpi,$(PRODUCT_LOCALES)),,mdpi)) +# (Can be overridden in the device config, e.g.: PRODUCT_AAPT_CONFIG += hdpi) +PRODUCT_AAPT_CONFIG := $(strip \ + $(PRODUCT_AAPT_CONFIG) \ + $(if $(filter %dpi,$(PRODUCT_AAPT_CONFIG)),,mdpi)) # Everyone gets nodpi assets which are density-independent. -PRODUCT_LOCALES += nodpi - -# Assemble the list of options. -PRODUCT_AAPT_CONFIG := $(PRODUCT_LOCALES) +PRODUCT_AAPT_CONFIG += nodpi # Convert spaces to commas. comma := , -- 2.11.0