From adc56e1d6359bd2664725b31d457d60c53e886f8 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Mon, 11 Sep 2023 09:33:53 +0200 Subject: [PATCH] fix!: remove `--java_runtime_version` match on version only 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 --- internal/graalvm_bindist.bzl | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/internal/graalvm_bindist.bzl b/internal/graalvm_bindist.bzl index 22850e45..f2ba07f8 100644 --- a/internal/graalvm_bindist.bzl +++ b/internal/graalvm_bindist.bzl @@ -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"], @@ -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"],