Replace iteration over depsets with an explicit .to_list() call

The old pattern did an implicit iteration over a depset which will be forbidden in the future since it is potentially expensive. The new to_list() call is still expensive but it will be more visible.

LSC: []
Tested:
    TAP --sample for global presubmit queue
    []

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=221266626
This commit is contained in:
jianglai 2018-11-13 07:56:29 -08:00
parent 4a31232423
commit 9fa2a84c35

View file

@ -161,7 +161,7 @@ def _zip_file(ctx):
for _, zip_path in mapped
if "/" in zip_path
],
)
).to_list()
]
cmd += [
'ln -sf "${repo}/%s" "${tmp}/%s"' % (path, zip_path)
@ -181,7 +181,7 @@ def _zip_file(ctx):
ctx.file_action(output = script, content = "\n".join(cmd), executable = True)
inputs = [ctx.file._zipper]
inputs += [dep.zip_file for dep in ctx.attr.deps]
inputs += list(srcs)
inputs += srcs.to_list()
ctx.action(
inputs = inputs,
outputs = [ctx.outputs.out],