From b30ff0a65b0da20555714d488017cd01a97f8b98 Mon Sep 17 00:00:00 2001 From: Sasha Smundak Date: Tue, 5 May 2020 22:07:24 -0700 Subject: [PATCH] Implement android_app_set module. Bug: 152319766 Test: manual and builtin Change-Id: I66edc5b423898a11dbba1c3d9796c7bd4d6b4428 --- core/clear_vars.mk | 1 + core/soong_android_app_set.mk | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 core/soong_android_app_set.mk diff --git a/core/clear_vars.mk b/core/clear_vars.mk index 5af057036..c88a1cd95 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -21,6 +21,7 @@ LOCAL_ANNOTATION_PROCESSOR_CLASSES:= LOCAL_APIDIFF_NEWAPI:= LOCAL_APIDIFF_OLDAPI:= LOCAL_APK_LIBRARIES:= +LOCAL_APK_SET_MASTER_FILE:= LOCAL_ARM_MODE:= LOCAL_ASFLAGS:= LOCAL_ASSET_DIR:= diff --git a/core/soong_android_app_set.mk b/core/soong_android_app_set.mk new file mode 100644 index 000000000..e84371ca6 --- /dev/null +++ b/core/soong_android_app_set.mk @@ -0,0 +1,32 @@ +# App prebuilt coming from Soong. +# Extra inputs: +# LOCAL_APK_SET_MASTER_FILE + +ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK)) + $(call pretty-error,soong_apk_set.mk may only be used from Soong) +endif + +LOCAL_BUILT_MODULE_STEM := $(LOCAL_APK_SET_MASTER_FILE) +LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_APK_SET_MASTER_FILE) + +####################################### +include $(BUILD_SYSTEM)/base_rules.mk +####################################### + +## Extract master APK from APK set into given directory +# $(1) APK set +# $(2) master APK entry (e.g., splits/base-master.apk + +define extract-master-from-apk-set +$(LOCAL_BUILT_MODULE): $(1) + @echo "Extracting $$@" + unzip -pq $$< $(2) >$$@ +endef + +$(eval $(call extract-master-from-apk-set,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_APK_SET_MASTER_FILE))) +LOCAL_POST_INSTALL_CMD := unzip -qo -j -d $(dir $(LOCAL_INSTALLED_MODULE)) \ + $(LOCAL_PREBUILT_MODULE_FILE) -x $(LOCAL_APK_SET_MASTER_FILE) +$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD) +PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES)) + +SOONG_ALREADY_CONV := $(SOONG_ALREADY_CONV) $(LOCAL_MODULE)