Copy files and directories to an output directory

Rules

copy_to_directory

Copies files and directories to an output directory.

Files and directories can be arranged as needed in the output directory using the root_paths and replace_prefixes attributes.

NB: This rule is not yet implemented for Windows

name

A unique name for this target.

is_windows

replace_prefixes

Map of paths prefixes to replace in the output directory path when copying files.

If the output directory path for a file or directory starts with or is equal to a key in the dict then the matching portion of the output directory path is replaced with the dict value for that key.

Forward slashes (/) should be used as path separators. The final path segment of the key can be a partial match in the corresponding segment of the output directory path.

If there are multiple keys that match, the longest match wins.

root_paths

List of paths that are roots in the output directory. If a file or directory being copied is in one of the listed paths or one of its subpaths, the output directory path is the path relative to the root path instead of the path relative to the file's workspace.

Forward slashes (/) should be used as path separators. Partial matches on the final path segment of a root path against the corresponding segment in the full workspace relative path of a file are not matched.

If there are multiple root paths that match, the longest match wins.

Defaults to [package_name()] so that the output directory path of files in the target's package and and sub-packages are relative to the target's package and files outside of that retain their full workspace relative paths.

srcs

Files and/or directories to copy into the output directory


Macros and Functions

copy_to_directory_lib.impl

ctx