JavaInfo
Encapsulates all information provided by Java rules.Members
JavaInfo
JavaInfo JavaInfo(output_jar, compile_jar=None, source_jar=None, neverlink=False, deps=[], runtime_deps=[], exports=[], actions=None, sources=None, source_jars=None, use_ijar=None, java_toolchain=None, host_javabase=None, jdeps=None)The
JavaInfo
constructor.
Parameters
Parameter | Description |
---|---|
output_jar
|
The jar that was created as a result of a compilation (e.g. javac, scalac, etc). |
compile_jar
|
A jar that is added as the compile-time dependency in lieu of |
source_jar
|
The source jar that was used to create the output jar. Use |
neverlink
|
If true only use this library for compilation and not at runtime. |
deps
|
Compile time dependencies that were used to create the output jar. |
runtime_deps
|
Runtime dependencies that are needed for this library. |
exports
|
Libraries to make available for users of this library. See also java_library.exports. |
actions
|
Deprecated. No longer needed when Used to create the ijar and pack source files to jar actions. |
sources
|
Deprecated. Use The sources that were used to create the output jar. |
source_jars
|
Deprecated. Use The source jars that were used to create the output jar. |
use_ijar
|
Deprecated. Use If an ijar of the output jar should be created and stored in the provider. |
java_toolchain
|
Deprecated. No longer needed when The toolchain to be used for retrieving the ijar tool and packing source files to Jar. This should be a Target. |
host_javabase
|
Deprecated. No longer needed when The host_javabase to be used for packing source files to Jar. This should be a Target. |
jdeps
|
jdeps information for the rule output (if available). This should be a binary proto encoded using the deps.proto protobuf included with Bazel. If available this file is typically produced by a compiler. IDEs and other tools can use this information for more efficient processing. |
annotation_processing
java_annotation_processing JavaInfo.annotation_processingReturns information about annotation processing for this Java target. May return
None
.
compilation_info
java_compilation_info JavaInfo.compilation_infoReturns compilation information for this Java target. May return
None
.
compile_jars
depset JavaInfo.compile_jarsReturns the compile time jars required by this target directly. They can be:
- interface jars (ijars), if an ijar tool was used, either by calling java_common.create_provider(use_ijar=True, ...) or by passing --use_ijars on the command line for native Java rules and `java_common.compile`
- normal full jars, if no ijar action was requested
- both ijars and normal full jars, if this provider was created by merging two or more providers created with different ijar requests
full_compile_jars
depset JavaInfo.full_compile_jarsReturns the full compile time jars required by this target directly. They can be
- the corresponding normal full jars of the ijars returned by `compile_jars`
- the normal full jars returned by `compile_jars`
outputs
java_output_jars JavaInfo.outputsReturns information about outputs of this Java target. May return
None
.
runtime_output_jars
sequence JavaInfo.runtime_output_jarsReturns the runtime output jars provided by this Java target.
source_jars
sequence JavaInfo.source_jarsReturns a list of jar files containing all the uncompiled source files (including those generated by annotations) from the target itself, i.e. NOT including the sources of the transitive dependencies
to_json
string JavaInfo.to_json()Creates a JSON string from the struct parameter. This method only works if all struct elements (recursively) are strings, ints, booleans, other structs, a list of these types or a dictionary with string keys and values of these types. Quotes and new lines in strings are escaped. Examples:
struct(key=123).to_json() # {"key":123} struct(key=True).to_json() # {"key":true} struct(key=[1, 2, 3]).to_json() # {"key":[1,2,3]} struct(key='text').to_json() # {"key":"text"} struct(key=struct(inner_key='text')).to_json() # {"key":{"inner_key":"text"}} struct(key=[struct(inner_key=1), struct(inner_key=2)]).to_json() # {"key":[{"inner_key":1},{"inner_key":2}]} struct(key=struct(inner_key=struct(inner_inner_key='text'))).to_json() # {"key":{"inner_key":{"inner_inner_key":"text"}}}
to_proto
string JavaInfo.to_proto()Creates a text message from the struct parameter. This method only works if all struct elements (recursively) are strings, ints, booleans, other structs or a list of these types. Quotes and new lines in strings are escaped. Keys are iterated in the sorted order. Examples:
struct(key=123).to_proto() # key: 123 struct(key=True).to_proto() # key: true struct(key=[1, 2, 3]).to_proto() # key: 1 # key: 2 # key: 3 struct(key='text').to_proto() # key: "text" struct(key=struct(inner_key='text')).to_proto() # key { # inner_key: "text" # } struct(key=[struct(inner_key=1), struct(inner_key=2)]).to_proto() # key { # inner_key: 1 # } # key { # inner_key: 2 # } struct(key=struct(inner_key=struct(inner_inner_key='text'))).to_proto() # key { # inner_key { # inner_inner_key: "text" # } # }
transitive_compile_time_jars
depset JavaInfo.transitive_compile_time_jarsDepset of compile time jars recusrively required by this target. See `compile_jars` for more details.
transitive_deps
depset JavaInfo.transitive_depsReturns the transitive set of Jars required to build the target.
transitive_exports
depset JavaInfo.transitive_exportsReturns transitive set of labels that are being exported from this rule.
transitive_runtime_deps
depset JavaInfo.transitive_runtime_depsReturns the transitive set of Jars required on the target's runtime classpath.
transitive_runtime_jars
depset JavaInfo.transitive_runtime_jarsDepset of runtime jars required by this target
transitive_source_jars
depset JavaInfo.transitive_source_jarsReturns the Jars containing Java source files for the target and all of its transitive dependencies.