| load("@bazel_tools//tools/jdk:default_java_toolchain.bzl", "JDK9_JVM_OPTS", "default_java_toolchain") |
| |
| package(default_visibility = ["//visibility:public"]) |
| |
| java_runtime( |
| name = "jdk17_runtime", |
| srcs = select({ |
| "@platforms//os:macos": glob(["mac/**"]), |
| "@platforms//os:windows": glob(["win/**"]), |
| "@platforms//os:linux": glob(["linux/**"]), |
| }), |
| java_home = select({ |
| "@platforms//os:macos": "mac/Contents/Home", |
| "@platforms//os:windows": "win", |
| "@platforms//os:linux": "linux", |
| }), |
| ) |
| |
| # use jdk17 toolchain when '--java_runtime_version=jdk17' flag is provided |
| config_setting( |
| name = "jdk17_name_setting", |
| values = {"java_runtime_version": "jdk17"}, |
| visibility = ["//visibility:private"], |
| ) |
| |
| toolchain( |
| name = "runtime_toolchain_definition", |
| target_settings = [":jdk17_name_setting"], |
| toolchain = ":jdk17_runtime", |
| toolchain_type = "@bazel_tools//tools/jdk:runtime_toolchain_type", |
| ) |
| |
| JDK17_JVM_OPTS = JDK9_JVM_OPTS + [ |
| # jdk17 specific options (that would not be applied to jdk11 or jdk21) |
| # for test only options, that are compatible with all jdk please use ./tools/base/bazel/common.bazelrc |
| ] |
| |
| default_java_toolchain( |
| name = "jdk17_toolchain_java11", |
| java_runtime = ":jdk17_runtime", |
| jvm_opts = JDK17_JVM_OPTS, |
| source_version = "11", |
| target_version = "11", |
| ) |
| |
| default_java_toolchain( |
| name = "jdk17_toolchain_java17", |
| java_runtime = ":jdk17_runtime", |
| jvm_opts = JDK17_JVM_OPTS, |
| source_version = "17", |
| target_version = "17", |
| ) |
| |
| filegroup( |
| name = "jdk17_runtime_files", |
| srcs = ["BUILD"] + select({ |
| "@platforms//os:macos": glob(["mac/**"]), |
| "@platforms//os:windows": glob(["win/**"]), |
| "@platforms//os:linux": glob(["linux/**"]), |
| }), |
| ) |
| |
| filegroup( |
| name = "jdk17_runtime_linux_files", |
| srcs = glob(["linux/**"]), |
| visibility = ["//visibility:public"], |
| ) |