forked from openkylin/platform_build
Merge "Use zip2zip for uncompress-dexs and uncompress-shared-libs"
This commit is contained in:
commit
0ab356ac20
|
@ -2410,25 +2410,18 @@ endef
|
|||
# Uncompress dex files embedded in an apk.
|
||||
#
|
||||
define uncompress-dexs
|
||||
$(hide) if (zipinfo $@ '*.dex' 2>/dev/null | grep -v ' stor ' >/dev/null) ; then \
|
||||
tmpdir=$@.tmpdir; \
|
||||
rm -rf $$tmpdir && mkdir $$tmpdir; \
|
||||
unzip -q $@ '*.dex' -d $$tmpdir && \
|
||||
zip -qd $@ '*.dex' && \
|
||||
( cd $$tmpdir && find . -type f | sort | zip -qD -X -0 ../$(notdir $@) -@ ) && \
|
||||
rm -rf $$tmpdir; \
|
||||
if (zipinfo $@ '*.dex' 2>/dev/null | grep -v ' stor ' >/dev/null) ; then \
|
||||
$(ZIP2ZIP) -i $@ -o $@.tmp -0 "classes*.dex" && \
|
||||
mv -f $@.tmp $@ ; \
|
||||
fi
|
||||
endef
|
||||
|
||||
# Uncompress shared libraries embedded in an apk.
|
||||
#
|
||||
define uncompress-shared-libs
|
||||
$(hide) if (zipinfo $@ $(PRIVATE_EMBEDDED_JNI_LIBS) 2>/dev/null | grep -v ' stor ' >/dev/null) ; then \
|
||||
rm -rf $(dir $@)uncompressedlibs && mkdir $(dir $@)uncompressedlibs; \
|
||||
unzip -q $@ $(PRIVATE_EMBEDDED_JNI_LIBS) -d $(dir $@)uncompressedlibs && \
|
||||
zip -qd $@ 'lib/*.so' && \
|
||||
( cd $(dir $@)uncompressedlibs && find lib -type f | sort | zip -qD -X -0 ../$(notdir $@) -@ ) && \
|
||||
rm -rf $(dir $@)uncompressedlibs; \
|
||||
if (zipinfo $@ $(PRIVATE_EMBEDDED_JNI_LIBS) 2>/dev/null | grep -v ' stor ' >/dev/null) ; then \
|
||||
$(ZIP2ZIP) -i $@ -o $@.tmp $(addprefix -0 ,$(patsubst 'lib/*.so','lib/**/*.so',$(PRIVATE_EMBEDDED_JNI_LIBS))) && \
|
||||
mv -f $@.tmp $@ ; \
|
||||
fi
|
||||
endef
|
||||
|
||||
|
@ -2473,7 +2466,7 @@ $(2): $(1)
|
|||
endef
|
||||
|
||||
define copy-and-uncompress-dexs
|
||||
$(2): $(1) $(ZIPALIGN)
|
||||
$(2): $(1) $(ZIPALIGN) $(ZIP2ZIP)
|
||||
@echo "Uncompress dexs in: $$@"
|
||||
$$(copy-file-to-target)
|
||||
$$(uncompress-dexs)
|
||||
|
|
|
@ -620,6 +620,9 @@ endif # LOCAL_USE_AAPT2
|
|||
ifdef LOCAL_COMPRESSED_MODULE
|
||||
$(LOCAL_BUILT_MODULE) : $(MINIGZIP)
|
||||
endif
|
||||
ifeq (true, $(LOCAL_UNCOMPRESS_DEX))
|
||||
$(LOCAL_BUILT_MODULE) : $(ZIP2ZIP)
|
||||
endif
|
||||
ifneq ($(BUILD_PLATFORM_ZIP),)
|
||||
$(LOCAL_BUILT_MODULE) : .KATI_IMPLICIT_OUTPUTS := $(dir $(LOCAL_BUILT_MODULE))package.dex.apk
|
||||
endif
|
||||
|
@ -685,6 +688,9 @@ endif
|
|||
## Rule to build the odex file
|
||||
ifdef LOCAL_DEX_PREOPT
|
||||
$(built_odex): PRIVATE_DEX_FILE := $(built_dex)
|
||||
ifeq (true, $(LOCAL_UNCOMPRESS_DEX))
|
||||
$(built_odex): $(ZIP2ZIP)
|
||||
endif
|
||||
# Use pattern rule - we may have multiple built odex files.
|
||||
$(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(built_dex)
|
||||
$(hide) mkdir -p $(dir $@) && rm -f $@
|
||||
|
|
|
@ -342,6 +342,7 @@ ifndef embedded_prebuilt_jni_libs
|
|||
embedded_prebuilt_jni_libs := 'lib/*.so'
|
||||
endif
|
||||
$(built_module): PRIVATE_EMBEDDED_JNI_LIBS := $(embedded_prebuilt_jni_libs)
|
||||
$(built_module): $(ZIP2ZIP)
|
||||
|
||||
ifdef LOCAL_COMPRESSED_MODULE
|
||||
$(built_module) : $(MINIGZIP)
|
||||
|
|
Loading…
Reference in New Issue