A rule that copies a directory to another place. The rule uses a precompiled binary to perform the copy, so no shell is required. ## Preserving modification times `copy_directory` and `copy_to_directory` have a `preserve_mtime` attribute, however there are two caveats to consider when using this feature: 1. Remote Execution / Caching: These layers will reset the modify time and are incompatible with this feature. To avoid these failures the [no-remote tag](https://bazel.build/reference/be/common-definitions) can be added. 2. Caching: Changes to only the modified time will not re-trigger cached actions. This can be worked around by using a clean build when these types of changes occur. For tests the [external tag](https://bazel.build/reference/be/common-definitions) can be used but this will result in tests never being cached. ## copy_directory
copy_directory(name, src, out, hardlink, kwargs)Copies a directory to another location. This rule uses a precompiled binary to perform the copy, so no shell is required. If using this rule with source directories, it is recommended that you use the `--host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1` startup option so that changes to files within source directories are detected. See https://github.com/bazelbuild/bazel/commit/c64421bc35214f0414e4f4226cc953e8c55fa0d2 for more context. **PARAMETERS** | Name | Description | Default Value | | :------------- | :------------- | :------------- | | name | Name of the rule. | none | | src | The directory to make a copy of. Can be a source directory or TreeArtifact. | none | | out | Path of the output directory, relative to this package. | none | | hardlink | Controls when to use hardlinks to files instead of making copies.
copy_directory_bin_action(ctx, src, dst, copy_directory_bin, copy_directory_toolchain, hardlink, verbose, preserve_mtime)Factory function that creates an action to copy a directory from src to dst using a tool binary. The tool binary will typically be the `@aspect_bazel_lib//tools/copy_directory` `go_binary` either built from source or provided by a toolchain. This helper is used by the copy_directory rule. It is exposed as a public API so it can be used within other rule implementations. **PARAMETERS** | Name | Description | Default Value | | :------------- | :------------- | :------------- | | ctx | The rule context. | none | | src | The source directory to copy. | none | | dst | The directory to copy to. Must be a TreeArtifact. | none | | copy_directory_bin | Copy to directory tool binary. | none | | copy_directory_toolchain | The toolchain type for Auto Exec Groups. The default is probably what you want. | `"@aspect_bazel_lib//lib:copy_directory_toolchain_type"` | | hardlink | Controls when to use hardlinks to files instead of making copies.