Skip to content

Commit

Permalink
Add a build_target parameter to deploy jar creation and use the act…
Browse files Browse the repository at this point in the history
…ual `java_binary` target label as it's value

This removes dependence on the internal suffix which will differ for `java_test` deploy jars

PiperOrigin-RevId: 509548615
Change-Id: I5ed9ad293e83f92cb436a1e63d8b2e36d578a108
  • Loading branch information
hvadehra authored and Copybara-Service committed Feb 14, 2023
1 parent 4b58dfb commit fb056bc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def _bazel_deploy_jars_impl(ctx):
info.main_class,
info.coverage_main_class,
info.strip_as_default,
ctx.attr.binary.label.name,
)

return []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def create_deploy_archives(
main_class,
coverage_main_class,
strip_as_default,
build_target,
hermetic = False,
add_exports = depset(),
add_opens = depset(),
Expand All @@ -51,6 +52,7 @@ def create_deploy_archives(
runfiles: (Depset) the runfiles for the deploy jar
main_class: (String) FQN of the entry point for execution
coverage_main_class: (String) FQN of the entry point for coverage collection
build_target: (String) Name of the build target for stamping
strip_as_default: (bool) Whether to create unstripped deploy jar
hermetic: (bool)
add_exports: (depset)
Expand Down Expand Up @@ -85,6 +87,7 @@ def create_deploy_archives(
runtime_classpath,
manifest_lines,
build_info_files,
build_target,
output = ctx.outputs.deployjar,
shared_archive = shared_archive,
one_version_level = one_version_level,
Expand All @@ -108,6 +111,7 @@ def create_deploy_archives(
runtime_classpath,
manifest_lines,
build_info_files,
build_target,
output = ctx.outputs.unstrippeddeployjar,
multi_release = multi_release,
hermetic = hermetic,
Expand All @@ -127,6 +131,7 @@ def _create_deploy_archive(
runtime_classpath,
manifest_lines,
build_info_files,
build_target,
output,
shared_archive = None,
one_version_level = "OFF",
Expand All @@ -152,7 +157,7 @@ def _create_deploy_archive(
args.set_param_file_format("shell").use_param_file("@%s", use_always = True)

args.add("--output", output)
args.add("--build_target", str(ctx.label)[:-len(DEPLOY_JAR_RULE_NAME_SUFFIX)])
args.add("--build_target", build_target)
args.add("--normalize")
args.add("--compression")
if main_class:
Expand Down

0 comments on commit fb056bc

Please sign in to comment.