diff --git a/src/main/starlark/builtins_bzl/bazel/java/bazel_java_binary_wrapper.bzl b/src/main/starlark/builtins_bzl/bazel/java/bazel_java_binary_wrapper.bzl index 2857c57af5c6c2..5965a9c83f46db 100644 --- a/src/main/starlark/builtins_bzl/bazel/java/bazel_java_binary_wrapper.bzl +++ b/src/main/starlark/builtins_bzl/bazel/java/bazel_java_binary_wrapper.bzl @@ -31,6 +31,6 @@ def java_binary(**kwargs): java_bin_nonexec, java_bin_exec_no_launcher_flag, java_bin_exec, - deploy_jars, + rule_deploy_jars = deploy_jars, **kwargs ) diff --git a/src/main/starlark/builtins_bzl/common/java/java_binary_wrapper.bzl b/src/main/starlark/builtins_bzl/common/java/java_binary_wrapper.bzl index 66260d755ca66b..f9a5a10ecf63ef 100644 --- a/src/main/starlark/builtins_bzl/common/java/java_binary_wrapper.bzl +++ b/src/main/starlark/builtins_bzl/common/java/java_binary_wrapper.bzl @@ -20,7 +20,7 @@ the supplied value of the `create_executable` attribute. load(":common/java/java_binary_deploy_jar.bzl", "DEPLOY_JAR_RULE_NAME_SUFFIX") -def register_java_binary_rules(rule_exec, rule_nonexec, rule_nolauncher, rule_customlauncher, rule_deploy_jars, is_test_rule_class = False, **kwargs): +def register_java_binary_rules(rule_exec, rule_nonexec, rule_nolauncher, rule_customlauncher, rule_deploy_jars = None, is_test_rule_class = False, **kwargs): """Registers the correct java_binary rule and deploy jar rule Args: @@ -45,7 +45,9 @@ def register_java_binary_rules(rule_exec, rule_nonexec, rule_nolauncher, rule_cu else: rule_exec(**kwargs) - if not kwargs.get("tags", []) or "nodeployjar" not in kwargs.get("tags", []): + if rule_deploy_jars and ( + not kwargs.get("tags", []) or "nodeployjar" not in kwargs.get("tags", []) + ): deploy_jar_args = _filtered_dict(kwargs, _DEPLOY_JAR_RULE_ATTRS) if is_test_rule_class: deploy_jar_args["testonly"] = True