From 6a4bd696f6df71187be9c9a406ad5cbe101596f1 Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Mon, 14 Aug 2017 10:53:50 +0100 Subject: [PATCH] apkcerts: Add information about the compressed state of the APK. We add a compressed="$extension" attribute to an APK's entry if it's compressed. Bug: 64531948 Test: make dist Change-Id: Ic3f95ed77f0bb16dec825bae944c70ee2d130657 --- core/Makefile | 14 ++++++-------- core/package_internal.mk | 1 + core/prebuilt_internal.mk | 1 + 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/Makefile b/core/Makefile index d180ef5f8..7c54fdb86 100644 --- a/core/Makefile +++ b/core/Makefile @@ -419,8 +419,10 @@ package-stats: $(PACKAGE_STATS_FILE) # ----------------------------------------------------------------- # Cert-to-package mapping. Used by the post-build signing tools. # Use a macro to add newline to each echo command -define _apkcerts_echo_with_newline -$(hide) echo $(1) +define _apkcerts_write_line +$(hide) echo -n 'name="$(1).apk" certificate="$2" private_key="$3"' >> $5 +$(if $(4), $(hide) echo -n ' compressed="$4"' >> $5) +$(hide) echo '' >> $5 endef @@ -440,12 +442,8 @@ $(APKCERTS_FILE): @rm -f $@ $(foreach p,$(PACKAGES),\ $(if $(PACKAGES.$(p).EXTERNAL_KEY),\ - $(call _apkcerts_echo_with_newline,\ - 'name="$(p).apk" certificate="EXTERNAL" \ - private_key=""' >> $@),\ - $(call _apkcerts_echo_with_newline,\ - 'name="$(p).apk" certificate="$(PACKAGES.$(p).CERTIFICATE)" \ - private_key="$(PACKAGES.$(p).PRIVATE_KEY)"' >> $@))) + $(call _apkcerts_write_line,$(p),"EXTERNAL","",$(PACKAGES.$(p).COMPRESSED),$@),\ + $(call _apkcerts_write_line,$(p),$(PACKAGES.$(p).CERTIFICATE),$(PACKAGES.$(p).PRIVATE_KEY),$(PACKAGES.$(p).COMPRESSED),$@))) # In case value of PACKAGES is empty. $(hide) touch $@ diff --git a/core/package_internal.mk b/core/package_internal.mk index 28c3a0882..2eb806c38 100644 --- a/core/package_internal.mk +++ b/core/package_internal.mk @@ -222,6 +222,7 @@ endif endif ifdef LOCAL_COMPRESSED_MODULE +PACKAGES.$(LOCAL_PACKAGE_NAME).COMPRESSED := gz LOCAL_BUILT_MODULE_STEM := package.apk.gz LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE).apk.gz else # !LOCAL_COMPRESSED_MODULE diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk index edda97e55..48593a5b4 100644 --- a/core/prebuilt_internal.mk +++ b/core/prebuilt_internal.mk @@ -120,6 +120,7 @@ endif # LOCAL_COMPRESSED_MODULE ifndef LOCAL_INSTALLED_MODULE_STEM ifdef LOCAL_COMPRESSED_MODULE +PACKAGES.$(LOCAL_MODULE).COMPRESSED := gz LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE).apk.gz else LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE).apk