Revert "Revert "Copy resources from classes.jar when using AAPT2""

This reverts commit a7e336d17a.

Reapplies I6649f7f2fbf63ff5001f4731e22960f857726c70 with fix
for jack builds.

Bug: 64272170
Test: https://android-build.googleplex.com/builds/view-workplan?viewType=Table&workplanId=L93000000088657848&nodeType=Trybot
Change-Id: Id66aebfc2c26a4467e6cf25e4372080882f0b286
Merged-In: Id66aebfc2c26a4467e6cf25e4372080882f0b286
(cherry picked from commit 6fedebf936)
This commit is contained in:
Colin Cross 2017-08-03 03:17:34 +00:00
parent cf021094f1
commit 303567c922
2 changed files with 19 additions and 0 deletions

View File

@ -2684,6 +2684,17 @@ define add-carried-jack-resources
fi
endef
# Add resources (non .class files) from a jar to a package
# $(1): the package file
# $(2): the jar file
# $(3): temporary directory
define add-jar-resources-to-package
rm -rf $(3)
mkdir -p $(3)
unzip -qo $(2) -d $(3) $$(zipinfo -1 $(2) | grep -v -E "\.class$$")
$(JAR) uf $(1) -C $(3) .
endef
# Sign a package using the specified key/cert.
#
define sign-package

View File

@ -548,7 +548,10 @@ else
$(my_res_package) $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(PRODUCT_AAPT_PREF_CONFIG)
endif
endif
$(LOCAL_BUILT_MODULE): PRIVATE_DONT_DELETE_JAR_DIRS := $(LOCAL_DONT_DELETE_JAR_DIRS)
$(LOCAL_BUILT_MODULE): PRIVATE_RESOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/resources
$(LOCAL_BUILT_MODULE): PRIVATE_FULL_CLASSES_JAR := $(full_classes_jar)
$(LOCAL_BUILT_MODULE) : $(jni_shared_libraries)
ifdef LOCAL_USE_AAPT2
$(LOCAL_BUILT_MODULE): PRIVATE_RES_PACKAGE := $(my_res_package)
@ -577,6 +580,11 @@ ifeq ($(full_classes_jar),)
$(if $(PRIVATE_EXTRA_JAR_ARGS),$(call add-java-resources-to,$@))
else # full_classes_jar
$(add-dex-to-package)
ifdef LOCAL_USE_AAPT2
ifndef LOCAL_JACK_ENABLED
$(call add-jar-resources-to-package,$@,$(PRIVATE_FULL_CLASSES_JAR),$(PRIVATE_RESOURCE_INTERMEDIATES_DIR))
endif
endif
endif # full_classes_jar
ifdef LOCAL_JACK_ENABLED
$(add-carried-jack-resources)