From 16a61d68880a603fd35b3029a6e0b8918459c65d Mon Sep 17 00:00:00 2001 From: Jaden Peterson Date: Wed, 30 Oct 2024 13:11:27 -0400 Subject: [PATCH] Don't include "phantom inputs" in singlejar actions This shouldn't be necessary, now that we're using validation actions. --- rules/common/private/utils.bzl | 5 +---- rules/private/phases/phase_binary_launcher.bzl | 2 +- rules/private/phases/phase_library_defaultinfo.bzl | 2 +- rules/private/phases/phase_singlejar.bzl | 5 +---- rules/private/phases/phase_test_launcher.bzl | 7 +------ 5 files changed, 5 insertions(+), 16 deletions(-) diff --git a/rules/common/private/utils.bzl b/rules/common/private/utils.bzl index b2f044d9f..a2df3166b 100644 --- a/rules/common/private/utils.bzl +++ b/rules/common/private/utils.bzl @@ -162,7 +162,6 @@ def action_singlejar( ctx, inputs, output, - phantom_inputs = depset(), main_class = None, progress_message = None, resources = {}, @@ -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") @@ -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], diff --git a/rules/private/phases/phase_binary_launcher.bzl b/rules/private/phases/phase_binary_launcher.bzl index 5d969ceaf..256664a49 100644 --- a/rules/private/phases/phase_binary_launcher.bzl +++ b/rules/private/phases/phase_binary_launcher.bzl @@ -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( diff --git a/rules/private/phases/phase_library_defaultinfo.bzl b/rules/private/phases/phase_library_defaultinfo.bzl index 3a3ca8bfb..029dfdfc8 100644 --- a/rules/private/phases/phase_library_defaultinfo.bzl +++ b/rules/private/phases/phase_library_defaultinfo.bzl @@ -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), )) diff --git a/rules/private/phases/phase_singlejar.bzl b/rules/private/phases/phase_singlejar.bzl index b12d6b505..4bcbc1cf8 100644 --- a/rules/private/phases/phase_singlejar.bzl +++ b/rules/private/phases/phase_singlejar.bzl @@ -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) diff --git a/rules/private/phases/phase_test_launcher.bzl b/rules/private/phases/phase_test_launcher.bzl index 11854c695..fcfd4cf35 100644 --- a/rules/private/phases/phase_test_launcher.bzl +++ b/rules/private/phases/phase_test_launcher.bzl @@ -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