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