blob: f53828e8cd10dbd408ae8f8d266f5ba6de30f1b2 [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 buck.android_resource}
/***/
{template .soyweb}
{call buck.page}
{param title: 'android_resource()' /}
{param navid: 'rule_android_resource' /}
{param prettify: true /}
{param description}
A rule that is used to bundle Android resources that are traditionally
stored in res and assets directories.
{/param}
{param content}
{call buck.rule}
{param status: 'FROZEN' /}
{param overview}
An <code>android_resource()</code> rule is used to bundle Android resources
that are traditionally stored in <code>res</code> and <code>assets</code> directories.
<p>
The output of an <code>android_resource()</code> is an <code>R.txt</code> file
generated via <code>aapt --output-text-symbols</code>.
{/param}
{param args}
{call buck.name_arg /}
{call buck.arg}
{param name: 'res' /}
{param default : 'None' /}
{param desc}
A dictionary mapping relative resource paths to either
the resource files or the build targets that generate them.
The <a href="{ROOT}function/subdir_glob.html"><code>subdir_glob()</code></a> function
can be used to generate dictionaries based on a directory structure of files checked
into the repository. Alternatively, this can be a path to a directory containing
Android resources, although this option is deprecated and might be removed in the future.
{/param}
{/call}
{call buck.arg}
{param name: 'package' /}
{param default : 'None' /}
{param desc}
Java package for the <code>R.java</code> file that will be generated for these
resources.
{/param}
{/call}
{call buck.arg}
{param name: 'assets' /}
{param default : 'None' /}
{param desc}
A dictionary mapping relative asset paths to either
the asset files or the build targets that generate them.
The <a href="{ROOT}function/subdir_glob.html"><code>subdir_glob()</code></a> function
can be used to generate dictionaries based on a directory structure of files checked
into the repository. Alternatively, this can be a path to a directory containing
Android assets, although this option is deprecated and might be removed in the future.
{/param}
{/call}
{call buck.arg}
{param name: 'project_res' /}
{param default : 'None' /}
{param desc}
A directory containing resources to be used for project generation.
If not provided, defaults to whatever the build uses.
{/param}
{/call}
{call buck.arg}
{param name: 'project_assets' /}
{param default : 'None' /}
{param desc}
A directory containing assets to be used for project generation.
If not provided, defaults to whatever the build uses.
{/param}
{/call}
{call android_common.manifest_arg}
{param type: 'resource' /}
{/call}
{call buck.arg}
{param name: 'deps' /}
{param default : 'None' /}
{param desc}
Other <code>android_resource</code> rules to include via <code>-S</code> when
running <code>aapt</code>.
{/param}
{/call}
{/param} // args
{param examples}
Most of the time, an <code>android_resource</code> rule defines only{sp}
<code>name</code>, <code>res</code>, and <code>package</code>. By convention,
such simple rules are often named <code>res</code>:
{literal}<pre class="prettyprint lang-py">
android_resource(
name = 'res',
res = subdir_glob([('res', '**')]),
package = 'com.example',
)
</pre>{/literal}
{/param} // examples
{/call} // buck.rule
{/param}
{/call}
{/template}