summaryrefslogtreecommitdiffstats
path: root/core/package_internal.mk
diff options
context:
space:
mode:
authorYing Wang <wangying@google.com>2014-07-23 10:27:57 -0700
committerYing Wang <wangying@google.com>2014-07-23 16:38:06 -0700
commit7f625aad030999b685757bea2abcc2ecd542ed3c (patch)
treeabaf47df56baf6643853d9bb1955c3165638aec0 /core/package_internal.mk
parent84c26b694978eb6b9ee9400d15283707ea9b3eb9 (diff)
downloadbuild-7f625aad030999b685757bea2abcc2ecd542ed3c.zip
build-7f625aad030999b685757bea2abcc2ecd542ed3c.tar.gz
build-7f625aad030999b685757bea2abcc2ecd542ed3c.tar.bz2
Improve rules of split apks.
- Better messaging if the expected split apk isn't generated by the aapt command in the base apk rule; Remove the built base apk, so make will rerun aapt after the user changes the splitting parameters. - Use cleaner static pattern rules instead of running $(foreach) with $(eval). Bug: 16319961 Change-Id: If6ae302e1a39d2e0db8f784d4e1cf292ec855281
Diffstat (limited to 'core/package_internal.mk')
-rw-r--r--core/package_internal.mk22
1 files changed, 16 insertions, 6 deletions
diff --git a/core/package_internal.mk b/core/package_internal.mk
index a5b1142..3f8bdfe 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -410,19 +410,29 @@ endif
###############################
## APK splits
ifdef LOCAL_PACKAGE_SPLITS
+# LOCAL_PACKAGE_SPLITS is a list of resource labels.
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)
+# The splits should have been built in the same command building the base apk.
+# This rule just runs signing and zipalign etc.
+# Note that we explicily check the existence of the split apk and remove the
+# built base apk if the split apk isn't there.
+# That way the build system will rerun the aapt after the user changes the splitting parameters.
$(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))))
+$(built_apk_splits) : $(built_module_path)/%.apk : $(LOCAL_BUILT_MODULE)
+ $(hide) if [ ! -f $@ ]; then \
+ echo 'No $@ generated, check your apk splitting parameters.' 1>&2; \
+ rm $<; exit 1; \
+ fi
+ $(sign-package)
+ $(align-package)
# 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)))
+$(installed_apk_splits) : $(my_module_path)/$(LOCAL_MODULE)_%.apk : $(built_module_path)/package_%.apk | $(ACP)
+ @echo "Install: $@"
+ $(copy-file-to-new-target)
# Register the additional built and installed files.
ALL_MODULES.$(my_register_name).INSTALLED += $(installed_apk_splits)