Skip to content

Commit

Permalink
[7.1.0] Auto-create deploy jars for Bazel java_test targets if requ…
Browse files Browse the repository at this point in the history
…ested (#20762)

This adds bazel support for fixing
bazelbuild/intellij#5845. Once released, the
necessary changes will need to be made to the IntelliJ plugin.

PiperOrigin-RevId: 592136548
Change-Id: I6158f379e76b61e75ca51f34888aeecaf0303cc6

Co-authored-by: Googler <hvd@google.com>
  • Loading branch information
iancha1992 and hvadehra authored Jan 11, 2024
1 parent 261f046 commit 1fb63f9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/main/starlark/builtins_bzl/common/java/java_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,29 @@ def basic_java_binary(
manifest_lines = ctx.attr.deploy_manifest_lines,
)

# "temporary" workaround for https://github.com/bazelbuild/intellij/issues/5845
extra_files = []
if is_test_rule_class and ctx.fragments.java.auto_create_java_test_deploy_jars():
extra_files.append(_auto_create_deploy_jar(ctx, internal_deploy_jar_info))

internal_deploy_jar_info = InternalDeployJarInfo(
java_attrs = java_attrs,
launcher_info = struct(
runtime_jars = launcher_info.runtime_jars,
launcher = launcher_info.launcher,
unstripped_launcher = launcher_info.unstripped_launcher,
),
shared_archive = shared_archive,
main_class = main_class,
coverage_main_class = coverage_main_class,
strip_as_default = strip_as_default,
stamp = ctx.attr.stamp,
hermetic = hasattr(ctx.attr, "hermetic") and ctx.attr.hermetic,
add_exports = add_exports,
add_opens = add_opens,
manifest_lines = ctx.attr.deploy_manifest_lines,
)

# "temporary" workaround for https://github.com/bazelbuild/intellij/issues/5845
extra_files = []
if is_test_rule_class and ctx.fragments.java.auto_create_java_test_deploy_jars():
Expand Down

0 comments on commit 1fb63f9

Please sign in to comment.