Skip to content

Commit

Permalink
fix!: remove --java_runtime_version match on version only
Browse files Browse the repository at this point in the history
Custom Java runtimes (those neither defined by the user nor rules_java)
should not match on `--java_runtime_version` set to a version without a
prefix as that can result in unexpected Java toolchain resolution
results.

By making this change now, we can consider registering both Java and GVM
toolchains automatically with Bzlmod in follow-up changes.

Signed-off-by: Fabian Meumertzheim <fabian@meumertzhe.im>
  • Loading branch information
fmeum authored and sgammon committed Sep 19, 2023
1 parent e0c0fe5 commit adc56e1
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions internal/graalvm_bindist.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ toolchain(
# different architectures. As every Java compilation toolchain depends on a bootstrap runtime in
# the same configuration, this constraint will not result in toolchain resolution failures.
exec_compatible_with = {target_compatible_with},
target_settings = [":version_or_prefix_version_setting"],
target_settings = [":prefix_version_setting"],
toolchain_type = "@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type",
toolchain = "{toolchain}",
visibility = ["//visibility:public"],
Expand Down Expand Up @@ -787,23 +787,10 @@ config_setting(
values = {{"java_runtime_version": "{prefix}_{version}"}},
visibility = ["//visibility:private"],
)
config_setting(
name = "version_setting",
values = {{"java_runtime_version": "{version}"}},
visibility = ["//visibility:private"],
)
alias(
name = "version_or_prefix_version_setting",
actual = select({{
":version_setting": ":version_setting",
"//conditions:default": ":prefix_version_setting",
}}),
visibility = ["//visibility:private"],
)
toolchain(
name = "toolchain",
target_compatible_with = {target_compatible_with},
target_settings = [":version_or_prefix_version_setting"],
target_settings = [":prefix_version_setting"],
toolchain_type = "@bazel_tools//tools/jdk:runtime_toolchain_type",
toolchain = "{toolchain}",
visibility = ["//visibility:public"],
Expand Down

0 comments on commit adc56e1

Please sign in to comment.