diff --git a/testing/file_test/rules.bzl b/testing/file_test/rules.bzl index cc8b2334c587..116d0bf3ad8a 100644 --- a/testing/file_test/rules.bzl +++ b/testing/file_test/rules.bzl @@ -10,14 +10,8 @@ a file which can be accessed as a list. This avoids long argument parsing. load("@rules_cc//cc:defs.bzl", "cc_test") -DataFilesInfo = provider( - "Data files for this target.", - fields = { - "data_files": "Data files for this target", - }, -) - def _tests_as_input_file_rule_impl(ctx): + out = ctx.actions.declare_file(ctx.label.name + ".txt") data_files = [] for tests in ctx.attr.data: data_files.extend( @@ -26,15 +20,13 @@ def _tests_as_input_file_rule_impl(ctx): data_files.extend( [f.path for f in tests[DefaultInfo].files.to_list()], ) - ctx.actions.write(ctx.outputs.data_files, "\n".join(data_files) + "\n") + ctx.actions.write(out, "\n".join(data_files) + "\n") + return [DefaultInfo(files = depset([out]))] _tests_as_input_file_rule = rule( attrs = { "data": attr.label_list(allow_files = True), }, - outputs = { - "data_files": "%{name}.txt", - }, implementation = _tests_as_input_file_rule_impl, ) @@ -69,7 +61,7 @@ def file_test( testonly = 1, ) args = ["--test_targets_file=$(rootpath :{0})".format(tests_file)] + args - data = [tests_file] + tests + data + data = [":" + tests_file] + tests + data if prebuilt_binary: native.sh_test(