| {namespace buck.genfile} |
| |
| /***/ |
| {template .soyweb} |
| {call buck.page} |
| {param title: 'genfile()' /} |
| {param prettify: true /} |
| {param content} |
| |
| {call buck.rule} |
| {param overview} |
| The <code>genfile()</code> function is used to specify a file that is the |
| output of a <code>genrule()</code>. |
| {/param} |
| |
| {param args} |
| |
| {call buck.functionArg} |
| {param desc} |
| The first and only argument is the name of a file generated by a |
| {sp}<a href="{ROOT}rule/genrule.html"><code>genrule()</code></a>{sp} |
| (or a <a href="{ROOT}rule/gen_aidl.html"><code>gen_aidl()</code></a> rule) |
| in the same build file. |
| {/param} |
| {/call} |
| |
| {/param} |
| |
| {param examples} |
| In the following example, a <code>genrule()</code> named |
| {sp}<code>messenger_manifest</code> is used to generate a file named |
| {sp}<code>AndroidManifest.xml</code> in the <code>{GEN_DIR}</code>{sp} |
| directory. This file is used as the manifest in the <code>messenger</code>{sp} |
| build rule. The path must be wrapped in the <code>genfile()</code> function |
| so that the <code>android_binary()</code> rule uses the version of |
| {sp}<code>AndroidManifest.xml</code> in <code>{GEN_DIR}</code> rather than |
| the one in the same directory as the build file. |
| |
| {literal}<pre class="prettyprint lang-py"> |
| genrule( |
| name = 'messenger_manifest', |
| srcs = [ |
| 'update_manifest.py', |
| 'AndroidManifest.xml', |
| ], |
| cmd = 'python update_manifest.py AndroidManifest.xml > $OUT', |
| out = 'AndroidManifest.xml', |
| ) |
| |
| android_binary( |
| name = 'messenger', |
| manifest = genfile('AndroidManifest.xml'), |
| target = 'Google Inc.:Google APIs:16', |
| keystore = '//keystores:prod', |
| deps = [ |
| ':messenger_manifest', |
| # Additional dependent android_library rules would be listed |
| # here, as well. |
| ], |
| ) |
| </pre>{/literal} |
| |
| {/param} |
| {/call} // buck.rule |
| |
| {/param} // content |
| {/call} |
| {/template} |