Skip to main content

aquery

These are the flags/commands under buck2 aquery and their --help output:

buck aquery

buck2-release-aquery 
Perform queries on the action graph (experimental)

The action graph consists of all the declared actions for a build,
with dependencies when one action consumes the outputs of another
action.

Run `buck2 docs aquery` or
https://buck2.build/docs/users/query/aquery/
for more documentation about the functions available in aquery
expressions.

Examples:

Print the action producing a target's default output

`buck2 aquery //java/com/example/app:amazing`

List all the commands for run actions for building a target

`buck2 aquery 'kind(run, deps("//java/com/example/app:amazing+more"))' --output-attribute=cmd`

Dynamic outputs (`ctx.actions.dynamic_output`):

Currently, aquery interacts poorly with dynamic outputs. It may
return incorrect results or otherwise behave unexpectedly.

USAGE:
buck2-release aquery [OPTIONS] <QUERY> [--] [QUERY_ARGS]...

ARGS:
<QUERY>
the query to evaluate

<QUERY_ARGS>...
list of literals for a multi-query (one containing `%s` or `%Ss`)

OPTIONS:
-a, --output-attribute <ATTRIBUTE>
Regular expressions to match attributes. Regular expressions are used in "search" mode,
so for example empty string matches all attributes including special attributes.

When using in automation, please specify the regular expression to match the attribute
precisely, for example `--output-attribute '^headers$'` to make it easier to track which
special attributes are used.

-A, --output-all-attributes
Output all attributes, equivalent of --output-attribute ''.

Avoid using this flag in automation because it may be expensive to produce certain
attributes, and because it makes harder to track which special attributes are used.

-B, --output-basic-attributes
Output basic attributes, namely those the user can supply, plus rule type and package
name

-c, --config <SECTION.OPTION=VALUE>
List of config options

--client-metadata <CLIENT_METADATA>
Metadata key-value pairs to inject into Buck2's logging. Client metadata must be of the
form `key=value`, where `key` is a snake_case identifier, and will be sent to backend
datasets

--config-file <PATH>
List of config file paths

--console <super|simple|...>
Which console to use for this command

[env: BUCK_CONSOLE=]
[default: auto]
[possible values: simple, simplenotty, simpletty, super, auto, none]

--disable-starlark-types
Disable runtime type checking in Starlark interpreter.

This option is not stable, and can be used only locally to diagnose evaluation
performance problems.

--dot
Output in Graphviz Dot format

--dot-compact
Output in a more compact format than Graphviz Dot

--event-log <PATH>
Write events to this log file

--exit-when-different-state
Used for exiting a concurrent command when a different state is detected

--fake-arch <ARCH>
[possible values: default, aarch64, x8664]

--fake-host <HOST>
[possible values: default, linux, macos, windows]

--fake-xcode-version <VERSION-BUILD>
Value must be formatted as: version-build (e.g., 14.3.0-14C18 or 14.1-14B47b)

-h, --help
Print help information

--json
Output in JSON format

-m, --modifier <VALUE>
A configuration modifier to configure all targets on the command line. This may be a
constraint value target.

--no-interactive-console
Disable console interactions

[env: BUCK_NO_INTERACTIVE_CONSOLE=]

--oncall <ONCALL>
The oncall executing this command

--output-attributes <ATTRIBUTE>...
Deprecated: Use `--output-attribute` instead.

List of space-separated attributes to output, --output-attributes attr1 attr2.

--output-format <dot|dot_compact|json>
Output format (default: list).

dot - dot graph format.

dot_compact - compact alternative to dot format.

json - JSON format.


[possible values: dot, json, dot_compact]

--reuse-current-config
Re-uses any `--config` values (inline or via modefiles) if there's a previous command,
otherwise the flag is ignored.

If there is a previous command and `--reuse-current-config` is set, then the old config
is used, ignoring any overrides.

If there is no previous command but the flag was set, then the flag is ignored, the
command behaves as if the flag was not set at all.

--skip-targets-with-duplicate-names
If there are targets with duplicate names in `BUCK` file, skip all the duplicates but
the first one. This is a hack for TD. Do not use this option

--stack
Record or show target call stacks.

Starlark call stacks will be included in duplicate targets error.

If a command outputs targets (like `targets` command), starlark call stacks will be
printed after the targets.

--target-platforms <PLATFORM>
Configuration target (one) to use to configure targets

--ui <UI>
Configure additional superconsole ui components.

Accepts a comma-separated list of superconsole components to add. Possible values are:

dice - shows information about evaluated dice nodes debugevents - shows information
about the flow of events from buckd

These components can be turned on/off interactively. Press 'h' for help when
superconsole is active.

[possible values: dice, debugevents, io, re]

--unstable-write-invocation-record <PATH>
Write the invocation record (as JSON) to this path. No guarantees whatsoever are made
regarding the stability of the format

-v, --verbose <VERBOSITY>
How verbose buck should be while logging.

Values: 0 = Quiet, errors only; 1 = Show status. Default; 2 = more info about errors; 3
= more info about everything; 4 = more info about everything + stderr;

It can be combined with specific log items (stderr, full_failed_command, commands,
actions, status, stats, success) to fine-tune the verbosity of the log. Example usage
"-v=1,stderr"

[default: 1]

--write-build-id <PATH>
Write command invocation id into this file