Skip to content

Commit 3f70ca1

Browse files
cushoncopybara-github
authored andcommitted
If both java_library and java_package_configuration override the bootclasspath, the java_library override should be used
Follow-up to d12959c PiperOrigin-RevId: 689861371 Change-Id: If89f9d425e7b6559c1634bae867af8025faa62ec
1 parent 1bb3185 commit 3f70ca1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/main/starlark/builtins_bzl/common/java/java_common_internal_for_builtins.bzl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,16 @@ def compile(
134134
["-Abazel.repository=" + ctx.label.workspace_name],
135135
order = "preorder",
136136
))
137-
system_override = False
137+
system_bootclasspath = None
138138
for package_config in java_toolchain._package_configuration:
139139
if package_config.matches(ctx.label):
140140
all_javac_opts.append(package_config.javac_opts)
141141
if package_config.system:
142-
if system_override:
142+
if system_bootclasspath:
143143
fail("Multiple system package configurations found for %s" % ctx.label)
144-
bootclasspath = package_config.system
145-
system_override = True
144+
system_bootclasspath = package_config.system
145+
if not bootclasspath:
146+
bootclasspath = system_bootclasspath
146147

147148
all_javac_opts.append(depset(
148149
["--add-exports=%s=ALL-UNNAMED" % x for x in add_exports],

0 commit comments

Comments
 (0)