Only zip2zip bundle resources if they exist

Only attempt to zip2zip the bundle parts/res.zip if it was created
because of full_classes_jar or PRIVATE_EXTRA_JAR_ARGS.

Bug: 117295826
Test: m dist on unbundled target with no resources or classes
Change-Id: I6072b29c7331201f33d196c24154f9947b4b0053
This commit is contained in:
Colin Cross 2018-11-05 10:13:10 -08:00
parent 4c9399d988
commit 85fa3def65
1 changed files with 6 additions and 3 deletions

View File

@ -711,15 +711,18 @@ ifeq ($(LOCAL_USE_AAPT2),true)
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))
$(if $(PRIVATE_EXTRA_JAR_ARGS),\
$(call create-java-resources-jar,$@.parts/res.zip) && \
$(ZIP2ZIP) -i $@.parts/res.zip -o $@.parts/res.zip.tmp "**/*:root/" && \
mv -f $@.parts/res.zip.tmp $@.parts/res.zip)
else # full_classes_jar
$(call create-dex-jar,$@.parts/dex.zip,$(PRIVATE_DEX_FILE))
$(ZIP2ZIP) -i $@.parts/dex.zip -o $@.parts/dex.zip.tmp "classes*.dex:dex/"
mv -f $@.parts/dex.zip.tmp $@.parts/dex.zip
$(call extract-resources-jar,$@.parts/res.zip,$(PRIVATE_SOURCE_ARCHIVE))
$(ZIP2ZIP) -i $@.parts/res.zip -o $@.parts/res.zip.tmp "**/*:root/"
mv -f $@.parts/res.zip.tmp $@.parts/res.zip
endif # full_classes_jar
$(ZIP2ZIP) -i $@.parts/res.zip -o $@.parts/res.zip.tmp "**/*:root/"
mv -f $@.parts/res.zip.tmp $@.parts/res.zip
$(MERGE_ZIPS) $@ $@.parts/*.zip
rm -rf $@.parts
ALL_MODULES.$(LOCAL_MODULE).BUNDLE := $(my_bundle_module)