diff --git a/rules/private/copy_file_private.bzl b/rules/private/copy_file_private.bzl index 44f133a..5987a44 100644 --- a/rules/private/copy_file_private.bzl +++ b/rules/private/copy_file_private.bzl @@ -75,7 +75,10 @@ def _copy_file_impl(ctx): if ctx.attr.is_executable: return [DefaultInfo(files = files, runfiles = runfiles, executable = ctx.outputs.out)] else: - return [DefaultInfo(files = files, runfiles = runfiles)] + # Do not include the copied file into the default runfiles of the + # target, but ensure that it is picked up by native rule's data + # attribute despite https://github.com/bazelbuild/bazel/issues/15043. + return [DefaultInfo(files = files, data_runfiles = runfiles)] _ATTRS = { "src": attr.label(mandatory = True, allow_single_file = True), diff --git a/rules/private/write_file_private.bzl b/rules/private/write_file_private.bzl index ac8ce9c..ebef19c 100644 --- a/rules/private/write_file_private.bzl +++ b/rules/private/write_file_private.bzl @@ -37,7 +37,10 @@ def _common_impl(ctx, is_windows, is_executable): if is_executable: return [DefaultInfo(files = files, runfiles = runfiles, executable = ctx.outputs.out)] else: - return [DefaultInfo(files = files, runfiles = runfiles)] + # Do not include the copied file into the default runfiles of the + # target, but ensure that it is picked up by native rule's data + # attribute despite https://github.com/bazelbuild/bazel/issues/15043. + return [DefaultInfo(files = files, data_runfiles = runfiles)] def _impl(ctx): return _common_impl(ctx, ctx.attr.is_windows, False)