Skip to content

Commit 77d5f45

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 0141a5b commit 77d5f45

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
@@ -208,11 +208,11 @@ def _generate_bindings(ctx, target, basename, inputs, args, rustc_env, proto_cra
208208
ctx.actions.run(
209209
outputs = outputs,
210210
inputs = depset(
211-
[ctx.file._clang_format, ctx.file._rustfmt, ctx.file._rustfmt_cfg],
211+
[ctx.file._rustfmt_cfg],
212212
transitive = [inputs],
213213
),
214214
env = rustc_env | verbose_log_env | _rustc_lib_env(ctx),
215-
tools = [toolchain.binary],
215+
tools = [toolchain.binary, ctx.executable._rustfmt, ctx.executable._clang_format],
216216
executable = ctx.executable._process_wrapper,
217217
mnemonic = "CcBindingsFromRust",
218218
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)