Skip to content

Commit 6235cbf

Browse files
author
Jaden Peterson
committed
Made dependency checking a validation action
1 parent 21add76 commit 6235cbf

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

rules/private/phases/phase_zinc_depscheck.bzl

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ def phase_zinc_depscheck(ctx, g):
2020
return
2121

2222
deps_configuration = ctx.attr.scala[_DepsConfiguration]
23-
24-
deps_checks = {}
2523
labeled_jar_groups = depset(transitive = [dep[_LabeledJars].values for dep in ctx.attr.deps])
26-
2724
worker_inputs, _, worker_input_manifests = ctx.resolve_command(tools = [deps_configuration.worker])
25+
outputs = []
26+
2827
for name in ("direct", "used"):
2928
deps_check = ctx.actions.declare_file("{}/depscheck_{}.success".format(ctx.label.name, name))
3029
deps_args = ctx.actions.args()
@@ -61,21 +60,16 @@ def phase_zinc_depscheck(ctx, g):
6160
),
6261
arguments = [deps_args],
6362
)
64-
deps_checks[name] = deps_check
6563

66-
outputs = []
67-
if deps_configuration.direct == "error":
68-
outputs.append(deps_checks["direct"])
69-
if deps_configuration.used == "error":
70-
outputs.append(deps_checks["used"])
64+
if getattr(deps_configuration, name) == "error":
65+
outputs.append(deps_check)
7166

72-
g.out.output_groups["depscheck"] = depset(outputs)
67+
if "_validation" in g.out.output_groups:
68+
validation_transitive = [g.out.output_groups["_validation"]]
69+
else:
70+
validation_transitive = None
7371

74-
return struct(
75-
checks = deps_checks,
76-
outputs = outputs,
77-
toolchain = deps_configuration,
78-
)
72+
g.out.output_groups["_validation"] = depset(outputs, transitive = validation_transitive)
7973

8074
# If you use avoid using map_each, then labels are converted to their apparent repo name rather than
8175
# their canonical repo name. The apparent repo name is the human readable one that we want for use

0 commit comments

Comments
 (0)