From 981de838d4d352ef32de5ae69c58f2ae04fd39ed Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Thu, 16 Mar 2017 04:53:05 +0000 Subject: [PATCH] Add LOCAL_ASSET_DIR support (-A) to aapt2 Although performing the inclusion of assets/ at a later stage is preferable, (since aapt just copies the files) do the easy thing and support what aapt did. In the future perhaps we can zip up the assets/ directories when also merging in the classes.dex. Bug: 35461578 Change-Id: I7d7fde43333ea6455c4a1b9113bd25e1d88b7dd5 Test: manual --- core/aapt2.mk | 8 ++++++-- core/definitions.mk | 1 + core/package_internal.mk | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/aapt2.mk b/core/aapt2.mk index 34f32e3bc..a10af67a9 100644 --- a/core/aapt2.mk +++ b/core/aapt2.mk @@ -5,6 +5,8 @@ # - my_res_resources # - my_overlay_resources # - my_compiled_res_base_dir +# - my_asset_dirs +# - my_full_asset_paths # - my_res_package # - R_file_stamp # - proguard_options_file @@ -66,8 +68,10 @@ $(my_res_package): PRIVATE_RES_FLAT := $(my_res_resources_flat) $(my_res_package): PRIVATE_OVERLAY_FLAT := $(my_static_library_resources) $(my_generated_resources_flata) $(my_overlay_resources_flat) $(my_res_package): PRIVATE_SHARED_ANDROID_LIBRARIES := $(my_shared_library_resources) $(my_res_package): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file) -$(my_res_package) : $(full_android_manifest) $(my_static_library_resources) $(my_shared_library_resources) -$(my_res_package) : $(my_res_resources_flat) $(my_overlay_resources_flat) \ +$(my_res_package): PRIVATE_ASSET_DIRS := $(my_asset_dirs) +$(my_res_package): $(full_android_manifest) $(my_static_library_resources) $(my_shared_library_resources) +$(my_res_package): $(my_full_asset_paths) +$(my_res_package): $(my_res_resources_flat) $(my_overlay_resources_flat) \ $(my_generated_resources_flata) $(my_static_library_resources) \ $(AAPT2) @echo "AAPT2 link $@" diff --git a/core/definitions.mk b/core/definitions.mk index 10ee29743..dc54bfe28 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -2110,6 +2110,7 @@ $(hide) $(AAPT2) link -o $@ \ $(addprefix --manifest ,$(PRIVATE_ANDROID_MANIFEST)) \ $(addprefix -I ,$(PRIVATE_AAPT_INCLUDES)) \ $(addprefix -I ,$(PRIVATE_SHARED_ANDROID_LIBRARIES)) \ + $(addprefix -A ,$(PRIVATE_ASSET_DIR)) \ $(addprefix --java ,$(PRIVATE_SOURCE_INTERMEDIATES_DIR)) \ $(addprefix --proguard ,$(PRIVATE_PROGUARD_OPTIONS_FILE)) \ $(addprefix --min-sdk-version ,$(PRIVATE_DEFAULT_APP_TARGET_SDK)) \ diff --git a/core/package_internal.mk b/core/package_internal.mk index b47b35182..b3d1620d1 100644 --- a/core/package_internal.mk +++ b/core/package_internal.mk @@ -355,6 +355,8 @@ ifdef LOCAL_USE_AAPT2 my_compiled_res_base_dir := $(intermediates)/flat-res my_generated_res_dirs := $(rs_generated_res_dir) my_generated_res_dirs_deps := $(RenderScript_file_stamp) +my_asset_dirs := $(LOCAL_ASSET_DIR) +my_full_asset_paths := $(all_assets) # Add AAPT2 link specific flags. $(my_res_package): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --no-static-lib-packages include $(BUILD_SYSTEM)/aapt2.mk