1*bcb5dc79SHONG Yifan<!-- Generated with Stardoc: http://skydoc.bazel.build --> 2*bcb5dc79SHONG Yifan 3*bcb5dc79SHONG YifanA rule that copies a file to another place. 4*bcb5dc79SHONG Yifan 5*bcb5dc79SHONG Yifannative.genrule() is sometimes used to copy files (often wishing to rename them). 6*bcb5dc79SHONG YifanThe 'copy_file' rule does this with a simpler interface than genrule. 7*bcb5dc79SHONG Yifan 8*bcb5dc79SHONG YifanThe rule uses a Bash command on Linux/macOS/non-Windows, and a cmd.exe command 9*bcb5dc79SHONG Yifanon Windows (no Bash is required). 10*bcb5dc79SHONG Yifan 11*bcb5dc79SHONG Yifan<a id="copy_file"></a> 12*bcb5dc79SHONG Yifan 13*bcb5dc79SHONG Yifan## copy_file 14*bcb5dc79SHONG Yifan 15*bcb5dc79SHONG Yifan<pre> 16*bcb5dc79SHONG Yifancopy_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>) 17*bcb5dc79SHONG Yifan</pre> 18*bcb5dc79SHONG Yifan 19*bcb5dc79SHONG YifanCopies a file to another location. 20*bcb5dc79SHONG Yifan 21*bcb5dc79SHONG Yifan`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. 22*bcb5dc79SHONG Yifan 23*bcb5dc79SHONG YifanThis rule uses a Bash command on Linux/macOS/non-Windows, and a cmd.exe command on Windows (no Bash is required). 24*bcb5dc79SHONG Yifan 25*bcb5dc79SHONG Yifan 26*bcb5dc79SHONG Yifan**PARAMETERS** 27*bcb5dc79SHONG Yifan 28*bcb5dc79SHONG Yifan 29*bcb5dc79SHONG Yifan| Name | Description | Default Value | 30*bcb5dc79SHONG Yifan| :------------- | :------------- | :------------- | 31*bcb5dc79SHONG Yifan| <a id="copy_file-name"></a>name | Name of the rule. | none | 32*bcb5dc79SHONG Yifan| <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 | 33*bcb5dc79SHONG Yifan| <a id="copy_file-out"></a>out | Path of the output file, relative to this package. | none | 34*bcb5dc79SHONG Yifan| <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 `bazel run` and can be in the srcs of binary and test rules that require executable sources. WARNING: If `allow_symlink` is True, `src` must also be executable. | `False` | 35*bcb5dc79SHONG Yifan| <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). | `False` | 36*bcb5dc79SHONG Yifan| <a id="copy_file-kwargs"></a>kwargs | further keyword arguments, e.g. `visibility` | none | 37*bcb5dc79SHONG Yifan 38*bcb5dc79SHONG Yifan 39