Add phony target to build and dist sample code.
See http://b/issue?id=2468418
After this CL, add "samplecode" to your make goals, you will get the sample apks
built and installed at out/target/common/samples/.
Change-Id: Iff83f2ba6b6c2fe6ac1c78ca4a9d4bc6953dac8a
diff --git a/core/main.mk b/core/main.mk
index 71e8acb..3ffb084 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -727,6 +727,20 @@
$(SYMBOLS_ZIP) \
)
+.PHONY: samplecode
+sample_MODULES := $(sort $(call get-tagged-modules,samples))
+sample_APKS_DEST_PATH := $(TARGET_COMMON_OUT_ROOT)/samples
+sample_APKS_COLLECTION := \
+ $(foreach module,$(sample_MODULES),$(sample_APKS_DEST_PATH)/$(notdir $(module)))
+$(foreach module,$(sample_MODULES),$(eval $(call \
+ copy-one-file,$(module),$(sample_APKS_DEST_PATH)/$(notdir $(module)))))
+sample_ADDITIONAL_INSTALLED := \
+ $(filter-out $(modules_to_install) $(modules_to_check) $(ALL_PREBUILT),$(sample_MODULES))
+samplecode: $(sample_APKS_COLLECTION)
+ @echo "Collect sample code apks: $^"
+ # remove apks that are not intended to be installed.
+ rm -f $(sample_ADDITIONAL_INSTALLED)
+
.PHONY: findbugs
findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET)