feat(bazel): allow integration commands to resolve executables through expansion #285
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.
Given a tool built using
nodejs_binary
orsh_binary
, the tool cannotbe used as binary in an integration test command currently because:
Bazel location expansion does not respect the executable "FilesToRun"
information of the binaries, and rather sees all outputs, erroring
that
$(locations X)
need to be used instead. See e.g. sh_binary has multiple outputs in some contexts bazelbuild/bazel#11820)The command is currently split by space and this decouples the Make
funtion expression incorrectly into a broken expansion. e.g.
$(rootpath X)
will become["$(rootpath", "X"]
).This commit fixes both things by relying on the Bazel
CommandHelper.java
class which handles the expansion of commands asexpected, with similar semantics of a
genrule
as perGenRuleBase.java
.This allows test authors to conveniently use a
nodejs_binary
orsh_binary
as command binary because theCommandHelper
knowsexactly which targets provide executables or not. There is no good API
for the plain Make expansion of a command itself, so we use a little trick
(which is documented sufficiently in the code).