Skip to content

Commit

Permalink
Dereference alias chains while computing deps for java_* targets
Browse files Browse the repository at this point in the history
This matches native behaviour. Without this change, default files of java_binary/java_test targets that are referenced via an alias do not get added to compile/runtime classpaths.

PiperOrigin-RevId: 507720516
Change-Id: Ibcc0e7870cb9cc8548bcd02951a4217083bb3441
  • Loading branch information
hvadehra authored and copybara-github committed Feb 7, 2023
1 parent 623481b commit 39c7bd5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/starlark/builtins_bzl/common/java/java_common.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def _filter_javainfo_and_legacy_jars(attr):
# Native code collected data into a NestedSet, using add for legacy jars and
# addTransitive for JavaInfo. This resulted in legacy jars being first in the list.
for dep in attr:
kind = java_common.target_kind(dep)
kind = java_common.target_kind(dep, dereference_aliases = True)
if not JavaInfo in dep or kind == "java_binary" or kind == "java_test":
for file in dep[DefaultInfo].files.to_list():
if file.extension == "jar":
Expand Down

0 comments on commit 39c7bd5

Please sign in to comment.