diff --git a/.aspectci/config.yaml b/.aspectci/config.yaml
index 3b0b1b6..f39e676 100644
--- a/.aspectci/config.yaml
+++ b/.aspectci/config.yaml
@@ -4,5 +4,6 @@ env:
workspaces:
- .
- e2e/bzlmod
+ - e2e/copy_to_directory
tasks:
test:
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index e5dcb20..9e3c1dd 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -21,6 +21,7 @@ jobs:
folder:
- "."
- "e2e/bzlmod"
+ - "e2e/copy_to_directory"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
diff --git a/docs/copy_to_directory.md b/docs/copy_to_directory.md
index 8e3e6d9..8852a8e 100644
--- a/docs/copy_to_directory.md
+++ b/docs/copy_to_directory.md
@@ -26,10 +26,10 @@ 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 (with glob support) to exclude from output directory.
DEPRECATED: use exclude_srcs_patterns
instead
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.
Files and directories in srcs are not copied to the output directory if their output directory path, after applying root_paths
, starts with or fully matches one of the patterns specified.
Patterns do not look into files within source directory or generated directory (TreeArtifact) targets 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
. This restriction may be fixed in a future release by performing matching inside the copy action instead of in Starlark.
Forward slashes (/
) should be used as path separators.
Files and directories that do not have matching output directory paths are subject to subsequent filters and transformations to determine if they are copied and what their path in the output directory will be.
Filters and transformations are applied in the following order:
1. include_external_repositories
2. include_srcs_packages
3. exclude_srcs_packages
4. root_paths
5. include_srcs_patterns
6. exclude_srcs_patterns
7. replace_prefixes
For more information each filters / transformations applied, see the documentation for the specific filter / transformation attribute. | List of strings | optional | [] |
-| exclude_srcs_packages | List of Bazel packages (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.
Files and directories in srcs are not copied to the output directory if the Bazel package of the file or directory matches one of the patterns specified.
Forward slashes (/
) should be used as path separators.
A "." value expands to the target's package path (ctx.label.package
). A "./**" value expands to the target's package path followed by a slash and a globstar ("{}/**".format(ctx.label.package)
).
Files and directories that have do not have matching Bazel packages are subject to subsequent filters and transformations to determine if they are copied and what their path in the output directory will be.
Filters and transformations are applied in the following order:
1. include_external_repositories
2. include_srcs_packages
3. exclude_srcs_packages
4. root_paths
5. include_srcs_patterns
6. exclude_srcs_patterns
7. replace_prefixes
For more information each filters / transformations applied, see the documentation for the specific filter / transformation attribute. | List of strings | optional | [] |
+| exclude_srcs_packages | List of Bazel packages (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.
Files and directories in srcs are not copied to the output directory if the Bazel package of the file or directory matches one of the patterns specified.
Forward slashes (/
) should be used as path separators.
A "."
value means exclude srcs that are in the target's package. It expands to the target's package path (ctx.label.package
). This will be an empty string ""
if the target is in the root package.
A "./**"
value means exclude srcs that are in subpackages of the target's package. It expands to the target's package path followed by a slash and a globstar ("{}/**".format(ctx.label.package)
). If the target's package is the root package, "./**"
expands to ["?*", "?*/**"]
instead.
Files and directories that have do not have matching Bazel packages are subject to subsequent filters and transformations to determine if they are copied and what their path in the output directory will be.
Filters and transformations are applied in the following order:
1. include_external_repositories
2. include_srcs_packages
3. exclude_srcs_packages
4. root_paths
5. include_srcs_patterns
6. exclude_srcs_patterns
7. replace_prefixes
For more information each filters / transformations applied, see the documentation for the specific filter / transformation attribute. | 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.
Files and directories in srcs are not copied to the output directory if their output directory path, after applying root_paths
, matches one of the patterns specified.
Patterns do not look into files within source directory or generated directory (TreeArtifact) targets 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
. This restriction may be fixed in a future release by performing matching inside the copy action instead of in Starlark.
Forward slashes (/
) should be used as path separators.
Files and directories that do not have matching output directory paths are subject to subsequent filters and transformations to determine if they are copied and what their path in the output directory will be.
Filters and transformations are applied in the following order:
1. include_external_repositories
2. include_srcs_packages
3. exclude_srcs_packages
4. root_paths
5. include_srcs_patterns
6. exclude_srcs_patterns
7. replace_prefixes
For more information each filters / transformations applied, see the documentation for the specific filter / transformation attribute. | List of strings | optional | [] |
| include_external_repositories | List of external repository names (with glob support) to include in the 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.
Files from external repositories are only copied into the output directory if the external repository they come from matches one of the external repository patterns specified.
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_*"], srcs = ["@external_repo//path/to:file"], )
include_external_repositories
include_srcs_packages
exclude_srcs_packages
root_paths
include_srcs_patterns
exclude_srcs_patterns
replace_prefixes
**
, *
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./
) should be used as path separators.ctx.label.package
). A "./**" value expands to the target's package path followed by a slash and a globstar ("{}/**".format(ctx.label.package)
).include_external_repositories
include_srcs_packages
exclude_srcs_packages
root_paths
include_srcs_patterns
exclude_srcs_patterns
replace_prefixes
**
, *
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./
) should be used as path separators."."
value means include srcs that are in the target's package. It expands to the target's package path (ctx.label.package
). This will be an empty string ""
if the target is in the root package."./**"
value means include srcs that are in subpackages of the target's package. It expands to the target's package path followed by a slash and a globstar ("{}/**".format(ctx.label.package)
). If the target's package is the root package, "./**"
expands to ["?*", "?*/**"]
instead.["**"]
which includes sources from all packages.include_external_repositories
include_srcs_packages
exclude_srcs_packages
root_paths
include_srcs_patterns
exclude_srcs_patterns
replace_prefixes
**
, *
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.root_paths
, matches one of the patterns specified.include_srcs_patterns
on files within directories you can use the make_directory_paths
helper to specify individual files inside directories in srcs
. This restriction may be fixed in a future release by performing matching inside the copy action instead of in Starlark./
) should be used as path separators.include_external_repositories
include_srcs_packages
exclude_srcs_packages
root_paths
include_srcs_patterns
exclude_srcs_patterns
replace_prefixes
**
, *
and ?
are supported but the pattern must not end with a **
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.replace_prefixes
on files within directories you can use the make_directory_paths
helper to specify individual files inside directories in srcs
. This restriction may be fixed in a future release by performing matching inside the copy action instead of in Starlark./
) should be used as path separators. include_external_repositories
include_srcs_packages
exclude_srcs_packages
root_paths
include_srcs_patterns
exclude_srcs_patterns
replace_prefixes