Skip to content

Commit

Permalink
Correctly propagate runfiles from data dependencies to gazelle (#1094)
Browse files Browse the repository at this point in the history
This is a followup to #1008 which fixed this problem for the
gazelle_binary but not for the data attribute of the gazelle rule.

We are working on a python extension, where the gazelle binary will have a py_binary in its data deps.
Without this fix, the runfiles of that py_binary are absent at runtime and gazelle fails like
FileNotFoundError: [Errno 2] No such file or directory: '/home/alexeagle/.cache/bazel/_bazel_alexeagle/cdec52671ea8b1684766cfc23dcfc4be/execroot/rules_python/bazel-out/k8-fastbuild/bin/gazelle/g.runfiles/bazel_tools/tools/python/py3wrapper.sh'
  • Loading branch information
alexeagle committed Aug 19, 2021
1 parent d7082fb commit 2834ea4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion def.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ def _gazelle_runner_impl(ctx):
runfiles = ctx.runfiles(files = [
ctx.executable.gazelle,
go_tool,
] + ctx.files.data).merge(
]).merge(
ctx.attr.gazelle[DefaultInfo].default_runfiles,
)
for d in ctx.attr.data:
runfiles = runfiles.merge(d[DefaultInfo].default_runfiles)
return [DefaultInfo(
files = depset([out_file]),
runfiles = runfiles,
Expand Down

0 comments on commit 2834ea4

Please sign in to comment.