blob: 3ae788d9f1744a8f5f7f508f60b1386fc476980f [file] [log] [blame]
{namespace buck.android_library}
/***/
{template .soyweb}
{call buck.page}
{param title: 'android_library()' /}
{param prettify: true /}
{param description}
A rule that is used to define a set of Java files that can be compiled
together against the Android SDK.
{/param}
{param content}
{call buck.rule}
{param status: 'FROZEN' /}
{param overview}
An <code>android_library()</code> rule is used to define a set of Java files
that can be compiled together against the Android SDK. The main output of an
{sp}<code>android_library()</code> rule is a single JAR file containing all of the
compiled class files and resources.
{/param}
{param args}
{call buck.arg}
{param name: 'name' /}
{param desc}
The name of the rule.
{/param}
{/call}
{call buck.arg}
{param name: 'srcs' /}
{param default : '[]' /}
{param desc}
The set of <code>.java</code> files to compile for this rule.
{/param}
{/call}
{call buck.arg}
{param name: 'resources' /}
{param default : '[]' /}
{param desc}
Static files to include among the compiled <code>.class</code>
{sp}files. These files can be loaded via <a
href="http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#getResource(java.lang.String)"
target="_blank">Class.getResource()</a>.
<p>
<strong>Note:</strong> Buck uses the <code>src_roots</code> property in
{sp}<a href="{ROOT}concept/buckconfig.html"><code>.buckconfig</code></a>
{sp}to help determine where resources should be placed within the generated JAR file.
<p>
{/param}
{/call}
{call buck.arg}
{param name: 'deps' /}
{param default : '[]' /}
{param desc}
Rules (usually other <code>android_library</code> rules)
that are used to generate the classpath required to compile this
{sp}<code>android_library</code>.
{/param}
{/call}
{call buck.arg}
{param name: 'source' /}
{param default : '<global value>' /}
{param desc}
Specifies the version of Java (as a string) to interpret source
files as.
Overrides the value in "source_level" in the "java" section
of <a
href="{ROOT}concept/buckconfig.html"><code>.buckconfig</code></a>.
{/param}
{/call}
{call buck.arg}
{param name: 'target' /}
{param default : '<global value>' /}
{param desc}
Specifies the version of Java (as a string) for which to
generate code.
Overrides the value in "target_level" in the "java" section
of <a
href="{ROOT}concept/buckconfig.html"><code>.buckconfig</code></a>.
{/param}
{/call}
{call buck.arg}
{param name: 'javac' /}
{param default : '<global value>' /}
{param desc}
Specifies the Java compiler program to use for this rule.
The value is a source path (e.g., //foo/bar:bar).
Only one of "javac" and "javac_jar" may be set for a given rule.
Overrides the value in "javac" in the "tools" section
of <a
href="{ROOT}concept/buckconfig.html"><code>.buckconfig</code></a>.
{/param}
{/call}
{call buck.arg}
{param name: 'javac_jar' /}
{param default : '<global value>' /}
{param desc}
Specifies the Java compiler program to use for this rule.
The value is a source path (e.g., //foo/bar:bar).
Only one of "javac_jar" and "javac" may be set for a given rule.
Overrides the value in "javac_jar" in the "tools" section
of <a
href="{ROOT}concept/buckconfig.html"><code>.buckconfig</code></a>.
{/param}
{/call}
{call buck.arg}
{param name: 'extra_arguments' /}
{param default : '[]' /}
{param desc}
List of additional arguments to pass into the Java compiler. These
arguments follow the ones specified in <a
href="{ROOT}concept/buckconfig.html"><code>.buckconfig</code></a>.
{/param}
{/call}
{call buck.arg}
{param name: 'exported_deps' /}
{param default : '[]' /}
{param desc}
This is the same as in <a href="{ROOT}rule/java_library.html">
<code>java_library</code></a>.
{/param}
{/call}
{call buck.visibility_arg /}
{/param} // args
{param examples}
An <code>android_library</code> rule used in concert with an
{sp}{call buck.android_resource /} rule.
This would be a common arrangement for a standard Android Library project
as defined by
{sp}<a href="http://developer.android.com/tools/projects/index.html">
http://developer.android.com/tools/projects/index.html</a>
{literal}<pre class="prettyprint lang-py">
android_resource(
name = 'res',
res = 'res',
package = 'com.example',
)
android_library(
name = 'my_library',
srcs = glob(['src/**/*.java']),
deps = [
':res',
],
)
</pre>{/literal}
{/param} // examples
{/call} // buck.rule
{/param} // content
{/call} // buck.page
{/template}