JavaInfo
A provider encapsulating information about Java and Java-like targets.Members
JavaInfo
JavaInfo JavaInfo(output_jar, compile_jar=None, source_jar=None, neverlink=False, deps=[], runtime_deps=[], exports=[], jdeps=None)The
JavaInfo
constructor.
Parameters
Parameter | Description |
---|---|
output_jar
|
; requiredThe jar that was created as a result of a compilation (e.g. javac, scalac, etc). |
compile_jar
|
File; or None ; default = NoneA jar that is added as the compile-time dependency in lieu of output_jar . Typically this is the ijar produced by run_ijar . If you cannot use ijar, consider instead using the output of stamp_ijar . If you do not wish to use either, you can simply pass output_jar .
|
source_jar
|
File; or None ; default = NoneThe source jar that was used to create the output jar. Use pack_sources to produce this source jar.
|
neverlink
|
; default = FalseIf true only use this library for compilation and not at runtime. |
deps
|
sequence of JavaInfos ; default = []Compile time dependencies that were used to create the output jar. |
runtime_deps
|
sequence of JavaInfos ; default = []Runtime dependencies that are needed for this library. |
exports
|
sequence of JavaInfos ; default = []Libraries to make available for users of this library. See also java_library.exports. |
jdeps
|
File; or None ; default = Nonejdeps 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/Java-like target. May return
None
.
compilation_info
java_compilation_info JavaInfo.compilation_infoReturns compilation information for this Java/Java-like target. May return
None
.
compile_jars
depset JavaInfo.compile_jarsReturns the Jars required by this target directly at compile time. They can be interface jars (ijar or hjar), regular jars or both, depending on whether rule implementations chose to create interface jars or not.
full_compile_jars
depset JavaInfo.full_compile_jarsReturns the regular, full compile time Jars required by this target directly. They can be
- the corresponding regular Jars of the interface Jars returned by
JavaInfo.compile_jars
- the regular (full) Jars returned by
JavaInfo.compile_jars
Note: JavaInfo.compile_jars
can return a mix of interface Jars and regular Jars.
Only use this method if interface Jars don't work with your rule set(s) (e.g. some Scala targets) If you're working with Java-only targets it's preferable to use interface Jars via JavaInfo.compile_jars
outputs
java_output_jars JavaInfo.outputsReturns information about outputs of this Java/Java-like target. May return
None
.
runtime_output_jars
sequence JavaInfo.runtime_output_jarsReturns a list of runtime Jars created by this Java/Java-like target.
source_jars
sequence JavaInfo.source_jarsReturns a list of Jars with all the source files (including those generated by annotations) of the target itself, i.e. NOT including the sources of the transitive dependencies.
to_json
string JavaInfo.to_json()Deprecated. This API is deprecated and will be removed soon. Please do not depend on it. It is disabled with
---incompatible_struct_has_no_methods
. Use this flag to verify your code is compatible with its imminent removal. 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"}}}.
Deprecated: instead, use json.encode(x) or json.encode_indent(x), which work for values other than structs and do not pollute the struct field namespace.
to_proto
string JavaInfo.to_proto()Deprecated. This API is deprecated and will be removed soon. Please do not depend on it. It is disabled with
---incompatible_struct_has_no_methods
. Use this flag to verify your code is compatible with its imminent removal. Creates a text message from the struct parameter. This method only works if all struct elements (recursively) are strings, ints, booleans, other structs or dicts or lists of these types. Quotes and new lines in strings are escaped. Struct 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" # } # } struct(foo={4: 3, 2: 1}).to_proto() # foo: { # key: 4 # value: 3 # } # foo: { # key: 2 # value: 1 # }
Deprecated: use proto.encode_text(x) instead.
transitive_compile_time_jars
depset JavaInfo.transitive_compile_time_jarsReturns the transitive set of Jars required to build the target. Returns the same as
JavaInfo.transitive_deps
for legacy reasons.
transitive_deps
depset JavaInfo.transitive_depsReturns the transitive set of Jars required to build the target. Returns the same as
JavaInfo.transitive_compile_time_jars
for legacy reasons.
transitive_exports
depset JavaInfo.transitive_exportsReturns a set of labels that are being exported from this rule transitively.
transitive_runtime_deps
depset JavaInfo.transitive_runtime_depsReturns the transitive set of Jars required on the target's runtime classpath. Returns the same as
JavaInfo.transitive_runtime_jars
for legacy reasons.
transitive_runtime_jars
depset JavaInfo.transitive_runtime_jarsReturns a transitive set of Jars required on the target's runtime classpath. Returns the same as
JavaInfo.transitive_runtime_deps
for legacy reasons.
transitive_source_jars
depset JavaInfo.transitive_source_jarsReturns the Jars containing source files of the current target and all of its transitive dependencies.