Remove AAPT1 support

AAPT2 is used everywhere now, remove support for AAPT1.  Also
removes dpi_specific_apk.mk, it was never updated to use AAPT2
and has been generating bad APKs (resource ID mismatch between
the dex files and the resources) since AAPT2 was made the default
in May 2018 (I9b67fd2a9b3234798b2aac879b5242c2097b3863).

Bug: 80450981
Test: m checkbuild
Change-Id: I2ff768897360ff866dbae5562455bab22be270f7
Merged-In: I2ff768897360ff866dbae5562455bab22be270f7
This commit is contained in:
Colin Cross 2019-02-25 22:21:24 -08:00
parent c9bb097bee
commit e6210f6eb2
11 changed files with 104 additions and 401 deletions

View File

@ -23,12 +23,6 @@ ifndef LOCAL_DONT_MERGE_MANIFESTS
$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/manifest/AndroidManifest.xml) $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/manifest/AndroidManifest.xml)
endif endif
# With aapt2, we'll link in the built resource from the AAR.
ifneq ($(LOCAL_USE_AAPT2),true)
LOCAL_RESOURCE_DIR += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/res)
endif
full_android_manifest := $(intermediates.COMMON)/manifest/AndroidManifest.xml full_android_manifest := $(intermediates.COMMON)/manifest/AndroidManifest.xml
ifneq (,$(strip $(my_full_libs_manifest_files))) ifneq (,$(strip $(my_full_libs_manifest_files)))

View File

@ -291,7 +291,7 @@ LOCAL_TIDY_FLAGS:=
LOCAL_UNCOMPRESS_DEX:= LOCAL_UNCOMPRESS_DEX:=
LOCAL_UNINSTALLABLE_MODULE:= LOCAL_UNINSTALLABLE_MODULE:=
LOCAL_UNSTRIPPED_PATH:= LOCAL_UNSTRIPPED_PATH:=
LOCAL_USE_AAPT2:=$(USE_AAPT2) LOCAL_USE_AAPT2:=
LOCAL_USE_CLANG_LLD:= LOCAL_USE_CLANG_LLD:=
LOCAL_USE_VNDK:= LOCAL_USE_VNDK:=
LOCAL_USES_LIBRARIES:= LOCAL_USES_LIBRARIES:=

View File

@ -1846,42 +1846,6 @@ endef
# b/37750224 # b/37750224
AAPT_ASAN_OPTIONS := ASAN_OPTIONS=detect_leaks=0 AAPT_ASAN_OPTIONS := ASAN_OPTIONS=detect_leaks=0
# TODO: Right now we generate the asset resources twice, first as part
# of generating the Java classes, then at the end when packaging the final
# assets. This should be changed to do one of two things: (1) Don't generate
# any resource files the first time, only create classes during that stage;
# or (2) Don't use the -c flag with the second stage, instead taking the
# resource files from the first stage as additional input. My original intent
# was to use approach (2), but this requires a little more work in the tool.
# 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 PRIVATE_PRODUCT_AAPT_CONFIG to this invocation.
define create-resource-java-files
@mkdir -p $(dir $(PRIVATE_RESOURCE_PUBLICS_OUTPUT))
rm -rf $(PRIVATE_JAVA_GEN_DIR)
mkdir -p $(PRIVATE_JAVA_GEN_DIR)
$(hide) $(AAPT_ASAN_OPTIONS) $(AAPT) package $(PRIVATE_AAPT_FLAGS) -m \
$(eval # PRIVATE_PRODUCT_AAPT_CONFIG is intentionally missing-- see comment.) \
$(addprefix -J , $(PRIVATE_JAVA_GEN_DIR)) \
$(addprefix -M , $(PRIVATE_ANDROID_MANIFEST)) \
$(addprefix -P , $(PRIVATE_RESOURCE_PUBLICS_OUTPUT)) \
$(addprefix -S , $(PRIVATE_RESOURCE_DIR)) \
$(addprefix -A , $(PRIVATE_ASSET_DIR)) \
$(addprefix -I , $(PRIVATE_AAPT_INCLUDES)) \
$(addprefix -G , $(PRIVATE_PROGUARD_OPTIONS_FILE)) \
$(addprefix --min-sdk-version , $(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
$(addprefix --target-sdk-version , $(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
$(if $(filter --version-code,$(PRIVATE_AAPT_FLAGS)),,--version-code $(PLATFORM_SDK_VERSION)) \
$(if $(filter --version-name,$(PRIVATE_AAPT_FLAGS)),,--version-name $(APPS_DEFAULT_VERSION_NAME)) \
$(addprefix --rename-manifest-package , $(PRIVATE_MANIFEST_PACKAGE_NAME)) \
$(addprefix --rename-instrumentation-target-package , $(PRIVATE_MANIFEST_INSTRUMENTATION_FOR)) \
--skip-symbols-without-default-localization
$(SOONG_ZIP) -o $(PRIVATE_SRCJAR) -C $(PRIVATE_JAVA_GEN_DIR) -D $(PRIVATE_JAVA_GEN_DIR)
# So that we re-run aapt when the list of input files change
$(hide) echo $(PRIVATE_RESOURCE_LIST) >/dev/null
endef
# Search for generated R.java/Manifest.java in $1, copy the found R.java as $2. # Search for generated R.java/Manifest.java in $1, copy the found R.java as $2.
# Also copy them to a central 'R' directory to make it easier to add the files to an IDE. # Also copy them to a central 'R' directory to make it easier to add the files to an IDE.
define find-generated-R.java define find-generated-R.java
@ -2246,37 +2210,6 @@ $(hide) $(DX_COMMAND) $(DEX_FLAGS) \
$(hide) rm -f $(dir $@)d8_input.jar $(hide) rm -f $(dir $@)d8_input.jar
endef endef
#TODO: we kinda want to build different asset packages for
# different configurations, then combine them later (or something).
# Per-locale, etc.
# A list of dynamic and static parameters; build layers for
# dynamic params that lay over the static ones.
#TODO: update the manifest to point to the package file
#Note that the version numbers are given to aapt as simple default
#values; applications can override these by explicitly stating
#them in their manifest.
# $(1) the package file
define create-assets-package
$(hide) $(AAPT_ASAN_OPTIONS) $(AAPT) package $(PRIVATE_AAPT_FLAGS) \
$(addprefix -c , $(PRIVATE_PRODUCT_AAPT_CONFIG)) \
$(addprefix --preferred-density , $(PRIVATE_PRODUCT_AAPT_PREF_CONFIG)) \
$(addprefix -M , $(PRIVATE_ANDROID_MANIFEST)) \
$(addprefix -S , $(PRIVATE_RESOURCE_DIR)) \
$(addprefix -A , $(PRIVATE_ASSET_DIR)) \
$(addprefix -I , $(PRIVATE_AAPT_INCLUDES)) \
$(addprefix --min-sdk-version , $(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
$(addprefix --target-sdk-version , $(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
$(if $(filter --product,$(PRIVATE_AAPT_FLAGS)),,$(addprefix --product , $(PRIVATE_TARGET_AAPT_CHARACTERISTICS))) \
$(if $(filter --version-code,$(PRIVATE_AAPT_FLAGS)),,--version-code $(PLATFORM_SDK_VERSION)) \
$(if $(filter --version-name,$(PRIVATE_AAPT_FLAGS)),,--version-name $(APPS_DEFAULT_VERSION_NAME)) \
$(addprefix --rename-manifest-package , $(PRIVATE_MANIFEST_PACKAGE_NAME)) \
$(addprefix --rename-instrumentation-target-package , $(PRIVATE_MANIFEST_INSTRUMENTATION_FOR)) \
--skip-symbols-without-default-localization \
-F $(1)
# So that we re-run aapt when the list of input files change
$(hide) echo $(PRIVATE_RESOURCE_LIST) >/dev/null
endef
# We need the extra blank line, so that the command will be on a separate line. # We need the extra blank line, so that the command will be on a separate line.
# $(1): the package # $(1): the package
# $(2): the ABI name # $(2): the ABI name
@ -2381,16 +2314,14 @@ endef
ifeq ($(HOST_OS),linux) ifeq ($(HOST_OS),linux)
# Runs appcompat and store logs in $(PRODUCT_OUT)/appcompat # Runs appcompat and store logs in $(PRODUCT_OUT)/appcompat
define extract-package define extract-package
$(if $(filter aapt2, $(1)), \ $(AAPT2) dump $@ | awk -F ' |=' '/^Package/{print $$3}' >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log &&
$(AAPT2) dump $@ | awk -F ' |=' '/^Package/{print $$3}' >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log &&, \
$(AAPT) dump badging $@ | awk -F \' '/^package/{print $$2}' >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log &&)
endef endef
define appcompat-header define appcompat-header
$(hide) \ $(hide) \
mkdir -p $(PRODUCT_OUT)/appcompat && \ mkdir -p $(PRODUCT_OUT)/appcompat && \
rm -f $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \ rm -f $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \
echo -n "Package name: " >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \ echo -n "Package name: " >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \
$(call extract-package, $(1)) \ $(extract-package) \
echo "Module name in Android tree: $(PRIVATE_MODULE)" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \ echo "Module name in Android tree: $(PRIVATE_MODULE)" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \
echo "Local path in Android tree: $(PRIVATE_PATH)" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \ echo "Local path in Android tree: $(PRIVATE_PATH)" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \
echo "Install path on $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT): $(PRIVATE_INSTALLED_MODULE)" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \ echo "Install path on $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT): $(PRIVATE_INSTALLED_MODULE)" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \

View File

@ -1,77 +0,0 @@
# Set up rules to build dpi-specific apk, with whatever else from the base apk.
# Input variable: my_dpi, and all other variables set up in package_internal.mk.
#
dpi_apk_name := $(LOCAL_MODULE)_$(my_dpi)
dpi_intermediate := $(call intermediates-dir-for,APPS,$(dpi_apk_name))
built_dpi_apk := $(dpi_intermediate)/package.apk
additional_certificates := $(foreach c,$(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8)
# Set up all the target-specific variables.
$(built_dpi_apk): PRIVATE_MODULE := $(dpi_apk_name)
$(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)
$(built_dpi_apk): PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
$(built_dpi_apk): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
$(built_dpi_apk): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR)
$(built_dpi_apk): PRIVATE_AAPT_INCLUDES := $(all_library_res_package_exports)
$(built_dpi_apk): PRIVATE_RESOURCE_LIST := $(all_res_assets)
$(built_dpi_apk): PRIVATE_DEFAULT_APP_TARGET_SDK := $(call module-target-sdk-version)
$(built_dpi_apk): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME)
$(built_dpi_apk): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_INSTRUMENTATION_FOR)
$(built_dpi_apk): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries_with_abis)
$(built_dpi_apk): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abis)
$(built_dpi_apk): PRIVATE_PRIVATE_KEY := $(private_key)
$(built_dpi_apk): PRIVATE_CERTIFICATE := $(certificate)
$(built_dpi_apk): $(additional_certificates)
$(built_dpi_apk): PRIVATE_ADDITIONAL_CERTIFICATES := $(additional_certificates)
$(built_dpi_apk): PRIVATE_SOURCE_ARCHIVE :=
ifneq ($(full_classes_jar),)
$(built_dpi_apk): PRIVATE_DEX_FILE := $(built_dex)
# Use the jarjar processed arhive as the initial package file.
$(built_dpi_apk): PRIVATE_SOURCE_ARCHIVE := $(full_classes_pre_proguard_jar)
$(built_dpi_apk): $(built_dex)
else
$(built_dpi_apk): PRIVATE_DEX_FILE :=
endif # full_classes_jar
# Set up dependenncies and the build recipe.
$(built_dpi_apk) : $(R_file_stamp)
$(built_dpi_apk) : $(all_library_res_package_export_deps)
$(built_dpi_apk) : $(private_key) $(certificate) $(SIGNAPK_JAR)
$(built_dpi_apk) : $(AAPT)
$(built_dpi_apk) : $(MERGE_ZIPS) $(SOONG_ZIP) $(ZIP2ZIP)
$(built_dpi_apk) : $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest)
@echo "target Package: $(PRIVATE_MODULE) ($@)"
rm -rf $@.parts
mkdir -p $@.parts
$(call create-assets-package,$@.parts/apk.zip)
ifneq ($(jni_shared_libraries),)
$(call create-jni-shared-libs-package,$@.parts/jni.zip)
endif
ifeq ($(full_classes_jar),)
# We don't build jar, need to add the Java resources here.
$(if $(PRIVATE_EXTRA_JAR_ARGS),$(call create-java-resources-jar,$@.parts/res.zip))
else
$(call create-dex-jar,$@.parts/dex.zip,$(PRIVATE_DEX_FILE))
$(call extract-resources-jar,$@.parts/res.zip,$(PRIVATE_SOURCE_ARCHIVE))
endif
$(MERGE_ZIPS) $@ $@.parts/*.zip
rm -rf $@.parts
$(sign-package)
# Set up global variables to register this apk to the higher-level dependency graph.
ALL_MODULES += $(dpi_apk_name)
ALL_MODULES.$(dpi_apk_name).CLASS := APPS
ALL_MODULES.$(dpi_apk_name).BUILT := $(built_dpi_apk)
ALL_MODULES.$(dpi_apk_name).TARGET_BUILT := $(built_dpi_apk)
PACKAGES := $(PACKAGES) $(dpi_apk_name)
PACKAGES.$(dpi_apk_name).PRIVATE_KEY := $(private_key)
PACKAGES.$(dpi_apk_name).CERTIFICATE := $(certificate)
# Phony targets used by "apps_only".
.PHONY: $(dpi_apk_name)
$(dpi_apk_name) : $(built_dpi_apk)

View File

@ -14,20 +14,20 @@
# limitations under the License. # limitations under the License.
# #
# Including this makefile will force AAPT2 on if FORCE_AAPT2==true, # Including this makefile will force AAPT2 on,
# rewriting some properties to convert standard AAPT usage to AAPT2. # rewriting some properties to convert standard AAPT usage to AAPT2.
ifneq ($(FORCE_AAPT2),false) ifeq ($(LOCAL_USE_AAPT2),false)
ifeq ($(LOCAL_USE_AAPT2),) $(call pretty-error, LOCAL_USE_AAPT2 := false is no longer supported)
# Force AAPT2 on endif
LOCAL_USE_AAPT2 := true
# Filter out support library resources # Filter out support library resources
LOCAL_RESOURCE_DIR := $(filter-out \ LOCAL_RESOURCE_DIR := $(filter-out \
prebuilts/sdk/current/% \ prebuilts/sdk/current/% \
frameworks/support/%,\ frameworks/support/%,\
$(LOCAL_RESOURCE_DIR)) $(LOCAL_RESOURCE_DIR))
# Filter out unnecessary aapt flags # Filter out unnecessary aapt flags
ifneq (,$(filter --extra-packages,$(LOCAL_AAPT_FLAGS))) ifneq (,$(filter --extra-packages,$(LOCAL_AAPT_FLAGS)))
LOCAL_AAPT_FLAGS := $(subst --extra-packages=,--extra-packages$(space), \ LOCAL_AAPT_FLAGS := $(subst --extra-packages=,--extra-packages$(space), \
$(filter-out \ $(filter-out \
--extra-packages=android.support.% \ --extra-packages=android.support.% \
@ -36,28 +36,18 @@ ifneq ($(FORCE_AAPT2),false)
ifeq (,$(filter --extra-packages,$(LOCAL_AAPT_FLAGS))) ifeq (,$(filter --extra-packages,$(LOCAL_AAPT_FLAGS)))
LOCAL_AAPT_FLAGS := $(filter-out --auto-add-overlay,$(LOCAL_AAPT_FLAGS)) LOCAL_AAPT_FLAGS := $(filter-out --auto-add-overlay,$(LOCAL_AAPT_FLAGS))
endif endif
endif endif
# AAPT2 is pickier about missing resources. Support library may have references to resources # AAPT2 is pickier about missing resources. Support library may have references to resources
# added in current, so always treat LOCAL_SDK_VERSION as LOCAL_SDK_RES_VERSION := current. # added in current, so always treat LOCAL_SDK_VERSION as LOCAL_SDK_RES_VERSION := current.
ifdef LOCAL_SDK_VERSION ifdef LOCAL_SDK_VERSION
LOCAL_SDK_RES_VERSION := current LOCAL_SDK_RES_VERSION := current
endif endif
ifeq (,$(strip $(LOCAL_MANIFEST_FILE)$(LOCAL_FULL_MANIFEST_FILE))) ifeq (,$(strip $(LOCAL_MANIFEST_FILE)$(LOCAL_FULL_MANIFEST_FILE)))
ifeq (,$(wildcard $(LOCAL_PATH)/AndroidManifest.xml)) ifeq (,$(wildcard $(LOCAL_PATH)/AndroidManifest.xml))
# work around missing manifests by creating a default one # work around missing manifests by creating a default one
LOCAL_FULL_MANIFEST_FILE := $(call local-intermediates-dir,COMMON)/DefaultManifest.xml LOCAL_FULL_MANIFEST_FILE := $(call local-intermediates-dir,COMMON)/DefaultManifest.xml
$(call create-default-manifest-file,$(LOCAL_FULL_MANIFEST_FILE),$(call module-min-sdk-version)) $(call create-default-manifest-file,$(LOCAL_FULL_MANIFEST_FILE),$(call module-min-sdk-version))
endif endif
endif
endif
endif
ifneq ($(LOCAL_USE_AAPT2),true)
ifneq ($(LOCAL_USE_AAPT2),false)
ifneq ($(LOCAL_USE_AAPT2),)
$(call pretty-error,Invalid value for LOCAL_USE_AAPT2: "$(LOCAL_USE_AAPT2)")
endif
endif
endif endif

View File

@ -422,10 +422,8 @@ ifneq ($(LOCAL_INSTRUMENTATION_FOR)$(filter tests,$(LOCAL_MODULE_TAGS)),)
common_proguard_flags += -dontshrink # don't shrink tests by default common_proguard_flags += -dontshrink # don't shrink tests by default
endif # test package endif # test package
ifneq ($(LOCAL_PROGUARD_ENABLED),custom) ifneq ($(LOCAL_PROGUARD_ENABLED),custom)
ifeq ($(LOCAL_USE_AAPT2),true)
common_proguard_flag_files += $(foreach l,$(LOCAL_STATIC_ANDROID_LIBRARIES),\ common_proguard_flag_files += $(foreach l,$(LOCAL_STATIC_ANDROID_LIBRARIES),\
$(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/export_proguard_flags) $(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/export_proguard_flags)
endif
endif endif
ifneq ($(common_proguard_flag_files),) ifneq ($(common_proguard_flag_files),)
common_proguard_flags += $(addprefix -include , $(common_proguard_flag_files)) common_proguard_flags += $(addprefix -include , $(common_proguard_flag_files))

View File

@ -534,13 +534,6 @@ my_warn_types :=
my_allowed_types := java:sdk java:system java:platform java:core my_allowed_types := java:sdk java:system java:platform java:core
endif endif
ifdef LOCAL_AAPT2_ONLY
my_link_type += aapt2_only
endif
ifeq ($(LOCAL_USE_AAPT2),true)
my_allowed_types += aapt2_only
endif
my_link_deps := $(addprefix JAVA_LIBRARIES:,$(LOCAL_STATIC_JAVA_LIBRARIES) $(LOCAL_JAVA_LIBRARIES)) my_link_deps := $(addprefix JAVA_LIBRARIES:,$(LOCAL_STATIC_JAVA_LIBRARIES) $(LOCAL_JAVA_LIBRARIES))
my_link_deps += $(addprefix APPS:,$(apk_libraries)) my_link_deps += $(addprefix APPS:,$(apk_libraries))

View File

@ -172,11 +172,6 @@ $(common_javalib_jar) : $(common_classes_jar)
include $(BUILD_SYSTEM)/force_aapt2.mk include $(BUILD_SYSTEM)/force_aapt2.mk
ifdef LOCAL_AAPT2_ONLY
LOCAL_USE_AAPT2 := true
endif
ifeq ($(LOCAL_USE_AAPT2),true)
ifneq ($(my_src_aar),) ifneq ($(my_src_aar),)
$(intermediates.COMMON)/export_proguard_flags : $(my_src_proguard_options) $(intermediates.COMMON)/export_proguard_flags : $(my_src_proguard_options)
@ -229,7 +224,7 @@ include $(BUILD_SYSTEM)/aapt2.mk
# Make sure my_res_package is created when you run mm/mmm. # Make sure my_res_package is created when you run mm/mmm.
$(built_module) : $(my_res_package) $(built_module) : $(my_res_package)
endif # $(my_src_aar) endif # $(my_src_aar)
endif # LOCAL_USE_AAPT2
# make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE) # make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE)
$(built_module) : $(common_javalib_jar) $(built_module) : $(common_javalib_jar)

View File

@ -171,12 +171,7 @@ ifneq ($(all_assets),)
need_compile_asset := true need_compile_asset := true
endif endif
ifdef LOCAL_AAPT2_ONLY
LOCAL_USE_AAPT2 := true
endif
my_res_package := my_res_package :=
ifeq ($(LOCAL_USE_AAPT2),true)
# In aapt2 the last takes precedence. # In aapt2 the last takes precedence.
my_resource_dirs := $(call reverse-list,$(LOCAL_RESOURCE_DIR)) my_resource_dirs := $(call reverse-list,$(LOCAL_RESOURCE_DIR))
my_res_dir := my_res_dir :=
@ -210,30 +205,12 @@ all_resources := $(strip $(my_res_resources) $(my_overlay_resources))
my_res_package := $(intermediates)/package-res.apk my_res_package := $(intermediates)/package-res.apk
LOCAL_INTERMEDIATE_TARGETS += $(my_res_package) LOCAL_INTERMEDIATE_TARGETS += $(my_res_package)
ifeq ($(LOCAL_USE_AAPT2),true) my_bundle_module := $(intermediates)/base.zip
my_bundle_module := $(intermediates)/base.zip LOCAL_INTERMEDIATE_TARGETS += $(my_bundle_module)
LOCAL_INTERMEDIATE_TARGETS += $(my_bundle_module)
endif
# Always run aapt2, because we need to at least compile the AndroidManifest.xml. # Always run aapt2, because we need to at least compile the AndroidManifest.xml.
need_compile_res := true need_compile_res := true
else # LOCAL_USE_AAPT2
all_resources := $(strip \
$(foreach dir, $(LOCAL_RESOURCE_DIR), \
$(addprefix $(dir)/, \
$(patsubst res/%,%, \
$(call find-subdir-assets,$(dir)) \
) \
) \
))
ifdef LOCAL_PACKAGE_SPLITS
LOCAL_AAPT_FLAGS += $(addprefix --split ,$(LOCAL_PACKAGE_SPLITS))
endif
endif # LOCAL_USE_AAPT2
ifneq ($(all_resources),) ifneq ($(all_resources),)
need_compile_res := true need_compile_res := true
endif endif
@ -369,71 +346,24 @@ $(R_file_stamp) $(my_res_package): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANI
$(R_file_stamp) $(my_res_package): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_MANIFEST_INSTRUMENTATION_FOR) $(R_file_stamp) $(my_res_package): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_MANIFEST_INSTRUMENTATION_FOR)
############################### ###############################
## AAPT/AAPT2 ## AAPT2
ifeq ($(LOCAL_USE_AAPT2),true) my_compiled_res_base_dir := $(intermediates.COMMON)/flat-res
my_compiled_res_base_dir := $(intermediates.COMMON)/flat-res ifneq (,$(filter-out current,$(renderscript_target_api)))
ifneq (,$(filter-out current,$(renderscript_target_api)))
ifneq ($(call math_gt_or_eq,$(renderscript_target_api),21),true) ifneq ($(call math_gt_or_eq,$(renderscript_target_api),21),true)
my_generated_res_zips := $(rs_generated_res_zip) my_generated_res_zips := $(rs_generated_res_zip)
endif # renderscript_target_api < 21 endif # renderscript_target_api < 21
endif # renderscript_target_api is set endif # renderscript_target_api is set
my_asset_dirs := $(LOCAL_ASSET_DIR) my_asset_dirs := $(LOCAL_ASSET_DIR)
my_full_asset_paths := $(all_assets) my_full_asset_paths := $(all_assets)
# Add AAPT2 link specific flags. # Add AAPT2 link specific flags.
$(my_res_package): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) $(my_res_package): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS)
ifndef LOCAL_AAPT_NAMESPACES ifndef LOCAL_AAPT_NAMESPACES
$(my_res_package): PRIVATE_AAPT_FLAGS += --no-static-lib-packages $(my_res_package): PRIVATE_AAPT_FLAGS += --no-static-lib-packages
endif endif
include $(BUILD_SYSTEM)/aapt2.mk include $(BUILD_SYSTEM)/aapt2.mk
else # LOCAL_USE_AAPT2
my_srcjar := $(intermediates.COMMON)/aapt.srcjar
LOCAL_SRCJARS += $(my_srcjar)
$(R_file_stamp): PRIVATE_SRCJAR := $(my_srcjar)
$(R_file_stamp): PRIVATE_JAVA_GEN_DIR := $(intermediates.COMMON)/aapt
$(R_file_stamp): .KATI_IMPLICIT_OUTPUTS := $(my_srcjar)
# Since we don't know where the real R.java file is going to end up,
# we need to use another file to stand in its place. We'll just
# copy the generated file to src/R.stamp, which means it will
# have the same contents and timestamp as the actual file.
#
# At the same time, this will copy the R.java file to a central
# 'R' directory to make it easier to add the files to an IDE.
#
$(R_file_stamp): PRIVATE_RESOURCE_PUBLICS_OUTPUT := \
$(intermediates.COMMON)/public_resources.xml
$(R_file_stamp): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file)
$(R_file_stamp): PRIVATE_RESOURCE_LIST := $(all_res_assets)
$(R_file_stamp): $(all_res_assets) $(full_android_manifest) $(rs_generated_res_zip) $(AAPT) $(SOONG_ZIP) | $(ACP)
@echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)"
@rm -rf $@ && mkdir -p $(dir $@)
$(create-resource-java-files)
$(call find-generated-R.java,$(PRIVATE_JAVA_GEN_DIR),$@)
$(proguard_options_file): $(R_file_stamp)
ifdef LOCAL_EXPORT_PACKAGE_RESOURCES
# Put this module's resources into a PRODUCT-agnositc package that
# other packages can use to build their own PRODUCT-agnostic R.java (etc.)
# files.
resource_export_package := $(intermediates.COMMON)/package-export.apk
$(R_file_stamp): $(resource_export_package)
# create-assets-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): PRIVATE_PRODUCT_AAPT_CONFIG :=
$(resource_export_package): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
$(resource_export_package): PRIVATE_RESOURCE_LIST := $(all_res_assets)
$(resource_export_package): $(all_res_assets) $(full_android_manifest) $(rs_generated_res_zip) $(AAPT)
@echo "target Export Resources: $(PRIVATE_MODULE) ($@)"
$(call create-assets-package,$@)
endif
endif # LOCAL_USE_AAPT2
endif # need_compile_res endif # need_compile_res
@ -496,9 +426,7 @@ $(resource_export_package) $(R_file_stamp) $(LOCAL_BUILT_MODULE): $(all_library_
$(LOCAL_INTERMEDIATE_TARGETS): \ $(LOCAL_INTERMEDIATE_TARGETS): \
PRIVATE_AAPT_INCLUDES := $(all_library_res_package_exports) PRIVATE_AAPT_INCLUDES := $(all_library_res_package_exports)
ifeq ($(LOCAL_USE_AAPT2),true)
$(my_res_package) : $(all_library_res_package_export_deps) $(my_res_package) : $(all_library_res_package_export_deps)
endif
# These four are set above for $(R_stamp_file) and $(my_res_package), but # 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 # $(LOCAL_BUILT_MODULE) is not set before java.mk, so they have to be set again
@ -595,13 +523,8 @@ endif
$(LOCAL_BUILT_MODULE): PRIVATE_RESOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/resources $(LOCAL_BUILT_MODULE): PRIVATE_RESOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/resources
$(LOCAL_BUILT_MODULE) : $(jni_shared_libraries) $(LOCAL_BUILT_MODULE) : $(jni_shared_libraries)
$(LOCAL_BUILT_MODULE) : $(JAR_ARGS) $(SOONG_ZIP) $(MERGE_ZIPS) $(ZIP2ZIP) $(LOCAL_BUILT_MODULE) : $(JAR_ARGS) $(SOONG_ZIP) $(MERGE_ZIPS) $(ZIP2ZIP)
ifeq ($(LOCAL_USE_AAPT2),true)
$(LOCAL_BUILT_MODULE): PRIVATE_RES_PACKAGE := $(my_res_package) $(LOCAL_BUILT_MODULE): PRIVATE_RES_PACKAGE := $(my_res_package)
$(LOCAL_BUILT_MODULE) : $(my_res_package) $(AAPT2) | $(ACP) $(LOCAL_BUILT_MODULE) : $(my_res_package) $(AAPT2) | $(ACP)
else
$(LOCAL_BUILT_MODULE): PRIVATE_RESOURCE_LIST := $(all_res_assets)
$(LOCAL_BUILT_MODULE) : $(all_res_assets) $(full_android_manifest) $(AAPT) $(ZIPALIGN)
endif # LOCAL_USE_AAPT2
ifdef LOCAL_COMPRESSED_MODULE ifdef LOCAL_COMPRESSED_MODULE
$(LOCAL_BUILT_MODULE) : $(MINIGZIP) $(LOCAL_BUILT_MODULE) : $(MINIGZIP)
endif endif
@ -622,11 +545,7 @@ $(LOCAL_BUILT_MODULE):
@echo "target Package: $(PRIVATE_MODULE) ($@)" @echo "target Package: $(PRIVATE_MODULE) ($@)"
rm -rf $@.parts rm -rf $@.parts
mkdir -p $@.parts mkdir -p $@.parts
ifeq ($(LOCAL_USE_AAPT2),true)
cp -f $(PRIVATE_RES_PACKAGE) $@.parts/apk.zip cp -f $(PRIVATE_RES_PACKAGE) $@.parts/apk.zip
else # ! LOCAL_USE_AAPT2
$(call create-assets-package,$@.parts/apk.zip)
endif # LOCAL_USE_AAPT2
ifneq ($(jni_shared_libraries),) ifneq ($(jni_shared_libraries),)
$(call create-jni-shared-libs-package,$@.parts/jni.zip,$(PRIVATE_USE_EMBEDDED_NATIVE_LIBS)) $(call create-jni-shared-libs-package,$@.parts/jni.zip,$(PRIVATE_USE_EMBEDDED_NATIVE_LIBS))
endif endif
@ -645,11 +564,7 @@ ifeq (true, $(LOCAL_UNCOMPRESS_DEX))
endif endif
# Run appcompat before stripping the classes.dex file. # Run appcompat before stripping the classes.dex file.
ifeq ($(module_run_appcompat),true) ifeq ($(module_run_appcompat),true)
ifeq ($(LOCAL_USE_AAPT2),true)
$(call appcompat-header, aapt2)
else
$(appcompat-header) $(appcompat-header)
endif
$(run-appcompat) $(run-appcompat)
endif # module_run_appcompat endif # module_run_appcompat
ifdef LOCAL_DEX_PREOPT ifdef LOCAL_DEX_PREOPT
@ -665,29 +580,28 @@ ifdef LOCAL_COMPRESSED_MODULE
$(compress-package) $(compress-package)
endif # LOCAL_COMPRESSED_MODULE endif # LOCAL_COMPRESSED_MODULE
ifeq ($(LOCAL_USE_AAPT2),true) my_package_res_pb := $(intermediates)/package-res.pb.apk
my_package_res_pb := $(intermediates)/package-res.pb.apk $(my_package_res_pb): $(my_res_package) $(AAPT2)
$(my_package_res_pb): $(my_res_package) $(AAPT2)
$(AAPT2) convert --output-format proto $< -o $@ $(AAPT2) convert --output-format proto $< -o $@
$(my_bundle_module): $(my_package_res_pb) $(my_bundle_module): $(my_package_res_pb)
$(my_bundle_module): PRIVATE_RES_PACKAGE := $(my_package_res_pb) $(my_bundle_module): PRIVATE_RES_PACKAGE := $(my_package_res_pb)
$(my_bundle_module): $(jni_shared_libraries) $(my_bundle_module): $(jni_shared_libraries)
$(my_bundle_module): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries_with_abis) $(my_bundle_module): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries_with_abis)
$(my_bundle_module): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abis) $(my_bundle_module): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abis)
ifneq ($(full_classes_jar),) ifneq ($(full_classes_jar),)
$(my_bundle_module): PRIVATE_DEX_FILE := $(built_dex) $(my_bundle_module): PRIVATE_DEX_FILE := $(built_dex)
# Use the jarjar processed archive as the initial package file. # Use the jarjar processed archive as the initial package file.
$(my_bundle_module): PRIVATE_SOURCE_ARCHIVE := $(full_classes_pre_proguard_jar) $(my_bundle_module): PRIVATE_SOURCE_ARCHIVE := $(full_classes_pre_proguard_jar)
$(my_bundle_module): $(built_dex) $(my_bundle_module): $(built_dex)
else else
$(my_bundle_module): PRIVATE_DEX_FILE := $(my_bundle_module): PRIVATE_DEX_FILE :=
$(my_bundle_module): PRIVATE_SOURCE_ARCHIVE := $(my_bundle_module): PRIVATE_SOURCE_ARCHIVE :=
endif # full_classes_jar endif # full_classes_jar
$(my_bundle_module): $(MERGE_ZIPS) $(SOONG_ZIP) $(ZIP2ZIP) $(my_bundle_module): $(MERGE_ZIPS) $(SOONG_ZIP) $(ZIP2ZIP)
@echo "target Bundle: $(PRIVATE_MODULE) ($@)" @echo "target Bundle: $(PRIVATE_MODULE) ($@)"
rm -rf $@.parts rm -rf $@.parts
mkdir -p $@.parts mkdir -p $@.parts
@ -711,17 +625,12 @@ ifeq ($(LOCAL_USE_AAPT2),true)
endif # full_classes_jar endif # full_classes_jar
$(MERGE_ZIPS) $@ $@.parts/*.zip $(MERGE_ZIPS) $@ $@.parts/*.zip
rm -rf $@.parts rm -rf $@.parts
ALL_MODULES.$(LOCAL_MODULE).BUNDLE := $(my_bundle_module) ALL_MODULES.$(LOCAL_MODULE).BUNDLE := $(my_bundle_module)
endif
###############################
## Build dpi-specific apks, if it's apps_only build.
ifdef TARGET_BUILD_APPS ifdef TARGET_BUILD_APPS
ifdef LOCAL_DPI_VARIANTS ifdef LOCAL_DPI_VARIANTS
$(foreach d, $(LOCAL_DPI_VARIANTS), \ $(call pretty-error,Building DPI-specific APKs is no longer supported)
$(eval my_dpi := $(d)) \ endif
$(eval include $(BUILD_SYSTEM)/dpi_specific_apk.mk))
endif
endif endif
############################### ###############################

View File

@ -60,7 +60,7 @@ ifeq ($(module_run_appcompat),true)
$(LOCAL_BUILT_MODULE): $(LOCAL_PREBUILT_MODULE_FILE) $(LOCAL_BUILT_MODULE): $(LOCAL_PREBUILT_MODULE_FILE)
@echo "Copy: $@" @echo "Copy: $@"
$(copy-file-to-target) $(copy-file-to-target)
$(call appcompat-header, aapt2) $(appcompat-header)
$(run-appcompat) $(run-appcompat)
else else
$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE))) $(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE)))

View File

@ -33,10 +33,6 @@ include $(BUILD_SYSTEM)/support_libraries.mk
include $(BUILD_SYSTEM)/force_aapt2.mk include $(BUILD_SYSTEM)/force_aapt2.mk
ifdef LOCAL_AAPT2_ONLY
LOCAL_USE_AAPT2 := true
endif
# Hack to build static Java library with Android resource # Hack to build static Java library with Android resource
# See bug 5714516 # See bug 5714516
all_resources := all_resources :=
@ -46,11 +42,9 @@ ifdef LOCAL_RESOURCE_DIR
need_compile_res := true need_compile_res := true
LOCAL_RESOURCE_DIR := $(foreach d,$(LOCAL_RESOURCE_DIR),$(call clean-path,$(d))) LOCAL_RESOURCE_DIR := $(foreach d,$(LOCAL_RESOURCE_DIR),$(call clean-path,$(d)))
endif endif
ifeq ($(LOCAL_USE_AAPT2),true)
ifneq ($(strip $(LOCAL_STATIC_ANDROID_LIBRARIES) $(LOCAL_STATIC_JAVA_AAR_LIBRARIES)),) ifneq ($(strip $(LOCAL_STATIC_ANDROID_LIBRARIES) $(LOCAL_STATIC_JAVA_AAR_LIBRARIES)),)
need_compile_res := true need_compile_res := true
endif endif
endif
ifeq ($(need_compile_res),true) ifeq ($(need_compile_res),true)
all_resources := $(strip \ all_resources := $(strip \
@ -84,22 +78,20 @@ LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_
R_file_stamp := $(intermediates.COMMON)/src/R.stamp R_file_stamp := $(intermediates.COMMON)/src/R.stamp
LOCAL_INTERMEDIATE_TARGETS += $(R_file_stamp) LOCAL_INTERMEDIATE_TARGETS += $(R_file_stamp)
ifeq ($(LOCAL_USE_AAPT2),true) ifneq ($(strip $(LOCAL_STATIC_ANDROID_LIBRARIES) $(LOCAL_STATIC_JAVA_AAR_LIBRARIES)),)
ifneq ($(strip $(LOCAL_STATIC_ANDROID_LIBRARIES) $(LOCAL_STATIC_JAVA_AAR_LIBRARIES)),)
# If we are using static android libraries, every source file becomes an overlay. # If we are using static android libraries, every source file becomes an overlay.
# This is to emulate old AAPT behavior which simulated library support. # This is to emulate old AAPT behavior which simulated library support.
my_res_resources := my_res_resources :=
my_overlay_resources := $(all_resources) my_overlay_resources := $(all_resources)
else else
# Otherwise, for a library we treat all the resource equal with no overlay. # Otherwise, for a library we treat all the resource equal with no overlay.
my_res_resources := $(all_resources) my_res_resources := $(all_resources)
my_overlay_resources := my_overlay_resources :=
endif endif
# For libraries put everything in the COMMON intermediate directory. # For libraries put everything in the COMMON intermediate directory.
my_res_package := $(intermediates.COMMON)/package-res.apk my_res_package := $(intermediates.COMMON)/package-res.apk
LOCAL_INTERMEDIATE_TARGETS += $(my_res_package) LOCAL_INTERMEDIATE_TARGETS += $(my_res_package)
endif # LOCAL_USE_AAPT2
endif # need_compile_res endif # need_compile_res
@ -127,7 +119,6 @@ framework_res_package_export := \
endif endif
endif endif
ifeq ($(LOCAL_USE_AAPT2),true)
import_proguard_flag_files := $(strip $(foreach l,$(LOCAL_STATIC_ANDROID_LIBRARIES) $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\ import_proguard_flag_files := $(strip $(foreach l,$(LOCAL_STATIC_ANDROID_LIBRARIES) $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
$(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/export_proguard_flags)) $(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/export_proguard_flags))
$(intermediates.COMMON)/export_proguard_flags: $(import_proguard_flag_files) $(addprefix $(LOCAL_PATH)/,$(LOCAL_EXPORT_PROGUARD_FLAG_FILES)) $(intermediates.COMMON)/export_proguard_flags: $(import_proguard_flag_files) $(addprefix $(LOCAL_PATH)/,$(LOCAL_EXPORT_PROGUARD_FLAG_FILES))
@ -139,7 +130,6 @@ $(intermediates.COMMON)/export_proguard_flags: $(import_proguard_flag_files) $(a
cat $$f >>$@; \ cat $$f >>$@; \
done done
import_proguard_flag_files := import_proguard_flag_files :=
endif
include $(BUILD_SYSTEM)/aapt_flags.mk include $(BUILD_SYSTEM)/aapt_flags.mk
@ -150,7 +140,6 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_M
# add --non-constant-id to prevent inlining constants. # add --non-constant-id to prevent inlining constants.
# AAR needs text symbol file R.txt. # AAR needs text symbol file R.txt.
ifeq ($(LOCAL_USE_AAPT2),true)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --static-lib --output-text-symbols $(intermediates.COMMON)/R.txt $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --static-lib --output-text-symbols $(intermediates.COMMON)/R.txt
ifndef LOCAL_AAPT_NAMESPACES ifndef LOCAL_AAPT_NAMESPACES
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_FLAGS += --no-static-lib-packages $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_FLAGS += --no-static-lib-packages
@ -158,15 +147,6 @@ endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_PRODUCT_AAPT_CONFIG := $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_PRODUCT_AAPT_CONFIG :=
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_AAPT_CHARACTERISTICS := $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_AAPT_CHARACTERISTICS :=
else
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --non-constant-id --output-text-symbols $(intermediates.COMMON)
my_srcjar := $(intermediates.COMMON)/aapt.srcjar
LOCAL_SRCJARS += $(my_srcjar)
$(R_file_stamp): PRIVATE_SRCJAR := $(my_srcjar)
$(R_file_stamp): PRIVATE_JAVA_GEN_DIR := $(intermediates.COMMON)/aapt
$(R_file_stamp): .KATI_IMPLICIT_OUTPUTS := $(my_srcjar)
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ANDROID_MANIFEST := $(full_android_manifest) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_PUBLICS_OUTPUT := $(intermediates.COMMON)/public_resources.xml $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_PUBLICS_OUTPUT := $(intermediates.COMMON)/public_resources.xml
@ -178,26 +158,16 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_optio
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MANIFEST_PACKAGE_NAME :=
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MANIFEST_INSTRUMENTATION_FOR :=
ifeq ($(LOCAL_USE_AAPT2),true) # One more level with name res so we can zip up the flat resources that can be linked by apps.
# One more level with name res so we can zip up the flat resources that can be linked by apps. my_compiled_res_base_dir := $(intermediates.COMMON)/flat-res/res
my_compiled_res_base_dir := $(intermediates.COMMON)/flat-res/res ifneq (,$(filter-out current,$(renderscript_target_api)))
ifneq (,$(filter-out current,$(renderscript_target_api)))
ifneq ($(call math_gt_or_eq,$(renderscript_target_api),21),true) ifneq ($(call math_gt_or_eq,$(renderscript_target_api),21),true)
my_generated_res_zips := $(rs_generated_res_zip) my_generated_res_zips := $(rs_generated_res_zip)
endif # renderscript_target_api < 21 endif # renderscript_target_api < 21
endif # renderscript_target_api is set endif # renderscript_target_api is set
include $(BUILD_SYSTEM)/aapt2.mk include $(BUILD_SYSTEM)/aapt2.mk
$(my_res_package) : $(framework_res_package_export) $(my_res_package) : $(framework_res_package_export)
$(my_res_package): .KATI_IMPLICIT_OUTPUTS += $(intermediates.COMMON)/R.txt $(my_res_package): .KATI_IMPLICIT_OUTPUTS += $(intermediates.COMMON)/R.txt
else
$(R_file_stamp): .KATI_IMPLICIT_OUTPUTS += $(intermediates.COMMON)/R.txt
$(R_file_stamp): PRIVATE_RESOURCE_LIST := $(all_resources)
$(R_file_stamp) : $(all_resources) $(full_android_manifest) $(AAPT) $(SOONG_ZIP) \
$(framework_res_package_export) $(rs_generated_res_zip)
@echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)"
$(create-resource-java-files)
$(hide) find $(PRIVATE_JAVA_GEN_DIR) -name R.java | xargs cat > $@
endif # LOCAL_USE_AAPT2
endif # need_compile_res endif # need_compile_res