blob: 78d49d6d4486bcce2c7f68d6293a21af45b307e3 [file] [log] [blame]
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{namespace genrule}
/***/
{template .soyweb}
{call buck.page}
{param title: 'genrule()' /}
{param navid: 'rule_genrule' /}
{param prettify: true /}
{param description}
A rule that is used to generate files from a shell command. It must
produce a single output file or folder.
{/param}
{param content}
{call buck.rule}
{param status: 'FROZEN' /}
{param overview}
A <code>genrule()</code> is used to generate files from a shell
command. It must produce a single output file or folder.
{/param}
{param args}
{call buck.name_arg /}
{call genrule_common.srcs_arg /}
{call genrule_common.cmd_arg /}
{call genrule_common.bash_arg /}
{call genrule_common.cmd_exe_arg /}
{call genrule_common.type_arg /}
{call genrule_common.out_arg /}
{call genrule_common.environment_expansion_separator /}
{call buck.arg}
{param name: 'enable_sandbox' /}
{param default : 'False' /}
{param desc}
Whether this target should be executed in a sandbox or not.
{/param}
{/call}
{call buck.arg}
{param name: 'executable' /}
{param default : 'False' /}
{param desc}
Whether the output of the genrule is itself executable. Marking an output as
executable makes <code>buck run</code> and <code>$(exe ...)</code> macro
expansion work with this target.
{/param}
{/call}
{call buck.arg}
{param name: 'remote' /}
{param default : 'False' /}
{param desc}
Opts this genrule in to remote execution. Note that it is only safe to
execute a genrule remotely if it is completely hermetic and completely
and correctly describes its dependencies. Defaults to false. This parameter
is unstable. It is subject to removal, default reversal, and other arbitrary
changes in the future.
{/param}
{/call}
{call buck.tests_arg /}
{/param} // args
{param examples}
This genrule() uses a Python script to derive a new
{sp}<code>AndroidManifest.xml</code> from an
{sp}<code>AndroidManifest.xml</code> in the source tree.
Note you don't need to prepend execution commands with
{sp}<code>python</code>: Buck knows how to execute different
kinds of binaries using <code>$(exe)</code> command.
{literal}<pre class="prettyprint lang-py">
genrule(
name = 'generate_manifest',
srcs = [
'AndroidManifest.xml',
],
bash = '$(exe //python/android:basic_to_full) ' \
'$SRCDIR/AndroidManifest.xml > $OUT',
cmd_exe = '$(exe //python/android:basic_to_full) ' \
'%SRCDIR%\\AndroidManifest.xml > %OUT%',
out = 'AndroidManifest.xml',
)
</pre>{/literal}
{/param} // examples
{/call} // buck.rule
{/param}
{/call}
{/template}