/* * 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
groovy_library} /***/ {template .soyweb} {call buck.page} {param
title: 'groovy_library()' /} {param navid: 'rule_groovy_library' /}
{param prettify: true /} {param description} A rule that is used to
define a set of Groovy files that can be compiled together. It can also
be used to cross compile a set of Groovy and Java files. {/param} {param
content} {call buck.rule} {param status: 'UNFROZEN' /} {param
overview} A groovy_library()
rule is used to define a set of Groovy
files that can be compiled together. It can also be used to cross
compile a set of Groovy and Java files. The main output of a
{sp}groovy_library()
rule is a single JAR file containing all of the
compiled class files and resources. {/param} {param args} {call
buck.name_arg /} {call buck.arg} {param name: 'srcs' /} {param default
: '[]' /} {param desc} The set of files to compile for this rule.
Usually these will all end in .groovy
, but if any of the files end in
.java
, cross compilation using the jdk found in JAVA_HOME
will
occur. {/param} {/call} {call buck.arg} {param name: 'resources' /}
{param default : '[]' /} {param desc} This is the same as in {call
buck.java_library /}. {/param} {/call} {call buck.arg} {param name:
'deps' /} {param default : '[]' /} {param desc} Rules (usually
other groovy_library
or {call buck.java_library /}
rules) that are
used to generate the classpath required to compile this
groovy_library
. This is the same as in {call buck.java_library /}.
{/param} {/call} {call buck.arg} {param name: 'exported_deps' /}
{param default : '[]' /} {param desc} Other groovy_library
and
{call buck.java_library /}
rules that depend on this rule will also
include its exported_deps
in their classpaths. This is the same as in
{call buck.java_library /}. {/param} {/call} {call buck.arg} {param
name: 'provided_deps' /} {param default : '[]' /} {param desc}
This is the same as in {call buck.java_library /}. {/param} {/call}
{call buck.arg} {param name: 'extra_groovyc_arguments' /} {param
default : '[]' /} {param desc} List of additional arguments to pass
into the Groovy compiler. {/param} {/call} {call buck.arg} {param name:
'source' /} {param default : '' /} {param desc} Only used during
cross compilation. This is the same as in {call buck.java_library /}.
{/param} {/call} {call buck.arg} {param name: 'target' /} {param
default : '' /} {param desc} Only used during cross compilation. This
is the same as in {call buck.java_library /}. {/param} {/call} {call
buck.arg} {param name: 'java_version' /} {param default: '' /}
{param desc} Only used during cross compilation. This is the same as in
{call buck.java_library /}. {/param} {/call} {call buck.arg} {param
name: 'extra_arguments' /} {param default : '[]' /} {param desc}
Only used during cross compilation. This is the same as in {call
buck.java_library /}. {/param} {/call} {/param} // close args {param
examples} {literal}
# A rule that compiles a single .groovy file.
groovy_library(
name = 'example',
srcs = ['MySourceFile.groovy'],
)
# A rule that compiles all of the .groovy files under the directory in
# which the rule is defined using glob()
groovy_library(
name = 'groovy-only',
srcs = glob(['**/*.groovy']),
)
# A rule that cross compiles all of the .groovy and .java files under
# the directory in which the rule is defined, failing if compiling the
# java files generates any compiler warnings
groovy_library(
name = 'cross-compilation',
srcs = glob(['**/*.groovy', '**/*.java']),
java_version = 8,
extra_arguments = [
'-Werror',
],
)
{/literal} {/param} {/call} // close buck.rule {/param} {/call} {/template}