Documentation

Edit

java_common

Utilities for Java compilation support in Skylark.

compile

struct java_common.compile(arg0:ctx, *, source_jars=[], source_files=[], output, javac_opts=[], deps=[], strict_deps='ERROR', java_toolchain, host_javabase, sourcepath=[], resources=[])

Compiles Java source files/jars from the implementation of a Skylark rule and returns a provider that represents the results of the compilation and can be added to the set of providers emitted by this rule.

Parameters

Parameter Description
source_jars

sequence of Files

A list of the jars to be compiled. At least one of source_jars or source_files should be specified.

source_files

sequence of Files

A list of the Java source files to be compiled. At least one of source_jars or source_files should be specified.

output

File

javac_opts

sequence of strings

A list of the desired javac options. Optional.

deps

sequence of structs

A list of dependencies. Optional.

strict_deps

string

A string that specifies how to handle strict deps. Possible values: 'OFF' (silently allowing referencing transitive dependencies) and 'ERROR' (failing to build when transitive dependencies are used directly). By default 'OFF'.

java_toolchain

Target

A label pointing to a java_toolchain rule to be used for this compilation. Mandatory.

host_javabase

Target

A label pointing to a JDK to be used for this compilation. Mandatory.

sourcepath

sequence of Files

resources

sequence of Files

make_non_strict

struct java_common.make_non_strict(arg0:struct)

Returns a new Java provider whose direct-jars part is the union of both the direct and indirect jars of the given Java provider.

merge

struct java_common.merge(arg0:sequence)

Merges the given providers into a single java_common.provider.

provider

Provider java_common.provider

Returns the Java declared provider.