• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!-- Generated with Stardoc: http://skydoc.bazel.build -->
2
3A rule that writes a UTF-8 encoded text file from user-specified contents.
4
5native.genrule() is sometimes used to create a text file. The 'write_file' and
6macro does this with a simpler interface than genrule.
7
8The rules generated by the macro do not use Bash or any other shell to write the
9file. Instead they use Starlark's built-in file writing action
10(ctx.actions.write).
11
12
13<a id="#write_file"></a>
14
15## write_file
16
17<pre>
18write_file(<a href="#write_file-name">name</a>, <a href="#write_file-out">out</a>, <a href="#write_file-content">content</a>, <a href="#write_file-is_executable">is_executable</a>, <a href="#write_file-newline">newline</a>, <a href="#write_file-kwargs">kwargs</a>)
19</pre>
20
21Creates a UTF-8 encoded text file.
22
23**PARAMETERS**
24
25
26| Name  | Description | Default Value |
27| :------------- | :------------- | :------------- |
28| <a id="write_file-name"></a>name |  Name of the rule.   |  none |
29| <a id="write_file-out"></a>out |  Path of the output file, relative to this package.   |  none |
30| <a id="write_file-content"></a>content |  A list of strings. Lines of text, the contents of the file. Newlines are added automatically after every line except the last one.   |  <code>[]</code> |
31| <a id="write_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.   |  <code>False</code> |
32| <a id="write_file-newline"></a>newline |  one of ["auto", "unix", "windows"]: line endings to use. "auto" for platform-determined, "unix" for LF, and "windows" for CRLF.   |  <code>"auto"</code> |
33| <a id="write_file-kwargs"></a>kwargs |  further keyword arguments, e.g. &lt;code&gt;visibility&lt;/code&gt;   |  none |
34
35
36