From 830120a54bf0f1b987b87f393423c4cd0b6f86bc Mon Sep 17 00:00:00 2001 From: Googler Date: Sat, 12 Nov 2022 02:43:04 -0800 Subject: [PATCH] Add launcher resolution for bazel Starlark java_binary PiperOrigin-RevId: 488022324 Change-Id: I8cde2da82dc16c58512471cfa4d75b2500c04a12 --- .../builtins_bzl/common/java/java_binary.bzl | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/starlark/builtins_bzl/common/java/java_binary.bzl b/src/main/starlark/builtins_bzl/common/java/java_binary.bzl index 2f016c6cc4c120..76bc2aa0ead272 100644 --- a/src/main/starlark/builtins_bzl/common/java/java_binary.bzl +++ b/src/main/starlark/builtins_bzl/common/java/java_binary.bzl @@ -491,6 +491,17 @@ def _get_main_class(ctx): main_class = helper.primary_class(ctx) return main_class +def _get_launcher_info(ctx): + launcher = helper.launcher_artifact_for_target(ctx) + return struct( + launcher = launcher, + unstripped_launcher = launcher, + runfiles = [], + runtime_jars = [], + jvm_flags = [], + classpath_resources = [], + ) + BASIC_JAVA_BINARY_ATTRIBUTES = merge_attrs( BASIC_JAVA_LIBRARY_WITH_PROGUARD_IMPLICIT_ATTRS, { @@ -569,7 +580,7 @@ def _bazel_java_binary_impl(ctx): if coverage_config: main_class = coverage_config.main_class - launcher_info = None + launcher_info = _get_launcher_info(ctx) executable = None feature_config = helper.get_feature_config(ctx) strip_as_default = helper.should_strip_as_default(ctx, feature_config)