Files
build/core/soong_android_app_set.mk
Dan Willemsen fd1e67b8ce More performance improvements
Instead of using `x := $(x) foo`, make sure `x` is initialized first,
then use `x += foo`.

For a aosp-master/aosp_crosshatch-userdebug build, this takes the build
from 49s to 33s (no significant difference in peak memory)

Bug: 158488548
Test: build-aosp_crosshatch.ninja is the same before/after
Change-Id: I41fb7611030dd3ba824f896a9c9eadbdd218f464
2020-06-08 19:10:23 -07:00

35 lines
1.2 KiB
Makefile

# 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)))
# unzip returns 11 it there was nothing to extract, which is expected,
# $(LOCAL_APK_SET_MASTER_FILE) has is already there.
LOCAL_POST_INSTALL_CMD := unzip -qo -j -d $(dir $(LOCAL_INSTALLED_MODULE)) \
$(LOCAL_PREBUILT_MODULE_FILE) -x $(LOCAL_APK_SET_MASTER_FILE) || [[ $$? -eq 11 ]]
$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
SOONG_ALREADY_CONV += $(LOCAL_MODULE)