bazel-contrib / bazel-contrib/bazel-lib
Should it matter if `write_source_files` goes to the same file?
- Dominant language
- Starlark
- Stars
- 182
- Forks
- 134
- Avg merge
- 1d 46m
- Merged PRs (30d)
- 1
Description
```starlark
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.
Contributor guide
Research direction
Start with lib:write_source_files.bzl and trace how the files mapping is checked when copy_file produces the same output path. Reproduce the shown Starlark configuration, then determine whether identical source and destination paths should be accepted; done means the behavior is decided and covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100