Remove build variant "tests"
Bug: 5368571
Now we have a phony target "tests" instead.
The target can be built in any other build variant (eg userdebug).
For example, "make PRODUCT-full-userdebug tests dist" will build and
put the *-test-* zip file in the dist dir.
The "tests" target will include all modules tagged as "tests" in
addition to other modules in specific target out directories.
Change-Id: I8383097380d8e6846c3e2107d6dd5f68788cfc39
diff --git a/core/Makefile b/core/Makefile
index 69bedf7..3828f53 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1214,6 +1214,7 @@
endif # TARGET_DEVICE != generic*
endif # TARGET_PRODUCT != sdk
+ifdef is_tests_build
# -----------------------------------------------------------------
# A zip of the tests that are built when running "make tests".
# This is very similar to BUILT_TARGET_FILES_PACKAGE, but we
@@ -1244,23 +1245,13 @@
$(TARGET_OUT_DATA),$(zip_root)/DATA)
$(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
-.PHONY: tests-zip-package
-tests-zip-package: $(BUILT_TESTS_ZIP_PACKAGE)
-
-# Target needed by tests build
-.PHONY: tests-build-target
-tests-build-target: $(BUILT_TESTS_ZIP_PACKAGE)
-
-ifneq (,$(filter $(MAKECMDGOALS),tests-build-target))
- $(call dist-for-goals, tests-build-target, \
- $(BUILT_TESTS_ZIP_PACKAGE))
-endif
-
.PHONY: tests
tests: $(BUILT_TESTS_ZIP_PACKAGE)
+
ifneq (,$(filter tests, $(MAKECMDGOALS)))
-$(call dist-for-goals, tests, $(BUILT_TESTS_ZIP_PACKAGE))
+ $(call dist-for-goals, tests, $(BUILT_TESTS_ZIP_PACKAGE))
endif
+endif # is_tests_build
# -----------------------------------------------------------------
# A zip of the symbols directory. Keep the full paths to make it
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 2ad6801..7ede47d 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -114,10 +114,10 @@
# variables that we need in order to locate the output files.
include $(BUILD_SYSTEM)/product_config.mk
-build_variant := $(filter-out user userdebug eng tests,$(TARGET_BUILD_VARIANT))
+build_variant := $(filter-out eng user userdebug,$(TARGET_BUILD_VARIANT))
ifneq ($(build_variant)-$(words $(TARGET_BUILD_VARIANT)),-1)
$(warning bad TARGET_BUILD_VARIANT: $(TARGET_BUILD_VARIANT))
-$(error must be empty or one of: user userdebug eng tests)
+$(error must be empty or one of: eng user userdebug)
endif
# ---------------------------------------------------------------
diff --git a/core/main.mk b/core/main.mk
index e5c1b65..d86783b 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -232,8 +232,8 @@
ifneq ($(filter user userdebug eng,$(MAKECMDGOALS)),)
$(info ***************************************************************)
$(info ***************************************************************)
-$(info Do not pass '$(filter user userdebug eng tests,$(MAKECMDGOALS))' on \
- the make command line.)
+$(info Do not pass '$(filter user userdebug eng,$(MAKECMDGOALS))' on \
+ the make command line.)
$(info Set TARGET_BUILD_VARIANT in buildspec.mk, or use lunch or)
$(info choosecombo.)
$(info ***************************************************************)
@@ -345,12 +345,6 @@
endif
endif
-## tests ##
-
-ifeq ($(TARGET_BUILD_VARIANT),tests)
-tags_to_install := debug eng tests
-endif
-
## sdk ##
ifdef is_sdk_build
diff --git a/core/product_config.mk b/core/product_config.mk
index e05907d..bfbdf78 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -82,7 +82,7 @@
# These are the valid values of TARGET_BUILD_VARIANT. Also, if anything else is passed
# as the variant in the PRODUCT-$TARGET_BUILD_PRODUCT-$TARGET_BUILD_VARIANT form,
# it will be treated as a goal, and the eng variant will be used.
-INTERNAL_VALID_VARIANTS := user userdebug eng tests
+INTERNAL_VALID_VARIANTS := user userdebug eng
# ---------------------------------------------------------------
# Provide "PRODUCT-<prodname>-<goal>" targets, which lets you build
@@ -109,6 +109,10 @@
# The variant they want
TARGET_BUILD_VARIANT := $(word 2,$(product_goals))
+ ifeq ($(TARGET_BUILD_VARIANT),tests)
+ $(error "tests" has been deprecated as a build variant. Use it as a build goal instead.)
+ endif
+
# The build server wants to do make PRODUCT-dream-installclean
# which really means TARGET_PRODUCT=dream make installclean.
ifneq ($(filter-out $(INTERNAL_VALID_VARIANTS),$(TARGET_BUILD_VARIANT)),)
@@ -119,11 +123,6 @@
default_goal_substitution := $(DEFAULT_GOAL)
endif
- # For tests build, only build tests-build-target
- ifeq (tests,$(TARGET_BUILD_VARIANT))
- default_goal_substitution := tests-build-target
- endif
-
# Replace the PRODUCT-* goal with the build goal that it refers to.
# Note that this will ensure that it appears in the same relative
# position, in case it matters.