Skip to main content

utargets

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

buck utargets

Show details about the specified targets.

This command is meant to only handle unconfigured targets, but for historical reasons, with certain
flags it can also work with configured targets.

Usage: buck2-release utargets [OPTIONS] [TARGET_PATTERNS]...

Arguments:
[TARGET_PATTERNS]...
Patterns to interpret

Options:
--json
Print targets as JSON

--json-lines
Print targets as JSON-lines

--stats
Print statistics of how many entries were processed

--resolve-alias
Print the fully-qualified build target for the specified aliases

--show-target-hash
Print a stable hash of each target after the target name

--show-unconfigured-target-hash
Print a stable unconfigured hash of each target after the target name

--target-hash-file-mode <TARGET_HASH_FILE_MODE>
Modifies computation of target hashes. If set to `PATHS_AND_CONTENTS` (the default), the
contents of all files referenced from the targets will be used to compute the target hash.
If set to `PATHS_ONLY`, only files' paths contribute to the hash. If set to `NONE` no
files will be used. See also --target-hash-modified-paths

[default: paths_and_contents]
[possible values: paths_only, paths_and_contents, none]

--target-hash-modified-paths <TARGET_HASH_MODIFIED_PATHS>...
Modifies computation of target hashes. Only effective when --target-hash-file-mode is set
to `PATHS_ONLY`. If a target or its dependencies reference a file from this set, the
target's hash will be different than if this option was omitted. Otherwise, the target's
hash will be the same as if this option was omitted

--target-hash-function <TARGET_HASH_FUNCTION>
Selects either the "fast" or the "strong" target hash function to be used for computing
target hashes. While we don't specify the exact algorithm, the "strong" algorithm should
be a reasonable cryptographic hash (ex. blake3) while the "fast" function will likely be a
non-crypto hash. Both functions are guaranteed to be deterministic and to have the same
value across different platforms/architectures

[default: fast]
[possible values: sha1, sha256, murmur-hash3, fast, strong]

--target-hash-recursive <TARGET_HASH_RECURSIVE>
When true, emit the hash or target node and all dependencies recursively. When false, hash
only the target node

[default: true]
[possible values: true, false]

-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

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

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

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

--include-defaults
Enables printing of default attributes. This would be attributes in a target that aren't
explicitly set in the target but instead use the default set in the rule declaration

--show-output
Print the path to the output for each of the rules relative to the project root

--show-full-output
Print the absolute path to the output for each of the rules

--show-simple-output
Print only the path to the output for each of the rules relative to the project root

--show-full-simple-output
Print only the absolute path to the output for each of the rules

--show-json-output
Print the output paths relative to the project root, in JSON format

--show-full-json-output
Print the output absolute paths, in JSON format

--keep-going
On loading errors, put buck.error in the output stream and continue

--streaming
Write output as soon as it is available. The order of the output items is
non-deterministic and if multiple patterns cover the same target, may have duplicates

--no-cache
Don't cache the target information on the build graph

--imports
Show the imports of each package/import. Shows an additional output per package/import
(not per target), including implicit dependencies (e.g. the prelude) but only direct
dependencies (not the transitive closure)

--package-values
Show the package values. Produces an additional attribute representing all the package
values for the package containing the target

--package-values-regex <VALUES>
Regular expressions to match package values. Produces an additional attribute representing
package values for the package containing the target. Regular expressions are used in
"search" mode so, for example, empty string matches all package values

-o, --output <PATH>
File to put the output in, rather than sending to stdout.

File will be created if it does not exist, and overwritten if it does.

-j, --num-threads <THREADS>
Number of threads to use during execution (default is # cores)

-h, --help
Print help (see a summary with '-h')

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

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

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

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

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

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

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

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

Starlark Options:
--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.

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

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

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

--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: I/O panel
- re: RE panel

--no-interactive-console
Disable console interactions

[env: BUCK_NO_INTERACTIVE_CONSOLE=]

Event Log Options:
--event-log <PATH>
Write events to this log file

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

--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

Universal Options:
-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]

--oncall <ONCALL>
The oncall executing this command

--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