Allow passing --legacy in LOCAL_AAPT_FLAGS

--legacy will soon no longer be passed by default to all aapt2
compiles.  Allow it to be specified in LOCAL_AAPT_FLAGS by passing
it to aapt2 compile when it is present and filtering it out from
the flags passed to aapt2 link.

Bug: 135597368
Test: m java
Change-Id: I92792cf6a0d4c6ecf5e0971523bd0ab76c81345f
This commit is contained in:
Colin Cross 2019-06-22 13:03:09 -07:00
parent 435dcbb845
commit 18f28c7781
2 changed files with 3 additions and 12 deletions

View File

@ -61,8 +61,8 @@ 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_resources_flata): \
PRIVATE_AAPT2_CFLAGS := --pseudo-localize
$(my_res_resources_flat) $(my_overlay_resources_flat) $(my_resources_flata) $(my_generated_resources_flata) $(my_zippped_resources_flata): \
PRIVATE_AAPT2_CFLAGS := --pseudo-localize $(filter --legacy,$(LOCAL_AAPT_FLAGS))
# TODO(b/78447299): Forbid LOCAL_STATIC_JAVA_AAR_LIBRARIES in aapt2 and remove
# support for it.

View File

@ -328,7 +328,7 @@ my_split_suffixes := $(subst $(comma),_,$(my_apk_split_configs))
built_apk_splits := $(foreach s,$(my_split_suffixes),$(intermediates)/package_$(s).apk)
endif
$(R_file_stamp) $(my_res_package): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS)
$(R_file_stamp) $(my_res_package): PRIVATE_AAPT_FLAGS := $(filter-out --legacy,$(LOCAL_AAPT_FLAGS))
$(R_file_stamp) $(my_res_package): PRIVATE_TARGET_AAPT_CHARACTERISTICS := $(TARGET_AAPT_CHARACTERISTICS)
$(R_file_stamp) $(my_res_package): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME)
$(R_file_stamp) $(my_res_package): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_MANIFEST_INSTRUMENTATION_FOR)
@ -346,7 +346,6 @@ 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)
ifndef LOCAL_AAPT_NAMESPACES
$(my_res_package): PRIVATE_AAPT_FLAGS += --no-static-lib-packages
endif
@ -416,14 +415,6 @@ $(LOCAL_INTERMEDIATE_TARGETS): \
$(my_res_package) : $(all_library_res_package_export_deps)
# These four are set above for $(R_stamp_file) and $(my_res_package), but
# $(LOCAL_BUILT_MODULE) is not set before java.mk, so they have to be set again
# here.
$(LOCAL_BUILT_MODULE): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS)
$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_AAPT_CHARACTERISTICS := $(TARGET_AAPT_CHARACTERISTICS)
$(LOCAL_BUILT_MODULE): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME)
$(LOCAL_BUILT_MODULE): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_MANIFEST_INSTRUMENTATION_FOR)
ifneq ($(full_classes_jar),)
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
# Use the jarjar processed arhive as the initial package file.