xref: /aosp_15_r20/external/bazel-skylib/docs/copy_directory_doc.md (revision bcb5dc7965af6ee42bf2f21341a2ec00233a8c8a)
1<!-- Generated with Stardoc: http://skydoc.bazel.build -->
2
3A rule that copies a directory to another place.
4
5The rule uses a Bash command on Linux/macOS/non-Windows, and a cmd.exe command
6on Windows (no Bash is required).
7
8<a id="copy_directory"></a>
9
10## copy_directory
11
12<pre>
13copy_directory(<a href="#copy_directory-name">name</a>, <a href="#copy_directory-src">src</a>, <a href="#copy_directory-out">out</a>, <a href="#copy_directory-kwargs">kwargs</a>)
14</pre>
15
16Copies a directory to another location.
17
18This rule uses a Bash command on Linux/macOS/non-Windows, and a cmd.exe command on Windows (no Bash is required).
19
20If using this rule with source directories, it is recommended that you use the
21`--host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1` startup option so that changes
22to files within source directories are detected. See
23https://github.com/bazelbuild/bazel/commit/c64421bc35214f0414e4f4226cc953e8c55fa0d2
24for more context.
25
26
27**PARAMETERS**
28
29
30| Name  | Description | Default Value |
31| :------------- | :------------- | :------------- |
32| <a id="copy_directory-name"></a>name |  Name of the rule.   |  none |
33| <a id="copy_directory-src"></a>src |  The directory to make a copy of. Can be a source directory or TreeArtifact.   |  none |
34| <a id="copy_directory-out"></a>out |  Path of the output directory, relative to this package.   |  none |
35| <a id="copy_directory-kwargs"></a>kwargs |  further keyword arguments, e.g. `visibility`   |  none |
36
37
38<a id="copy_directory_action"></a>
39
40## copy_directory_action
41
42<pre>
43copy_directory_action(<a href="#copy_directory_action-ctx">ctx</a>, <a href="#copy_directory_action-src">src</a>, <a href="#copy_directory_action-dst">dst</a>, <a href="#copy_directory_action-is_windows">is_windows</a>)
44</pre>
45
46Helper function that creates an action to copy a directory from src to dst.
47
48This helper is used by copy_directory. It is exposed as a public API so it can be used within
49other rule implementations.
50
51
52**PARAMETERS**
53
54
55| Name  | Description | Default Value |
56| :------------- | :------------- | :------------- |
57| <a id="copy_directory_action-ctx"></a>ctx |  The rule context.   |  none |
58| <a id="copy_directory_action-src"></a>src |  The directory to make a copy of. Can be a source directory or TreeArtifact.   |  none |
59| <a id="copy_directory_action-dst"></a>dst |  The directory to copy to. Must be a TreeArtifact.   |  none |
60| <a id="copy_directory_action-is_windows"></a>is_windows |  If true, an cmd.exe action is created so there is no bash dependency.   |  `False` |
61
62
63