Skip to content

Commit

Permalink
Fix error reporting in java_binary that launcher is not present
Browse files Browse the repository at this point in the history
It may happen there is a select in use_launcher and then launcher attribute is set to a label flag (not none). While the select may still resolve to False. We can't do any better.

We shouldn't report an error in this case, because the launcher is not used and the user didn't set the launcher attribute.

PiperOrigin-RevId: 562504797
Change-Id: I5a1a020fd4cd1832b600124fa876caf890b0a08b
  • Loading branch information
comius authored and copybara-github committed Sep 4, 2023
1 parent e3e31e6 commit 93b679f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/starlark/builtins_bzl/common/java/java_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def basic_java_binary(
"""
if not ctx.attr.create_executable and (ctx.attr.launcher and cc_common.launcher_provider in ctx.attr.launcher):
fail("launcher specified but create_executable is false")
if not ctx.attr.use_launcher and (ctx.attr.launcher and cc_common.launcher_provider in ctx.attr.launcher):
if not ctx.attr.use_launcher and (ctx.attr.launcher and ctx.attr.launcher.label != semantics.LAUNCHER_FLAG_LABEL):
fail("launcher specified but use_launcher is false")

if not ctx.attr.srcs and ctx.attr.deps:
Expand Down

0 comments on commit 93b679f

Please sign in to comment.