diff --git a/docs/copy_to_directory.md b/docs/copy_to_directory.md
index e4e7c5c..c745009 100644
--- a/docs/copy_to_directory.md
+++ b/docs/copy_to_directory.md
@@ -26,9 +26,9 @@ copy_to_directory(name, 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.
If set, then the order of srcs matters as the last copy of a particular file will win.
This setting has no effect on Windows where overwrites are always allowed. | Boolean | optional | False |
| exclude_prefixes | List of path prefixes to exclude from output directory.
DEPRECATED: use exclude_srcs_patterns
instead
Glob patterns **
, *
and ?
are supported but the prefix must not end with a **
or *
glob expression.
See glob_match
documentation for more details on how to use glob patterns: https://github.com/aspect-build/bazel-lib/blob/main/docs/glob_match.md.
If the output directory path for a file or directory starts with or is equal to a path in the list then that file is not copied to the output directory.
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.
exclude_prefixes
are matched on the output path after root_paths
are considered.
exclude_prefixes
are matched *after* include_srcs_patterns
and *before* replace_prefixes
are applied.
NB: Prefixes that nest into source directories or generated directories (TreeArtifacts) targets are not supported since matches are performed in Starlark. To use exclude_prefixes
on files within directories you can use the make_directory_paths
helper to specify individual files inside directories in srcs
. | List of strings | optional | [] |
-| exclude_srcs_patterns | List of paths (with glob support) to exclude from output directory.
Glob patterns **
, *
and ?
are supported.
See glob_match
documentation for more details on how to use glob patterns: https://github.com/aspect-build/bazel-lib/blob/main/docs/glob_match.md.
If the output directory path for a file or directory starts with or is equal to a path in the list then that file is not copied to the output directory.
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.
exclude_srcs_patterns
are matched on the output path after root_paths
are considered.
exclude_srcs_patterns
are matched *after* include_srcs_patterns
and *before* replace_prefixes
are applied.
NB: Prefixes that nest into source directories or generated directories (TreeArtifacts) targets are not supported since matches are performed in Starlark. To use exclude_srcs_patterns
on files within directories you can use the make_directory_paths
helper to specify individual files inside directories in srcs
. | List of strings | optional | [] |
+| exclude_srcs_patterns | List of paths (with glob support) to exclude from output directory.
Glob patterns **
, *
and ?
are supported.
See glob_match
documentation for more details on how to use glob patterns: https://github.com/aspect-build/bazel-lib/blob/main/docs/glob_match.md.
If the output directory path for a file or directory starts with or is equal to a path in the list then that file is not copied to the output directory.
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.
exclude_srcs_patterns
are matched on the output path after root_paths
are considered.
exclude_srcs_patterns
are matched *after* include_srcs_patterns
and *before* replace_prefixes
are applied.
NB: Patterns that nest into source directories or generated directories (TreeArtifacts) targets are not supported since matches are performed in Starlark. To use exclude_srcs_patterns
on files within directories you can use the make_directory_paths
helper to specify individual files inside directories in srcs
. | List of strings | optional | [] |
| include_external_repositories | List of external repository names to include in the output directory.
Files from external repositories are not copied into the output directory unless the external repository they come from is listed here.
When copied from an external repository, the file path in the output directory defaults to the file's path within the external repository. The external repository name is _not_ included in that path.
For example, the following copies @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
, include_srcs_patterns
, exclude_srcs_patterns
and replace_prefixes
in the same way as files form the main repository. | List of strings | optional | [] |
-| include_srcs_patterns | List of paths (with glob support) to include in output directory.**
, *
and ?
are supported.glob_match
documentation for more details on how to use glob patterns: https://github.com/aspect-build/bazel-lib/blob/main/docs/glob_match.md.include_srcs_patterns
are matched on the output path after root_paths
are considered.include_srcs_patterns
are matched *before* exclude_srcs_patterns
and replace_prefixes
are applied.include_srcs_patterns
on files within directories you can use the make_directory_paths
helper to specify individual files inside directories in srcs
. | List of strings | optional | ["**"] |
+| include_srcs_patterns | List of paths (with glob support) to include in output directory.**
, *
and ?
are supported.glob_match
documentation for more details on how to use glob patterns: https://github.com/aspect-build/bazel-lib/blob/main/docs/glob_match.md.include_srcs_patterns
are matched on the output path after root_paths
are considered.include_srcs_patterns
are matched *before* exclude_srcs_patterns
and replace_prefixes
are applied.include_srcs_patterns
on files within directories you can use the make_directory_paths
helper to specify individual files inside directories in srcs
. | 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.replace_prefixes
are matched on the output path after root_paths
are considered.replace_prefixes
are matched *after* include_srcs_patterns
and exclude_srcs_patterns
are applied.replace_prefixes
on files within directories you can use the make_directory_paths
helper to specify individual files inside directories in srcs
. | Dictionary: String -> String | optional | {} |
| root_paths | List of paths that are roots in the output directory.**
, *
and ?
are supported but the path must not end with a **
or *
glob expression.glob_match
documentation for more details on how to use glob patterns: https://github.com/aspect-build/bazel-lib/blob/main/docs/glob_match.md./
) 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.[]
|
| 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.[]
|
-| include_srcs_patterns | List of paths (with glob support) to include in output directory.["**"]
|
-| exclude_srcs_patterns | List of paths (with glob support) to exclude from output directory.[]
|
+| include_srcs_patterns | List of paths (with glob support) to include in output directory.["**"]
|
+| exclude_srcs_patterns | List of paths (with glob support) to exclude from 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
|
diff --git a/lib/private/copy_to_directory.bzl b/lib/private/copy_to_directory.bzl
index a350c86..eb61fc1 100644
--- a/lib/private/copy_to_directory.bzl
+++ b/lib/private/copy_to_directory.bzl
@@ -69,7 +69,7 @@ _copy_to_directory_attr = {
`exclude_srcs_patterns` and `replace_prefixes` in the same way as files form the main repository.""",
),
"include_srcs_patterns": attr.string_list(
- doc = """List of paths (with glob support) to include in output directory.
+ doc = """List of paths (with glob support) to include in output directory.
Glob patterns `**`, `*` and `?` are supported.
@@ -78,22 +78,18 @@ _copy_to_directory_attr = {
Defaults to ["**"] which includes all sources.
- If not empty, a file is only copied to the output directory if
- the output directory path for a file or directory starts with or is equal to
- a path in the list.
-
`include_srcs_patterns` are matched on the output path after `root_paths` are considered.
`include_srcs_patterns` are matched *before* `exclude_srcs_patterns` and `replace_prefixes` are applied.
- NB: Prefixes that nest into source directories or generated directories (TreeArtifacts) targets
+ NB: Patterns that nest into source directories or generated directories (TreeArtifacts) targets
are not supported since matches are performed in Starlark. To use `include_srcs_patterns` on files
within directories you can use the `make_directory_paths` helper to specify individual files inside
directories in `srcs`.""",
default = ["**"],
),
"exclude_srcs_patterns": attr.string_list(
- doc = """List of paths (with glob support) to exclude from output directory.
+ doc = """List of paths (with glob support) to exclude from output directory.
Glob patterns `**`, `*` and `?` are supported.
@@ -111,7 +107,7 @@ _copy_to_directory_attr = {
`exclude_srcs_patterns` are matched *after* `include_srcs_patterns` and *before* `replace_prefixes` are applied.
- NB: Prefixes that nest into source directories or generated directories (TreeArtifacts) targets
+ NB: Patterns that nest into source directories or generated directories (TreeArtifacts) targets
are not supported since matches are performed in Starlark. To use `exclude_srcs_patterns` on files
within directories you can use the `make_directory_paths` helper to specify individual files inside
directories in `srcs`.""",
@@ -474,11 +470,11 @@ def copy_to_directory_action(
See copy_to_directory rule documentation for more details.
- include_srcs_patterns: List of paths (with glob support) to include in output directory.
+ include_srcs_patterns: List of paths (with glob support) to include in output directory.
See copy_to_directory rule documentation for more details.
- exclude_srcs_patterns: List of paths (with glob support) to exclude from output directory.
+ exclude_srcs_patterns: List of paths (with glob support) to exclude from output directory.
See copy_to_directory rule documentation for more details.