Public API for write_source_files
Macros and Functions
write_source_files
Write to one or more files in the source tree. Stamp out tests that ensure the files exists and are up to date.
Usage:
load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files")
write_source_files(
name = "write_foobar",
files = {
"foobar.json": "//some/generated:file",
},
)
To update the source file, run:
bazel run //:write_foobar
A test will fail if the source file doesn't exist
bazel test //...
//:foobar.json does not exist. To create & update this file, run:
bazel run //:write_foobar
...or if it's out of date.
bazel test //...
//:foobar.json is out-of-date. To update this file, run:
bazel run //:write_foobar
name
Name of the executable target that creates or updates the source file
files
A dict where the keys are source files to write to and the values are labels pointing to the desired content. Source files must be within the same bazel package as the target.
kwargs
Other common named parameters such as tags
or visibility