relocated_files
Loose files with path manipulation applied.
Allows you to relocate the files at runtime to something more convenient than their actual paths in your project.
For example, you can relocate src/resources/project1/data.json
to instead be resources/data.json
. Your other target types can then add this target to their dependencies
field, rather than using the original files
target.
To remove a prefix:
# Results in `data.json`.
relocated_files(
files_targets=["src/resources/project1:target"],
src="src/resources/project1",
dest="",
)
To add a prefix:
# Results in `images/logo.svg`.
relocated_files(
files_targets=["//:logo"],
src="",
dest="images",
)
To replace a prefix:
# Results in `new_prefix/project1/data.json`.
relocated_files(
files_targets=["src/resources/project1:target"],
src="src/resources",
dest="new_prefix",
)
Backend: ``