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
This commit is contained in:
Adam Lesinski 2017-03-16 04:53:05 +00:00
parent 7932676215
commit 981de838d4
3 changed files with 9 additions and 2 deletions

View File

@ -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 $@"

View File

@ -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)) \

View File

@ -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