diff --git a/core/base_rules.mk b/core/base_rules.mk index 8a5440fbc1..cec7792474 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -981,6 +981,18 @@ ALL_MODULES.$(my_register_name).SHARED_LIBS := \ ALL_MODULES.$(my_register_name).SYSTEM_SHARED_LIBS := \ $(ALL_MODULES.$(my_register_name).SYSTEM_SHARED_LIBS) $(LOCAL_SYSTEM_SHARED_LIBRARIES) +ifdef LOCAL_TEST_DATA + # Export the list of targets that are handled as data inputs and required + # by tests at runtime. The LOCAL_TEST_DATA format is generated from below + # https://cs.android.com/android/platform/superproject/+/master:build/soong/android/androidmk.go;l=925-944;drc=master + # which format is like $(path):$(relative_file) but for module-info, only + # the string after ":" is needed. + ALL_MODULES.$(my_register_name).TEST_DATA := \ + $(strip $(ALL_MODULES.$(my_register_name).TEST_DATA) \ + $(foreach f, $(LOCAL_TEST_DATA),\ + $(call word-colon,2,$(f)))) +endif + ########################################################################## ## When compiling against the VNDK, add the .vendor or .product suffix to ## required modules. diff --git a/core/tasks/module-info.mk b/core/tasks/module-info.mk index 5d5bfa8406..aeeb403484 100644 --- a/core/tasks/module-info.mk +++ b/core/tasks/module-info.mk @@ -23,6 +23,7 @@ $(MODULE_INFO_JSON): '"classes_jar": [$(foreach w,$(sort $(ALL_MODULES.$(m).CLASSES_JAR)),"$(w)", )], ' \ '"test_mainline_modules": [$(foreach w,$(sort $(ALL_MODULES.$(m).TEST_MAINLINE_MODULES)),"$(w)", )], ' \ '"is_unit_test": "$(ALL_MODULES.$(m).IS_UNIT_TEST)", ' \ + '"data": [$(foreach w,$(sort $(ALL_MODULES.$(m).TEST_DATA)),"$(w)", )], ' \ '},\n' \ ) | sed -e 's/, *\]/]/g' -e 's/, *\}/ }/g' -e '$$s/,$$//' >> $@ $(hide) echo '}' >> $@