summaryrefslogtreecommitdiffstats
path: root/core/package_internal.mk
diff options
context:
space:
mode:
authorYing Wang <wangying@google.com>2014-07-22 15:42:11 -0700
committerYing Wang <wangying@google.com>2014-07-22 17:37:11 -0700
commit1425e2d8c08663987f2d1004c55e6060d1ce6dfe (patch)
tree229d2fb2fcdd49625fe318354390ed03d746a386 /core/package_internal.mk
parent337bbf89d92f28bff85273ffefb71d3e5d7f57fc (diff)
downloadbuild-1425e2d8c08663987f2d1004c55e6060d1ce6dfe.zip
build-1425e2d8c08663987f2d1004c55e6060d1ce6dfe.tar.gz
build-1425e2d8c08663987f2d1004c55e6060d1ce6dfe.tar.bz2
Support LOCAL_PACKAGE_SPLITS.
Support LOCAL_PACKAGE_SPLITS, which accepts a list of resource lables and generates multiple apks. The build system sets up rules to sign and zipalign the split apks. Bug: 16319961 Change-Id: I344b3d1c7eb158c6d0df879093d666a89870aadd
Diffstat (limited to 'core/package_internal.mk')
-rw-r--r--core/package_internal.mk30
1 files changed, 30 insertions, 0 deletions
diff --git a/core/package_internal.mk b/core/package_internal.mk
index c76792d..a5b1142 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -68,6 +68,10 @@ ifeq ($(filter tests, $(LOCAL_MODULE_TAGS)),)
LOCAL_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) -z
endif
+ifdef LOCAL_PACKAGE_SPLITS
+LOCAL_AAPT_FLAGS += $(addprefix --split ,$(LOCAL_PACKAGE_SPLITS))
+endif
+
ifeq (,$(LOCAL_ASSET_DIR))
LOCAL_ASSET_DIR := $(LOCAL_PATH)/assets
endif
@@ -403,6 +407,32 @@ $(built_odex) : $(built_dex)
$(hide) rm $@.input
endif
+###############################
+## APK splits
+ifdef LOCAL_PACKAGE_SPLITS
+built_apk_splits := $(foreach s,$(LOCAL_PACKAGE_SPLITS),$(built_module_path)/package_$(s).apk)
+installed_apk_splits := $(foreach s,$(LOCAL_PACKAGE_SPLITS),$(my_module_path)/$(LOCAL_MODULE)_$(s).apk)
+
+$(built_apk_splits): PRIVATE_PRIVATE_KEY := $(private_key)
+$(built_apk_splits): PRIVATE_CERTIFICATE := $(certificate)
+# The splits should have been built in the same command building the base apk.
+# This rule just establishes the dependency and make sure the splits are up to date.
+$(foreach s,$(built_apk_splits),\
+ $(eval $(call build-split-apk,$(s),$(LOCAL_BUILT_MODULE))))
+
+# Rules to install the splits
+$(foreach s,$(LOCAL_PACKAGE_SPLITS),\
+ $(eval $(call copy-one-file,$(built_module_path)/package_$(s).apk,$(my_module_path)/$(LOCAL_MODULE)_$(s).apk)))
+
+# Register the additional built and installed files.
+ALL_MODULES.$(my_register_name).INSTALLED += $(installed_apk_splits)
+ALL_MODULES.$(my_register_name).BUILT_INSTALLED += \
+ $(foreach s,$(LOCAL_PACKAGE_SPLITS),$(built_module_path)/package_$(s).apk:$(my_module_path)/$(LOCAL_MODULE)_$(s).apk)
+
+# Make sure to install the splits when you run "make <module_name>".
+$(my_register_name): $(installed_apk_splits)
+endif # LOCAL_PACKAGE_SPLITS
+
# Save information about this package
PACKAGES.$(LOCAL_PACKAGE_NAME).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
PACKAGES.$(LOCAL_PACKAGE_NAME).RESOURCE_FILES := $(all_resources)