Skip to content

Commit

Permalink
Add a note to the JavaInfo documentation about binary targets
Browse files Browse the repository at this point in the history
Fixes #22147

PiperOrigin-RevId: 633506820
Change-Id: I952de33d922a00d135b58703bfd2036a41b0cccb
  • Loading branch information
hvadehra authored and Copybara-Service committed May 14, 2024
1 parent 79f2830 commit c282c54
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,23 @@ public interface JavaInfoApi<

@StarlarkMethod(
name = "transitive_runtime_jars",
doc = "Returns a transitive set of Jars required on the target's runtime classpath.",
doc =
"""
Returns a transitive set of Jars required on the target's runtime classpath.
<p/>Note: for binary targets (such as java_binary and java_test), this is empty, since such targets
are not intended to be dependencies of other Java targets.
""",
structField = true)
Depset getTransitiveRuntimeJars();

@StarlarkMethod(
name = "transitive_compile_time_jars",
doc = "Returns the transitive set of Jars required to build the target.",
doc =
"""
Returns the transitive set of Jars required to build the target.
<p/>Note: for binary targets (such as java_binary and java_test), this is empty, since such targets
are not intended to be dependencies of other Java targets.
""",
structField = true)
Depset getTransitiveCompileTimeJars();

Expand Down
12 changes: 10 additions & 2 deletions src/main/starlark/builtins_bzl/common/java/java_info.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,16 @@ def _javainfo_init(
JavaInfo, _new_javainfo = provider(
doc = "Info object encapsulating all information by java rules.",
fields = {
"transitive_runtime_jars": "(depset[File]) A transitive set of jars required on the runtime classpath.",
"transitive_compile_time_jars": "(depset[File]) The transitive set of jars required to build the target.",
"transitive_runtime_jars": """(depset[File]) A transitive set of jars required on the
runtime classpath.
<p/>Note: for binary targets (such as java_binary and java_test), this is empty, since such
targets are not intended to be dependencies of other Java targets.
""",
"transitive_compile_time_jars": """(depset[File]) The transitive set of jars required to
build the target.
<p/>Note: for binary targets (such as java_binary and java_test), this is empty, since such
targets are not intended to be dependencies of other Java targets.
""",
"compile_jars": """(depset[File]) The jars required 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.""",
Expand Down

0 comments on commit c282c54

Please sign in to comment.