Skip to content

Commit

Permalink
Fix merging of runfiles library runfiles (#557)
Browse files Browse the repository at this point in the history
Runfiles should not be merged as files, unless promoting data
dependencies.

Fixes #556
  • Loading branch information
fmeum authored Feb 20, 2025
1 parent 8f6c207 commit dc5d3e1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rules/runfiles/complex_tool.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ sub_tool = rule(
)

def _complex_tool_impl(ctx):
my_runfiles = ctx.runfiles(files = [ctx.files._data[0], ctx.files._runfiles_lib[0]])
my_runfiles = ctx.runfiles(files = ctx.files._data)

# Use runfiles.merge to merge the runfiles of both tools. All runfiles will
# be rooted under the runfiles directory owned by this rule, however.
my_runfiles = my_runfiles.merge(ctx.attr._subtool[DefaultInfo].default_runfiles)
my_runfiles = my_runfiles.merge(ctx.attr._runfiles_lib[DefaultInfo].default_runfiles)

# Thus the example directory structure is:
# runfiles/complex_tool (executable)
Expand Down Expand Up @@ -102,7 +103,6 @@ complex_tool = rule(
default = ":complex_tool_data.txt",
),
"_runfiles_lib": attr.label(
allow_single_file = True,
default = "@bazel_tools//tools/bash/runfiles",
),
},
Expand Down

0 comments on commit dc5d3e1

Please sign in to comment.