Replace some uses of zip with merge_zips, soong_zip, and zip2zip

zip maintains permissions when adding files to zips, which causes
the final jars and apks to change based on the umask of the build.
Move some of the rules that were using zip to soong_zip instead.

Since soong_zip doesn't support adding files to existing zips,
create a new zip file for each part of the package creation
process and then merge them together at the end with merge_zips.

Bug: 69500920
Test: m checkbuild
Change-Id: Id253df776ce19ec4cac3a36fa470a50461ea3cad
This commit is contained in:
Colin Cross
2018-09-14 13:39:07 -07:00
parent 7b226865c1
commit c9e4976832
5 changed files with 75 additions and 65 deletions

View File

@@ -171,10 +171,15 @@ $(built_dex): $(full_classes_jar) $(DX) $(ZIP2ZIP)
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
$(LOCAL_BUILT_MODULE): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)
$(LOCAL_BUILT_MODULE): $(MERGE_ZIPS) $(SOONG_ZIP) $(ZIP2ZIP)
$(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources)
@echo "Host Jar: $(PRIVATE_MODULE) ($@)"
$(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@)
$(call add-dex-to-package,$@)
rm -rf $@.parts
mkdir -p $@.parts
$(call create-dex-jar,$@.parts/dex.zip,$(PRIVATE_DEX_FILE))
$(call extract-resources-jar,$@.parts/res.zip,$(PRIVATE_SOURCE_ARCHIVE))
$(MERGE_ZIPS) -j $@ $@.parts/dex.zip $@.parts/res.zip
rm -rf $@.parts
endif # !LOCAL_IS_STATIC_JAVA_LIBRARY