Dist userdataimg and tests-zip-package for tests builds

So that the build server can run the following command to build and dist only the two packages:
make -j16 tests-zip-package userdataimage-nodeps dist showcommands TARGET_BUILD_VARIANT=tests TARGET_PRODUCT=passion

Change-Id: I03d7049582ec8537a389e80b7ecdcae6625222ea
diff --git a/core/Makefile b/core/Makefile
index f66710c..1e49bd1 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -874,6 +874,8 @@
 .PHONY: userdataimage-nodeps
 userdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
 	$(build-userdataimage-target)
+	$(hide)mkdir -p $(DIST_DIR)
+	$(hide)cp $(INSTALLED_USERDATAIMAGE_TARGET) $(DIST_DIR)
 
 #######
 ## data partition tarball
@@ -1172,8 +1174,17 @@
 		$(TARGET_OUT_DATA),$(zip_root)/DATA)
 	$(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
 
+.PHONY: tests-zip-package
 tests-zip-package: $(BUILT_TESTS_ZIP_PACKAGE)
 
+# Dist the files needed by tests builds
+# So the build server can run the following commands to build tests packages while avoid a full build:
+# $make -j16 tests-zip-package userdataimage-nodeps dist showcommands TARGET_BUILD_VARIANT=tests TARGET_PRODUCT=passion
+ifeq ($(filter $(DEFAULT_GOAL) tests-zip-package,$(MAKECMDGOALS)),tests-zip-package)
+  $(call dist-for-goals, tests-zip-package, \
+     $(BUILT_TESTS_ZIP_PACKAGE))
+endif
+
 # -----------------------------------------------------------------
 # A zip of the symbols directory.  Keep the full paths to make it
 # more obvious where these files came from.