From 1abe7ef455c994cab68384804ba9a798c702b534 Mon Sep 17 00:00:00 2001 From: Chris Parsons Date: Fri, 17 Jul 2020 15:27:27 -0400 Subject: [PATCH] Add optional relative path to LOCAL_TEST_DATA processing Test: Verified in conjunction with changes to soong (aosp/1359742) Test: Treehugger to verify backwards compatibility Change-Id: I39d2669ff74b4387606b6416e8afefc1f6507348 --- core/base_rules.mk | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/base_rules.mk b/core/base_rules.mk index d604480be..3f93c2ca8 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -592,12 +592,22 @@ ifneq ($(strip $(filter NATIVE_TESTS,$(LOCAL_MODULE_CLASS)) $(LOCAL_IS_FUZZ_TARG ifneq ($(strip $(LOCAL_TEST_DATA)),) ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE)) +# Soong LOCAL_TEST_DATA is of the form :: +# or :, to be installed to +# // or /, +# respectively. ifeq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK)) define copy_test_data_pairs _src_base := $$(call word-colon,1,$$(td)) _file := $$(call word-colon,2,$$(td)) - my_test_data_pairs += $$(call append-path,$$(_src_base),$$(_file)):$$(call append-path,$$(my_module_path),$$(_file)) - my_test_data_file_pairs += $$(call append-path,$$(_src_base),$$(_file)):$$(_file) + _relative_install_path := $$(call word-colon,3,$$(td)) + ifeq (,$$(_relative_install_path)) + _relative_dest_file := $$(_file) + else + _relative_dest_file := $$(call append-path,$$(_relative_install_path),$$(_file)) + endif + my_test_data_pairs += $$(call append-path,$$(_src_base),$$(_file)):$$(call append-path,$$(my_module_path),$$(_relative_dest_file)) + my_test_data_file_pairs += $$(call append-path,$$(_src_base),$$(_file)):$$(_relative_dest_file) endef else define copy_test_data_pairs