Skip to content

Commit

Permalink
Use a list comp to build the depset to avoid overly nesting.
Browse files Browse the repository at this point in the history
RELNOTES: None.
PiperOrigin-RevId: 260720040
  • Loading branch information
thomasvl authored and swiple-rules-gardener committed Jul 30, 2019
1 parent 371f686 commit 9dd3b16
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions rules/apple_genrule.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def _compute_make_variables(
return variables

def _apple_genrule_impl(ctx):
resolved_srcs = depset()
if not ctx.outputs.outs:
fail("apple_genrule must have one or more outputs", attr = "outs")
files_to_build = depset(ctx.outputs.outs)
Expand All @@ -52,10 +51,8 @@ def _apple_genrule_impl(ctx):
attr = "executable",
)

label_dict = {}
for dep in ctx.attr.srcs:
resolved_srcs = depset(transitive = [resolved_srcs, dep.files])
label_dict[dep.label] = dep.files.to_list()
resolved_srcs = depset(transitive = [dep.files for dep in ctx.attr.srcs])
label_dict = {dep.label: dep.files.to_list() for dep in ctx.attr.srcs}

resolved_inputs, argv, runfiles_manifests = ctx.resolve_command(
command = ctx.attr.cmd,
Expand Down

0 comments on commit 9dd3b16

Please sign in to comment.