bazel-lib icon indicating copy to clipboard operation
bazel-lib copied to clipboard

Should it matter if `write_source_files` goes to the same file?

Open njlr opened this issue 9 months ago • 1 comments

load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files")
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")

copy_file(
    name = "foobar",
    src = "//some/generated:file",
    out = "foobar.json",
)

write_source_files(
    name = "write_foobar",
    files = {
        "foobar.json": ":foobar",
    },
)

This will complain that foobar.json is the same file as foobar.json.

Should this be an error? They have (by definition) the same contents

I am using copy_file to get the file into the correct position for usage by another tool.

njlr avatar Mar 19 '25 19:03 njlr