Merge "Build System: Validate AndroidTest.xml Configs" am: af076d240a

am: 0cbcb1fd10

Change-Id: Iff4bbbaee9b7e922f4ed8f27e56b22bbc032f80e
This commit is contained in:
Nelson Li 2018-05-23 12:49:44 -07:00 committed by android-build-merger
commit 54396a014a
2 changed files with 27 additions and 7 deletions

View file

@ -557,7 +557,8 @@ multi_arch :=
# The module itself.
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
$(eval my_compat_dist_$(suite) := $(foreach dir, $(call compatibility_suite_dirs,$(suite),$(arch_dir)), \
$(LOCAL_BUILT_MODULE):$(dir)/$(my_installed_module_stem))))
$(LOCAL_BUILT_MODULE):$(dir)/$(my_installed_module_stem))) \
$(eval my_compat_dist_config_$(suite) := ))
# Make sure we only add the files once for multilib modules.
ifndef $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files
@ -604,7 +605,7 @@ is_instrumentation_test :=
ifneq (,$(test_config))
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
$(eval my_compat_dist_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
$(eval my_compat_dist_config_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
$(test_config):$(dir)/$(LOCAL_MODULE).config)))
endif
@ -612,14 +613,14 @@ test_config :=
ifneq (,$(wildcard $(LOCAL_PATH)/DynamicConfig.xml))
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
$(eval my_compat_dist_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
$(eval my_compat_dist_config_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
$(LOCAL_PATH)/DynamicConfig.xml:$(dir)/$(LOCAL_MODULE).dynamic)))
endif
ifneq (,$(wildcard $(LOCAL_PATH)/$(LOCAL_MODULE)_*.config))
$(foreach extra_config, $(wildcard $(LOCAL_PATH)/$(LOCAL_MODULE)_*.config), \
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
$(eval my_compat_dist_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
$(eval my_compat_dist_config_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
$(extra_config):$(dir)/$(notdir $(extra_config))))))
endif
endif # $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files
@ -638,6 +639,8 @@ arch_dir :=
is_native :=
$(call create-suite-dependencies)
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
$(eval my_compat_dist_config_$(suite) := ))
endif # LOCAL_COMPATIBILITY_SUITE

View file

@ -2682,6 +2682,18 @@ $(2): $(1) $(XMLLINT)
$$(copy-file-to-target)
endef
# Copies many xml files and check they are well-formed.
# $(1): The xml files to copy. Each entry is a ':' separated src:dst pair.
# Evaluates to the list of the dst files. (ie suitable for a dependency list.)
define copy-many-xml-files-checked
$(foreach f, $(1), $(strip \
$(eval _cmf_tuple := $(subst :, ,$(f))) \
$(eval _cmf_src := $(word 1,$(_cmf_tuple))) \
$(eval _cmf_dest := $(word 2,$(_cmf_tuple))) \
$(eval $(call copy-xml-file-checked,$(_cmf_src),$(_cmf_dest))) \
$(_cmf_dest)))
endef
# Copy the file only if it is a well-formed manifest file. For use viea $(eval)
# $(1): source file
# $(2): destination file
@ -3125,15 +3137,20 @@ endef
# For each suite:
# 1. Copy the files to the many suite output directories.
# And for test config files, we'll check the .xml is well-formed before copy.
# 2. Add all the files to each suite's dependent files list.
# 3. Do the dependency addition to my_all_targets
# Requires for each suite: my_compat_dist_$(suite) to be defined.
# Requires for each suite: use my_compat_dist_config_$(suite) to define the test config.
# and use my_compat_dist_$(suite) to define the others.
define create-suite-dependencies
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
$(eval COMPATIBILITY.$(suite).FILES := \
$$(COMPATIBILITY.$(suite).FILES) $$(foreach f,$$(my_compat_dist_$(suite)),$$(call word-colon,2,$$(f))))) \
$$(COMPATIBILITY.$(suite).FILES) $$(foreach f,$$(my_compat_dist_$(suite)),$$(call word-colon,2,$$(f))) \
$$(foreach f,$$(my_compat_dist_config_$(suite)),$$(call word-colon,2,$$(f))))) \
$(eval $(my_all_targets) : $(call copy-many-files, \
$(sort $(foreach suite,$(LOCAL_COMPATIBILITY_SUITE),$(my_compat_dist_$(suite))))))
$(sort $(foreach suite,$(LOCAL_COMPATIBILITY_SUITE),$(my_compat_dist_$(suite))))) \
$(call copy-many-xml-files-checked, \
$(sort $(foreach suite,$(LOCAL_COMPATIBILITY_SUITE),$(my_compat_dist_config_$(suite))))))
endef
###########################################################