groovy_library()
This is liable to change in the future.
Agroovy_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 groovy_library()
rule is a single JAR file containing all of the compiled class files and resources.Arguments
name
(required) #The short name for this build target.
srcs
(defaults to[]
) #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 inJAVA_HOME
will occur.resources
(defaults to[]
) #This is the same as in
java_library
.deps
(defaults to[]
) #Rules (usually other
groovy_library
or
rules) that are used to generate the classpath required to compile thisjava_library
groovy_library
. This is the same as injava_library
.exported_deps
(defaults to[]
) #Other
groovy_library
and
rules that depend on this rule will also include itsjava_library
exported_deps
in their classpaths. This is the same as injava_library
.provided_deps
(defaults to[]
) #This is the same as in
java_library
.extra_groovyc_arguments
(defaults to[]
) #List of additional arguments to pass into the Groovy compiler.
source
(defaults to<global value>
) #Only used during cross compilation. This is the same as in
java_library
.target
(defaults to<global value>
) #Only used during cross compilation. This is the same as in
java_library
.java_version
(defaults to<global value>
) #Only used during cross compilation. This is the same as in
java_library
.extra_arguments
(defaults to[]
) #Only used during cross compilation. This is the same as in
java_library
.visibility
(defaults to[]
) #List of build target patterns that identify the build rules that can include this rule as a dependency, for example, by listing it in their
deps
orexported_deps
attributes. For more information, see visibility.licenses
(defaults to[]
) #Set of license files for this library. To get the list of license files for a given build rule and all of its dependencies, you can use
buck query
.labels
(defaults to[]
) #Set of arbitrary strings which allow you to annotate a build rule with tags that can be searched for over an entire dependency tree using
buck query attrfilter()
.
Examples
# 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', ], )