Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make jvm_import use java from resolved toolchain instead of host machine. #1058

Merged
merged 1 commit into from
Feb 23, 2024

Conversation

jin
Copy link
Member

@jin jin commented Feb 22, 2024

This ensures that the AddJarManifestEntry jar used in the jvm_import actions is executed with the jdk version set by the downstream project's language version (which was used to correctly build the jar itself), which resolves to the right toolchain, instead of using whatever @local_jdk resolves to.

This fixes the case where the jar is built with a newer JDK version/lang level, but executed with an older runtime.

Unblocks Bazel's JDK 21 upgrade.

Fixes #895

@jin
Copy link
Member Author

jin commented Feb 22, 2024

@comius, mind checking if my toolchain usage is kosher?

Copy link
Collaborator

@shs96c shs96c left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

private/rules/jvm_import.bzl Outdated Show resolved Hide resolved
@jin jin merged commit 5a78bc6 into bazelbuild:master Feb 23, 2024
8 checks passed
fmeum added a commit to fmeum/rules_jvm_external that referenced this pull request Feb 23, 2024
PR bazelbuild#1058 made the `jvm_import` actions use Java toolchains rather than
host tools, but chose the runtime used to run `javac` instead of the
runtime used to run build tools. The latter can be configured via
`--tool_java_runtime_version` while the former is fixed in the Java
compilation toolchain.
jin pushed a commit that referenced this pull request Feb 23, 2024
PR #1058 made the `jvm_import` actions use Java toolchains rather than
host tools, but chose the runtime used to run `javac` instead of the
runtime used to run build tools. The latter can be configured via
`--tool_java_runtime_version` while the former is fixed in the Java
compilation toolchain.
jin added a commit to jin/rules_jvm_external that referenced this pull request Feb 23, 2024
These PRs aren't needed since the downstream Bazel build just needed to
pass `--tool_java_runtime_version` on top of
`--tool_java_language_version`.

cc @fmeum
shs96c pushed a commit that referenced this pull request Feb 23, 2024
These PRs aren't needed since the downstream Bazel build just needed to
pass `--tool_java_runtime_version` on top of
`--tool_java_language_version`.

cc @fmeum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants