2020-05-06 05:07:24 +00:00
|
|
|
# App prebuilt coming from Soong.
|
|
|
|
# Extra inputs:
|
2020-07-28 21:21:14 +00:00
|
|
|
# LOCAL_APK_SET_INSTALL_FILE
|
2020-05-06 05:07:24 +00:00
|
|
|
|
|
|
|
ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
|
|
|
|
$(call pretty-error,soong_apk_set.mk may only be used from Soong)
|
|
|
|
endif
|
|
|
|
|
2020-07-28 21:21:14 +00:00
|
|
|
LOCAL_BUILT_MODULE_STEM := $(LOCAL_APK_SET_INSTALL_FILE)
|
|
|
|
LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_APK_SET_INSTALL_FILE)
|
2020-05-06 05:07:24 +00:00
|
|
|
|
|
|
|
#######################################
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
#######################################
|
|
|
|
|
|
|
|
## Extract master APK from APK set into given directory
|
|
|
|
# $(1) APK set
|
2020-07-28 21:21:14 +00:00
|
|
|
# $(2) APK entry to install (e.g., splits/base.apk
|
2020-05-06 05:07:24 +00:00
|
|
|
|
2020-07-28 21:21:14 +00:00
|
|
|
define extract-install-file-from-apk-set
|
2020-05-06 05:07:24 +00:00
|
|
|
$(LOCAL_BUILT_MODULE): $(1)
|
|
|
|
@echo "Extracting $$@"
|
|
|
|
unzip -pq $$< $(2) >$$@
|
|
|
|
endef
|
|
|
|
|
2020-07-28 21:21:14 +00:00
|
|
|
$(eval $(call extract-install-file-from-apk-set,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_APK_SET_INSTALL_FILE)))
|
2020-05-20 00:36:56 +00:00
|
|
|
# unzip returns 11 it there was nothing to extract, which is expected,
|
2020-07-28 21:21:14 +00:00
|
|
|
# $(LOCAL_APK_SET_INSTALL_FILE) has is already there.
|
2020-07-12 05:33:30 +00:00
|
|
|
LOCAL_POST_INSTALL_CMD := unzip -qoDD -j -d $(dir $(LOCAL_INSTALLED_MODULE)) \
|
2020-07-28 21:21:14 +00:00
|
|
|
$(LOCAL_PREBUILT_MODULE_FILE) -x $(LOCAL_APK_SET_INSTALL_FILE) || [[ $$? -eq 11 ]]
|
2020-05-06 05:07:24 +00:00
|
|
|
$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
|
|
|
|
PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
|
|
|
|
|
2020-06-25 23:06:21 +00:00
|
|
|
PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
|
2020-06-30 02:37:53 +00:00
|
|
|
# We can't know exactly what apk files would be outputted yet.
|
|
|
|
# Let extract_apks generate apkcerts.txt and merge it later.
|
|
|
|
PACKAGES.$(LOCAL_MODULE).APKCERTS_FILE := $(LOCAL_APKCERTS_FILE)
|
2020-06-25 23:06:21 +00:00
|
|
|
|
2020-06-09 01:50:14 +00:00
|
|
|
SOONG_ALREADY_CONV += $(LOCAL_MODULE)
|