Copies files and directories to an output directory. Files and directories can be arranged as needed in the output directory using the `root_paths`, `exclude_prefixes` and `replace_prefixes` attributes. ## copy_to_directory
copy_to_directory(name, allow_overwrites, exclude_prefixes, include_external_repositories, out, replace_prefixes, root_paths, srcs)**ATTRIBUTES** | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | | name | A unique name for this target. | Name | required | | | allow_overwrites | If True, allow files to be overwritten if the same output file is copied to twice.
@external_repo//path/to:file
to path/to/file
within the output directory. copy_to_directory( name = "dir", include_external_repositories = ["external_repo"], srcs = ["@external_repo//path/to:file"], )
root_paths
, exclude_prefixes
and replace_prefixes
in the same way as files form the main repository. | List of strings | optional | [] |
| out | Path of the output directory, relative to this package./
) 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./
) 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.copy_to_directory_action(ctx, srcs, dst, additional_files, root_paths, include_external_repositories, exclude_prefixes, replace_prefixes, allow_overwrites, is_windows)Helper function to copy files to a directory. This helper is used by copy_to_directory. It is exposed as a public API so it can be used within other rule implementations where additional_files can also be passed in. **PARAMETERS** | Name | Description | Default Value | | :------------- | :------------- | :------------- | | ctx | The rule context. | none | | srcs | Files and/or directories or targets that provide DirectoryPathInfo to copy into the output directory. | none | | dst | The directory to copy to. Must be a TreeArtifact. | none | | additional_files | Additional files to copy that are not in the DefaultInfo or DirectoryPathInfo of srcs |
[]
|
| root_paths | List of paths that are roots in the output directory.["."]
|
| include_external_repositories | List of external repository names to include in the output directory.[]
|
| exclude_prefixes | List of path prefixes to exclude from output directory.[]
|
| replace_prefixes | Map of paths prefixes to replace in the output directory path when copying files.{}
|
| allow_overwrites | If True, allow files to be overwritten if the same output file is copied to twice.False
|
| is_windows | If true, an cmd.exe action is created so there is no bash dependency. | False
|
## copy_to_directory_lib.impl
copy_to_directory_lib.impl(ctx)**PARAMETERS** | Name | Description | Default Value | | :------------- | :------------- | :------------- | | ctx |
-
| none |