blob: ed297a66a11934df4bf9376653e24f4483896020 [file] [log] [blame] [view]
Yannic8f3151f2020-07-10 20:08:02 +02001<!-- Generated with Stardoc: http://skydoc.bazel.build -->
2
Alexandre Rostovtsev6e30a772021-10-27 09:13:59 -04003A rule that copies a file to another place.
4
5native.genrule() is sometimes used to copy files (often wishing to rename them).
6The 'copy_file' rule does this with a simpler interface than genrule.
7
8The rule uses a Bash command on Linux/macOS/non-Windows, and a cmd.exe command
9on Windows (no Bash is required).
10
11
nickgooding31ab4c82022-08-30 19:57:34 +010012<a id="copy_file"></a>
Yannic8f3151f2020-07-10 20:08:02 +020013
László Csomor084758f2019-03-26 12:38:49 +010014## copy_file
15
16<pre>
Yannic8f3151f2020-07-10 20:08:02 +020017copy_file(<a href="#copy_file-name">name</a>, <a href="#copy_file-src">src</a>, <a href="#copy_file-out">out</a>, <a href="#copy_file-is_executable">is_executable</a>, <a href="#copy_file-allow_symlink">allow_symlink</a>, <a href="#copy_file-kwargs">kwargs</a>)
László Csomor084758f2019-03-26 12:38:49 +010018</pre>
19
20Copies a file to another location.
21
22`native.genrule()` is sometimes used to copy files (often wishing to rename them). The 'copy_file' rule does this with a simpler interface than genrule.
23
24This rule uses a Bash command on Linux/macOS/non-Windows, and a cmd.exe command on Windows (no Bash is required).
25
26
Alex Eagleeabe5f72021-09-24 08:24:43 -070027**PARAMETERS**
László Csomor084758f2019-03-26 12:38:49 +010028
Alex Eagleeabe5f72021-09-24 08:24:43 -070029
30| Name | Description | Default Value |
Alexandre Rostovtsev6e30a772021-10-27 09:13:59 -040031| :------------- | :------------- | :------------- |
32| <a id="copy_file-name"></a>name | Name of the rule. | none |
33| <a id="copy_file-src"></a>src | A Label. The file to make a copy of. (Can also be the label of a rule that generates a file.) | none |
34| <a id="copy_file-out"></a>out | Path of the output file, relative to this package. | none |
35| <a id="copy_file-is_executable"></a>is_executable | A boolean. Whether to make the output file executable. When True, the rule's output can be executed using <code>bazel run</code> and can be in the srcs of binary and test rules that require executable sources. WARNING: If <code>allow_symlink</code> is True, <code>src</code> must also be executable. | <code>False</code> |
36| <a id="copy_file-allow_symlink"></a>allow_symlink | A boolean. Whether to allow symlinking instead of copying. When False, the output is always a hard copy. When True, the output *can* be a symlink, but there is no guarantee that a symlink is created (i.e., at the time of writing, we don't create symlinks on Windows). Set this to True if you need fast copying and your tools can handle symlinks (which most UNIX tools can). | <code>False</code> |
37| <a id="copy_file-kwargs"></a>kwargs | further keyword arguments, e.g. <code>visibility</code> | none |
László Csomor084758f2019-03-26 12:38:49 +010038
39