blob: beedb93d79398e2a8deb220679627333723898d6 [file] [log] [blame]
{namespace buck.genfile}
{template .soyweb}
{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 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 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">
name = 'messenger_manifest',
srcs = [
cmd = 'python AndroidManifest.xml > $OUT',
out = 'AndroidManifest.xml',
name = 'messenger',
manifest = genfile('AndroidManifest.xml'),
target = 'Google Inc.:Google APIs:16',
keystore = '//keystores:prod',
deps = [
# Additional dependent android_library rules would be listed
# here, as well.
{/call} // buck.rule
{/param} // content