Improve on unbundled app build
1. build only apps specified in APP-xxx.
2. support building multiple apps in a single make: make APP-Gmail-GmailTests-xxx
Change-Id: I863d3b503a240ae43652e9b18043b60416bcc25a
diff --git a/core/main.mk b/core/main.mk
index b6c8c14..8943f4f 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -692,12 +692,17 @@
# on the build variant.
.PHONY: droid tests
ifeq ($(strip $(is_unbundled_app_build)),true)
-# We build all modules in the source tree for an unbundled app build.
+unbundled_build_modules :=
+ifdef UNBUNDLED_APPS
+unbundled_build_modules := $(UNBUNDLED_APPS)
+else # UNBUNDLED_APPS
+# Otherwise we build all modules in the source tree.
unbundled_build_modules := $(sort $(call get-tagged-modules,$(ALL_MODULE_TAGS)))
+endif # UNBUNDLED_APPS
droid: $(unbundled_build_modules)
-else
+else # is_unbundled_app_build
droid: droidcore
-endif
+endif # is_unbundled_app_build
tests: droidcore
# Dist for droid if droid is among the cmd goals, or no cmd goal is given.
@@ -736,11 +741,11 @@
else # is_unbundled_app_build
# dist the unbundled app.
-ifdef UNBUNDLED_APP
+ifdef UNBUNDLED_APPS
$(call dist-for-goals,droid, \
- $(ALL_MODULES.$(UNBUNDLED_APP).INSTALLED) \
+ $(foreach m,$(UNBUNDLED_APPS),$(ALL_MODULES.$(m).INSTALLED)) \
)
-endif # UNBUNDLED_APP
+endif # UNBUNDLED_APPS
endif # is_unbundled_app_build
endif # droid in $(MAKECMDGOALS)
diff --git a/core/product_config.mk b/core/product_config.mk
index 7e608f6..a7eba92 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -157,7 +157,7 @@
ifneq ($(words $(unbundled_goals)),1)
$(error Only one APP-* goal may be specified; saw "$(unbundled_goals)"))
endif
- UNBUNDLED_APP := $(patsubst APP-%,%,$(unbundled_goals))
+ UNBUNDLED_APPS := $(strip $(subst -, ,$(patsubst APP-%,%,$(unbundled_goals))))
ifneq ($(filter $(DEFAULT_GOAL),$(MAKECMDGOALS)),)
MAKECMDGOALS := $(patsubst $(unbundled_goals),,$(MAKECMDGOALS))
else