1<!-- Generated with Stardoc: http://skydoc.bazel.build --> 2 3<a name="#copy_file"></a> 4 5## copy_file 6 7<pre> 8copy_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>) 9</pre> 10 11Copies a file to another location. 12 13`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. 14 15This rule uses a Bash command on Linux/macOS/non-Windows, and a cmd.exe command on Windows (no Bash is required). 16 17 18### Parameters 19 20<table class="params-table"> 21 <colgroup> 22 <col class="col-param" /> 23 <col class="col-description" /> 24 </colgroup> 25 <tbody> 26 <tr id="copy_file-name"> 27 <td><code>name</code></td> 28 <td> 29 required. 30 <p> 31 Name of the rule. 32 </p> 33 </td> 34 </tr> 35 <tr id="copy_file-src"> 36 <td><code>src</code></td> 37 <td> 38 required. 39 <p> 40 A Label. The file to make a copy of. (Can also be the label of a rule 41 that generates a file.) 42 </p> 43 </td> 44 </tr> 45 <tr id="copy_file-out"> 46 <td><code>out</code></td> 47 <td> 48 required. 49 <p> 50 Path of the output file, relative to this package. 51 </p> 52 </td> 53 </tr> 54 <tr id="copy_file-is_executable"> 55 <td><code>is_executable</code></td> 56 <td> 57 optional. default is <code>False</code> 58 <p> 59 A boolean. Whether to make the output file executable. When 60 True, the rule's output can be executed using `bazel run` and can be 61 in the srcs of binary and test rules that require executable sources. 62 WARNING: If `allow_symlink` is True, `src` must also be executable. 63 </p> 64 </td> 65 </tr> 66 <tr id="copy_file-allow_symlink"> 67 <td><code>allow_symlink</code></td> 68 <td> 69 optional. default is <code>False</code> 70 <p> 71 A boolean. Whether to allow symlinking instead of copying. 72 When False, the output is always a hard copy. When True, the output 73 *can* be a symlink, but there is no guarantee that a symlink is 74 created (i.e., at the time of writing, we don't create symlinks on 75 Windows). Set this to True if you need fast copying and your tools can 76 handle symlinks (which most UNIX tools can). 77 </p> 78 </td> 79 </tr> 80 <tr id="copy_file-kwargs"> 81 <td><code>kwargs</code></td> 82 <td> 83 optional. 84 <p> 85 further keyword arguments, e.g. `visibility` 86 </p> 87 </td> 88 </tr> 89 </tbody> 90</table> 91 92 93