Skip to content

Commit

Permalink
Don't include "phantom inputs" in singlejar actions
Browse files Browse the repository at this point in the history
This shouldn't be necessary, now that we're using validation actions.
  • Loading branch information
Jaden Peterson committed Oct 30, 2024
1 parent 6235cbf commit 16a61d6
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 16 deletions.
5 changes: 1 addition & 4 deletions rules/common/private/utils.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ def action_singlejar(
ctx,
inputs,
output,
phantom_inputs = depset(),
main_class = None,
progress_message = None,
resources = {},
Expand All @@ -174,8 +173,6 @@ def action_singlejar(

if type(inputs) == "list":
inputs = depset(inputs)
if type(phantom_inputs) == "list":
phantom_inputs = depset(phantom_inputs)

args = ctx.actions.args()
args.add("--exclude_build_data")
Expand All @@ -190,7 +187,7 @@ def action_singlejar(
args.set_param_file_format("multiline")
args.use_param_file("@%s", use_always = True)

all_inputs = depset(resources.values(), transitive = [inputs, phantom_inputs])
all_inputs = depset(resources.values(), transitive = [inputs])

ctx.actions.run(
arguments = [args],
Expand Down
2 changes: 1 addition & 1 deletion rules/private/phases/phase_binary_launcher.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def phase_binary_launcher(ctx, g):

g.out.providers.append(DefaultInfo(
executable = ctx.outputs.bin,
files = depset([ctx.outputs.bin, ctx.outputs.jar]),
files = depset([ctx.outputs.bin, ctx.outputs.jar] + g.semanticdb.outputs),
runfiles = ctx.runfiles(
files = inputs + files,
transitive_files = depset(
Expand Down
2 changes: 1 addition & 1 deletion rules/private/phases/phase_library_defaultinfo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

def phase_library_defaultinfo(ctx, g):
g.out.providers.append(DefaultInfo(
files = depset([ctx.outputs.jar]),
files = depset([ctx.outputs.jar] + g.semanticdb.outputs),
))
5 changes: 1 addition & 4 deletions rules/private/phases/phase_singlejar.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,9 @@ def phase_singlejar(ctx, g):
# cause the build to fail, cleanly, if any declared outputs are
# missing from previous phases.
inputs = [f for f in ctx.files.resource_jars if f.extension.lower() in ["jar"]]
phantom_inputs = []
for v in [getattr(g, k) for k in dir(g) if k not in ["to_json", "to_proto"]]:
if hasattr(v, "jar"):
jar = getattr(v, "jar")
inputs.append(jar)
if hasattr(v, "outputs"):
phantom_inputs.extend(getattr(v, "outputs"))

_action_singlejar(ctx, inputs, ctx.outputs.jar, phantom_inputs)
_action_singlejar(ctx, inputs, ctx.outputs.jar)
7 changes: 1 addition & 6 deletions rules/private/phases/phase_test_launcher.bzl
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
load("//rules/common:private/utils.bzl", _collect = "collect", _write_launcher = "write_launcher")
load(
"@rules_scala_annex//rules/private:coverage_replacements_provider.bzl",
_coverage_replacements_provider = "coverage_replacements_provider",
)
load(
"//rules/common:private/utils.bzl",
_action_singlejar = "action_singlejar",
_collect = "collect",
_write_launcher = "write_launcher",
)

#
# PHASE: test_launcher
Expand Down

0 comments on commit 16a61d6

Please sign in to comment.