Skip to content
This repository has been archived by the owner on Mar 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #54 from kevingessner/multirun-runfiles
Browse files Browse the repository at this point in the history
multirun: propagate the entire runfiles of dependencies
  • Loading branch information
ash2k committed Mar 21, 2019
2 parents 7d29600 + 9387649 commit 986ed8f
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions multirun/def.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -euo pipefail
"""

def _multirun_impl(ctx):
transitive_depsets = []
runfiles = ctx.runfiles()
content = [_CONTENT_PREFIX]

for command in ctx.attr.commands:
Expand All @@ -20,7 +20,7 @@ def _multirun_impl(ctx):

default_runfiles = defaultInfo.default_runfiles
if default_runfiles != None:
transitive_depsets.append(default_runfiles.files)
runfiles = runfiles.merge(default_runfiles)
content.append("echo Running %s\n./%s $@\n" % (shell.quote(str(command.label)), shell.quote(exe.short_path)))

out_file = ctx.actions.declare_file(ctx.label.name + ".bash")
Expand All @@ -31,9 +31,7 @@ def _multirun_impl(ctx):
)
return [DefaultInfo(
files = depset([out_file]),
runfiles = ctx.runfiles(
transitive_files = depset([], transitive = transitive_depsets),
),
runfiles = runfiles,
executable = out_file,
)]

Expand Down Expand Up @@ -61,12 +59,12 @@ def multirun(**kwargs):
)

def _command_impl(ctx):
transitive_depsets = []
runfiles = ctx.runfiles()
defaultInfo = ctx.attr.command[DefaultInfo]

default_runfiles = defaultInfo.default_runfiles
if default_runfiles != None:
transitive_depsets.append(default_runfiles.files)
runfiles = runfiles.merge(default_runfiles)

str_env = [
"%s=%s" % (k, shell.quote(v))
Expand Down Expand Up @@ -96,9 +94,7 @@ def _command_impl(ctx):
return [
DefaultInfo(
files = depset([out_file]),
runfiles = ctx.runfiles(
transitive_files = depset([], transitive = transitive_depsets),
),
runfiles = runfiles,
executable = out_file,
),
]
Expand Down

0 comments on commit 986ed8f

Please sign in to comment.