-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add aquery output format with one command per line #22389
Comments
Have you tried bazel/src/main/protobuf/analysis_v2.proto Line 77 in 75e5d2f
|
As I mentioned in my initial feature request, I'm sure that it would be possible to write a tool that parses the protobuf written by one of the proto output formats, and writes out the commands in the desired format. But should every user who wants the command list in this format write their own tool? I expect that it wouldn't just be me who would use such a tool: a Google search for |
@pcc do you want to contribute this yourself? |
This output format prints a list of build commands with one command per line, similar to `ninja -t commands`. This is frequently useful when debugging build issues. Fixes bazelbuild#22389.
This output format prints a list of build commands with one command per line, similar to `ninja -t commands`. This is frequently useful when debugging build issues. Fixes bazelbuild#22389.
This output format prints a list of build commands with one command per line, similar to `ninja -t commands`. This is frequently useful when debugging build issues. Fixes bazelbuild#22389.
Description of the feature request:
Make it so that
bazel aquery --output=commands
prints a list of commands with one command per line, similar toninja -t commands
.Which category does this issue belong to?
CLI
What underlying problem are you trying to solve with this feature?
When debugging build issues I frequently need to extract specific compile commands. Although
bazel aquery 'deps(target)'
prints the command lines used to build a specific target, each command will be printed over N lines with one argument per line, which makes it harder to use command line tools to extract commands. For example, I cannotgrep
the output for a particular file name to extract all commands dealing with that file. And when I copy-paste the command into my terminal to edit it before running it, one-line-per-argument would typically cause the command to become taller than my terminal window, which makes it harder to edit in most shells. When working with Ninja-based build systems, I normally use thecommands
tool andgrep
its output. With Bazel I ended up writing anawk
script that converts theaquery
output into the one-line-per-command format:But this script is clearly sensitive to Bazel's specific
aquery
format, which I imagine might change in the future. It also doesn't include environment variables, which fortunately I haven't needed so far. I guess it might be possible to feed one of the proto output formats into a separate program that converts the protos into the one-line-per-command format, but that would be a lot more work than my simple awk script. So the request is to add a straightforward and future-proof way to print the command list in this format, for example by adding an--output=commands
flag.Which operating system are you running Bazel on?
Linux
What is the output of
bazel info release
?release 7.1.2
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse HEAD
?No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: