feat: add tools parameter to run_binary()#1252
Merged
jbedard merged 2 commits intobazel-contrib:mainfrom Apr 28, 2026
Merged
Conversation
e5aec35 to
ee5429d
Compare
jbedard
approved these changes
Apr 27, 2026
Collaborator
|
LGTM but I'd like at least one more reviewer to take a look before adding a new param like this. @alexeagle or @fmeum? |
Collaborator
|
or @kormide? |
jbedard
reviewed
Apr 28, 2026
One missing feature in `run_binary()` is that it does not support a way to provide any additional dependencies for the execution platform. All inputs other than the `tool` binary itself are built for the target platform. This means that, for example, there is no reliable way to provide another binary for the tool to invoke during the build action. If the execution and target platforms are sufficiently different then this will fail. This change remedies the problem by introducing a new `tools` parameter analogous to the one on [genrule](https://bazel.build/reference/be/general#genrule.tools). This parameter works similarly to `srcs` except that it builds the dependencies in the `exec` configuration. Fixes bazel-contrib#676. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
kormide
approved these changes
Apr 28, 2026
Collaborator
kormide
left a comment
There was a problem hiding this comment.
LGTM. I appreciate the thorough and clever testing.
fmeum
approved these changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One missing feature in
run_binary()is that it does not support a way to provide any additional dependencies for the execution platform. All inputs other than thetoolbinary itself are built for the target platform. This means that, for example, there is no reliable way to provide another binary for the tool to invoke during the build action. If the execution and target platforms are sufficiently different then this will fail.This change remedies the problem by introducing a new
toolsparameter analogous to the one ongenrule. This parameter works similarly to
srcsexcept that it builds the dependencies in theexecconfiguration.Fixes #676.