Skip to content

Commit 1ccc4be

Browse files
tjgqrules_java Copybara
authored andcommitted
Pass Java version in Windows launch info.
PiperOrigin-RevId: 960880927 Change-Id: I9e0c3d0b5cc606d16beb2cec7779d45b4c4dc8ed
1 parent 8309c61 commit 1ccc4be

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

java/bazel/rules/bazel_java_binary.bzl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ def _format_classpath_entry(runfiles_enabled, workspace_prefix, file):
281281
return "$(rlocation " + paths.normalize(workspace_prefix + file.short_path) + ")"
282282

283283
def _create_windows_exe_launcher(ctx, java_executable, classpath, main_class, jvm_flags_for_launcher, runfiles_enabled, coverage_enabled, executable, coverage_main_class):
284+
java_runtime_toolchain = semantics.find_java_runtime_toolchain(ctx)
284285
launch_info = ctx.actions.args().use_param_file("%s", use_always = True).set_param_file_format("multiline")
285286
launch_info.add("binary_type=Java")
286287
launch_info.add(ctx.workspace_name, format = "workspace_name=%s")
@@ -291,7 +292,8 @@ def _create_windows_exe_launcher(ctx, java_executable, classpath, main_class, jv
291292
launch_info.add(coverage_main_class, format = "jacoco_main_class=%s")
292293
launch_info.add_joined(classpath, map_each = _short_path, join_with = ";", format_joined = "classpath=%s", omit_if_empty = False)
293294
launch_info.add_joined(jvm_flags_for_launcher, join_with = "\t", format_joined = "jvm_flags=%s", omit_if_empty = False)
294-
launch_info.add(semantics.find_java_runtime_toolchain(ctx).java_home_runfiles_path, format = "jar_bin_path=%s/bin/jar.exe")
295+
launch_info.add(java_runtime_toolchain.java_home_runfiles_path, format = "jar_bin_path=%s/bin/jar.exe")
296+
launch_info.add(java_runtime_toolchain.version, format = "java_version=%s")
295297

296298
# TODO(b/295221112): Change to use the "launcher" attribute (only windows use a fixed _launcher attribute)
297299
launcher_artifact = ctx.executable._launcher

0 commit comments

Comments
 (0)