Skip to content

Commit

Permalink
Set java on remote JDKs
Browse files Browse the repository at this point in the history
If the `java` attribute on `java_runtime` isn't set, Bazel guesses it
based on the host platform, which can be different from the execution
platform.

https://github.com/bazelbuild/bazel/blob/04a05677e4714434ec196c45a4ccbd8e0ef2f0ff/src/main/java/com/google/devtools/build/lib/rules/java/JavaRuntime.java#L46

Work towards bazelbuild/bazel#19587
  • Loading branch information
fmeum committed Sep 22, 2023
1 parent d20ae04 commit 11e73be
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions toolchains/jdk_build_file.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ java_runtime(
":jdk-lib",
":jre",
],
# Provide the 'java` binary explicitly so that the correct path is used by
# Bazel even when the host platform differs from the execution platform.
java = glob(["bin/java.exe", "bin/java"])[0],
version = {RUNTIME_VERSION},
)
"""

0 comments on commit 11e73be

Please sign in to comment.