Merge "Extract primary APK from apk sets in Soong" am: 345da983ad

Original change: https://android-review.googlesource.com/c/platform/build/+/1893500

Change-Id: Ib27dd9280f1aeabe0ba1f201518b0a8db06f0215
This commit is contained in:
Colin Cross 2021-11-19 02:33:56 +00:00 committed by Automerger Merge Worker
commit 013b1ee778

View file

@ -6,9 +6,8 @@ ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
$(call pretty-error,soong_apk_set.mk may only be used from Soong) $(call pretty-error,soong_apk_set.mk may only be used from Soong)
endif endif
LOCAL_BUILT_MODULE_STEM := $(LOCAL_APK_SET_INSTALL_FILE) LOCAL_BUILT_MODULE_STEM := package.apk
LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_APK_SET_INSTALL_FILE) LOCAL_INSTALLED_MODULE_STEM := $(notdir $(LOCAL_PREBUILT_MODULE_FILE))
# Use the Soong output as the checkbuild target instead of LOCAL_BUILT_MODULE # Use the Soong output as the checkbuild target instead of LOCAL_BUILT_MODULE
# to avoid checkbuilds making an extra copy of every module. # to avoid checkbuilds making an extra copy of every module.
@ -18,22 +17,8 @@ LOCAL_CHECKED_MODULE := $(LOCAL_PREBUILT_MODULE_FILE)
include $(BUILD_SYSTEM)/base_rules.mk include $(BUILD_SYSTEM)/base_rules.mk
####################################### #######################################
## Extract master APK from APK set into given directory $(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE)))
# $(1) APK set
# $(2) APK entry to install (e.g., splits/base.apk
define extract-install-file-from-apk-set
$(LOCAL_BUILT_MODULE): $(1)
@echo "Extracting $$@"
unzip -pq $$< $(2) >$$@
endef
$(eval $(call extract-install-file-from-apk-set,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_APK_SET_INSTALL_FILE)))
# unzip returns 11 it there was nothing to extract, which is expected,
# $(LOCAL_APK_SET_INSTALL_FILE) has is already there.
LOCAL_POST_INSTALL_CMD := unzip -qoDD -j -d $(dir $(LOCAL_INSTALLED_MODULE)) \
$(LOCAL_PREBUILT_MODULE_FILE) -x $(LOCAL_APK_SET_INSTALL_FILE) || [[ $$? -eq 11 ]]
$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES)) PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
PACKAGES := $(PACKAGES) $(LOCAL_MODULE) PACKAGES := $(PACKAGES) $(LOCAL_MODULE)