Cherry-pick unbundled build changes from master
Change-Id: I82cab32f00b7b729d9b01c8e1532c8bf0ad2fb92
diff --git a/core/main.mk b/core/main.mk
index f830f03..9485a02 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -689,8 +689,21 @@
# The actual files built by the droidcore target changes depending
# on the build variant.
.PHONY: droid tests
-droid tests: droidcore
+ifeq ($(strip $(is_unbundled_app_build)),true)
+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 # is_unbundled_app_build
+droid: droidcore
+endif # is_unbundled_app_build
+tests: droidcore
+ifneq ($(strip $(is_unbundled_app_build)),true)
$(call dist-for-goals, droid, \
$(INTERNAL_UPDATE_PACKAGE_TARGET) \
$(INTERNAL_OTA_PACKAGE_TARGET) \
@@ -715,6 +728,15 @@
)
endif
+else # is_unbundled_app_build
+# dist the unbundled app.
+ifdef UNBUNDLED_APPS
+ $(call dist-for-goals,droid, \
+ $(foreach m,$(UNBUNDLED_APPS),$(ALL_MODULES.$(m).INSTALLED)) \
+ )
+endif # UNBUNDLED_APPS
+endif # is_unbundled_app_build
+
.PHONY: docs
docs: $(ALL_DOCS)