Merge "Target "tests" now only builds the modules tagged as "tests""

This commit is contained in:
Ying Wang 2014-05-08 23:43:31 +00:00 committed by Android (Google) Code Review
commit 151c5060c9
3 changed files with 14 additions and 59 deletions

View File

@ -13,8 +13,6 @@ else
FILE_NAME_TAG := $(BUILD_NUMBER)
endif
is_tests_build := $(filter tests,$(MAKECMDGOALS))
# -----------------------------------------------------------------
# Define rules to copy PRODUCT_COPY_FILES defined by the product.
# PRODUCT_COPY_FILES contains words like <source file>:<dest file>[:<owner>].
@ -839,14 +837,6 @@ INTERNAL_SYSTEMIMAGE_FILES := $(filter $(TARGET_OUT)/%, \
$(PDK_FUSION_SYSIMG_FILES) \
$(RECOVERY_RESOURCE_ZIP))
ifdef is_tests_build
# We don't want to install tests modules to the system partition
# when building "tests", because now "tests" may be built in a user, userdebug
# or eng build variant and we don't want to pollute the system partition.
# INTERNAL_SYSTEMIMAGE_FILES += $(filter $(TARGET_OUT)/%, \
# $(tests_MODULES))
endif
FULL_SYSTEMIMAGE_DEPS := $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
# -----------------------------------------------------------------
# installed file list
@ -1023,12 +1013,6 @@ boottarball-nodeps btnod: $(FS_GET_STATS) \
INTERNAL_USERDATAIMAGE_FILES := \
$(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
# If we build "tests" at the same time, make sure $(tests_MODULES) get covered.
ifdef is_tests_build
INTERNAL_USERDATAIMAGE_FILES += \
$(filter $(TARGET_OUT_DATA)/%,$(tests_MODULES))
endif
# Don't build userdata.img if it's extfs but no partition size
skip_userdata.img :=
ifdef INTERNAL_USERIMAGES_EXT_VARIANT
@ -1410,45 +1394,6 @@ endif # TARGET_NO_KERNEL != true
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
# only grab DATA, and it's called "*-tests-*.zip".
#
name := $(TARGET_PRODUCT)
ifeq ($(TARGET_BUILD_TYPE),debug)
name := $(name)_debug
endif
name := $(name)-tests-$(FILE_NAME_TAG)
intermediates := $(call intermediates-dir-for,PACKAGING,tests_zip)
BUILT_TESTS_ZIP_PACKAGE := $(intermediates)/$(name).zip
$(BUILT_TESTS_ZIP_PACKAGE): intermediates := $(intermediates)
$(BUILT_TESTS_ZIP_PACKAGE): zip_root := $(intermediates)/$(name)
# Depending on the image dependency files, instead of the image files itself,
# guarantees that the underlying directories are up-to-date,
# but don't really build the image.
$(BUILT_TESTS_ZIP_PACKAGE): \
$(INTERNAL_USERDATAIMAGE_FILES) \
| $(ACP)
@echo "Package test files: $@"
$(hide) rm -rf $@ $(zip_root)
$(hide) mkdir -p $(dir $@) $(zip_root)
@# Contents of the data image
$(hide) $(call package_files-copy-root, \
$(TARGET_OUT_DATA),$(zip_root)/DATA)
$(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
.PHONY: tests
tests: $(BUILT_TESTS_ZIP_PACKAGE)
ifneq (,$(filter tests, $(MAKECMDGOALS)))
$(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
# more obvious where these files came from.

View File

@ -1002,7 +1002,7 @@ $(call dist-for-goals,sdk win_sdk, \
# umbrella targets to assit engineers in verifying builds
.PHONY: java native target host java-host java-target native-host native-target \
java-host-tests java-target-tests native-host-tests native-target-tests \
java-tests native-tests host-tests target-tests
java-tests native-tests host-tests target-tests tests
# some synonyms
.PHONY: host-java target-java host-native target-native \
target-java-tests target-native-tests
@ -1012,6 +1012,7 @@ host-native : native-host
target-native : native-target
target-java-tests : java-target-tests
target-native-tests : native-target-tests
tests : host-tests target-tests
.PHONY: lintall

View File

@ -16,15 +16,24 @@ my_pickup_files :=
# Search for modules' built files and installed files;
# Calculate the dest files in the output zip file.
# If for 1 module name we found multiple installed files,
# we use suffix matching to find the corresponding built file.
$(foreach m,$(my_modules),\
$(if $(ALL_MODULES.$(m).INSTALLED),,\
$(warning Unknown installed file for module '$(m)'))\
$(warning Unknown installed file for module '$(m)'))\
$(eval my_pickup_files += $(ALL_MODULES.$(m).PICKUP_FILES))\
$(foreach i,$(filter $(TARGET_OUT_ROOT)/%,$(ALL_MODULES.$(m).INSTALLED)),\
$(eval b := $(filter %$(suffix $(i)),$(filter $(TARGET_OUT_ROOT)/%,$(ALL_MODULES.$(m).BUILT))))\
$(eval my_suffix := $(suffix $(i))) \
$(if $(my_suffix),\
$(eval my_patt := $(TARGET_OUT_ROOT)/%$(my_suffix)),\
$(eval my_patt := $(TARGET_OUT_ROOT)/%$(notdir $(i))))\
$(eval b := $(filter $(my_patt),$(ALL_MODULES.$(m).BUILT)))\
$(if $(filter 1,$(words $(b))),\
$(eval my_built_modules += $(b))\
$(eval my_copy_pairs += $(b):$(patsubst $(PRODUCT_OUT)/%,$(my_staging_dir)/%,$(i))),\
$(eval my_copy_dest := $(patsubst data/%,DATA/%,\
$(patsubst system/%,SYSTEM/%,\
$(patsubst $(PRODUCT_OUT)/%,%,$(i)))))\
$(eval my_copy_pairs += $(b):$(my_staging_dir)/$(my_copy_dest)),\
$(warning Unexpected module built file '$(b)' for module '$(m)'))\
))