Skip to content

Commit 86c3b4d

Browse files
thunderseethecopybara-github
authored andcommitted
Use executable in place of file.
`ctx.executable` will automatcially propagate runfiles when passed as a tool. This is relevant for bazel's rustfmt which is a thin binary that spawns a subprocess to call the actual rustfmt binary from runfiles. PiperOrigin-RevId: 845940833
1 parent ef2f153 commit 86c3b4d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

cc_bindings_from_rs/bazel_support/cc_bindings_from_rust_rule.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,11 @@ def _generate_bindings(ctx, target, basename, inputs, args, rustc_env, proto_cra
185185
ctx.actions.run(
186186
outputs = outputs,
187187
inputs = depset(
188-
[ctx.file._clang_format, ctx.file._rustfmt, ctx.file._rustfmt_cfg],
188+
[ctx.file._rustfmt_cfg],
189189
transitive = [inputs],
190190
),
191191
env = rustc_env | verbose_log_env,
192-
tools = [toolchain.binary],
192+
tools = [toolchain.binary, ctx.executable._rustfmt, ctx.executable._clang_format],
193193
executable = ctx.executable._process_wrapper,
194194
mnemonic = "CcBindingsFromRust",
195195
progress_message = "Generating C++ bindings from Rust: %s" % h_out_file,

cc_bindings_from_rs/bazel_support/toolchain.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def _cc_bindings_from_rs_toolchain_impl(ctx):
1313
return [
1414
platform_common.ToolchainInfo(
1515
cc_bindings_from_rs_toolchain_info = CcBindingsFromRustToolchainInfo(
16-
binary = ctx.file.binary,
16+
binary = ctx.executable.binary,
1717
),
1818
),
1919
]

0 commit comments

Comments
 (0)