Skip to content
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

Support --output=commands flag for aquery #24949

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pcc
Copy link

@pcc pcc commented Jan 16, 2025

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 #22389.

@github-actions github-actions bot added team-Performance Issues for Performance teams team-Documentation Documentation improvements that cannot be directly linked to other team labels awaiting-review PR is awaiting review from an assigned reviewer labels Jan 16, 2025
@meisterT meisterT requested a review from joeleba January 22, 2025 11:09
Copy link
Member

@joeleba joeleba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

@gregestren gregestren removed their request for review January 22, 2025 18:54
@pcc pcc force-pushed the output-commands branch from 6400279 to a7d3d3d Compare January 23, 2025 00:10
@joeleba joeleba added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Jan 23, 2025
@meisterT
Copy link
Member

Do we print the lines in a particular order? I see that ninja does: "given a list of targets, print a list of commands which, if executed in order, may be used to rebuild those targets, assuming that all output files are out of date."

@pcc
Copy link
Author

pcc commented Jan 28, 2025

No, it's just the iteration order used by bazel aquery which is normally unordered according to https://bazel.build/query/language#graph-order . That being said I normally use it with deps which does have an order but https://bazel.build/query/language#deps just says "The resulting graph is ordered according to the dependency relation". Empirically, it seems to be a pre-order traversal (nodes appear before dependencies, i.e. the opposite of Ninja's order).

@meisterT
Copy link
Member

Perhaps include a statement in the docs, saying something like "Do not rely on the order of output."

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.
@pcc pcc force-pushed the output-commands branch from a7d3d3d to 8a7e2a0 Compare February 1, 2025 04:04
@pcc
Copy link
Author

pcc commented Feb 1, 2025

Perhaps include a statement in the docs, saying something like "Do not rely on the order of output."

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally team-Documentation Documentation improvements that cannot be directly linked to other team labels team-Performance Issues for Performance teams
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add aquery output format with one command per line
3 participants