執行「忍者」來建造富希西亞人
usage: fx build [options] [LABELS_OR_TARGETS]... [-- EXTRA_OPTIONS...]
Builds a set of targets after performing a few correctness checks for
the Fuchsia build. Ninja or Bazel specific options must be provided after
a -- specifier.
There are three ways to build targets with this command:
- The "GN build mode", which is the default, to build GN or Ninja artifacts
by specifying their labels or output paths, respectively, and using
a few options specific to this mode (e.g. --toolchain=TOOLCHAIN).
- The "Bazel build mode", which is enabled by using Bazel target labels
that begin with @ (e.g. @//src:foo), and Bazel-specific options
(e.g. "--config=NAME").
- The "Fint build mode", which is enabled by using --fint-params-path=FILE
to point to a fint textproto file describing the build configuration.
No other GN or Bazel related arguments are allowed in this mode.
Trying to mix Bazel or GN/Ninja related labels or options is not supported
and an error message will be printed detailing the issue if this happens.
Some options (e.g. --host) can be used in both modes.
If no Bazel labels or option is used, the build mode defaults to GN, which
is useful to run Ninja tools, e.g. `fx build -- -t <tool> <tool-options>`.
LABELS_OR_TARGETS is a list whose items can be:
- GN labels (beginning with //, e.g. //src/foo or //src/foo:bar)
- Ninja output paths (e.g. host_x64/fidlc) though this use is deprecated
and will print a warning.
- Bazel labels (beginning with @, e.g. @//src/foo or @//src/foo:bar)
Currently only host targets in the Bazel graph that do not depend on GN build
artifacts are supported. For example, one of:
fx build --host @//build/bazel/host_tests/cc_tests:static_test
fx build --config=host @//build/bazel/host_tests/cc_tests:static_test
Otherwise, LABELS_OR_TARGETS is a list of Ninja target paths, GN labels
(beginning with //) or `--toolchain=NAME` options or related aliases (see below).
For example, the following lines are equivalent ways to ask for the host `zbi`
tool to be built with Ninja:
fx build --host //zircon/tools/zbi
fx build --host //zircon/tools/zbi:zbi
fx build --toolchain=//build/toolchain:host_x64 //zircon/tools/zbi
fx build '//zircon/tools/zbi(//build/toolchain:host_x64)'
fx build host_x64/zbi
The first line above is favored. Using the last line will print a warning
instructing the user which (optional) toolchain option + label to use instead.
optional arguments:
-h, --help Print this message. Use '-- --help' to print
Ninja-specific help.
--no-checks Disable consistency checks (for fx development only).
--log=LOGFILE
--log LOGFILE Print debug information to LOGFILE. Please attach
the resulting file when reporting bugs.
--fint-params-path=PATH
--fint-params-path PATH Path to a fint params file used by an infra
builder. This is useful for reproducing the exact
set of targets built by the infrastructure.
All other options listed below are ignored in this mode.
--toolchain=TOOLCHAIN Specify the current GN toolchain suffix to use for
GN labels that appear after this option. It is an error
to use this with any Bazel target label or option.
--config=NAME Specify a Bazel --config argument. It is an error to use
this with any GN target label or Ninja output path argument.
-j <count> Specify an explicit max job count for both Ninja
and Bazel.
-q, --quiet Tell Ninja and Bazel to be quiet.
--skip-auth-check Bypass pre-flight build service authentication
checks.
--verbose Print extra information, such as the list of
Ninja targets corresponding to the input GN labels
to build. This does *not* enable Ninja --verbose flag,
use '-- --verbose' to do that.
--host When building with Ninja, an alias for --toolchain=host.
When building with Bazel, an alias for --config=host
--default Alias for --toolchain=default
(incompatible with Bazel build mode)
--fuchsia Alias for --toolchain=fuchsia
(incompatible with Bazel build mode)
--fidl Alias for --toolchain=fidl
(incompatible with Bazel build mode)
-- [ARGS...] Pass all following arguments directly to Ninja or
Bazel.
--help-toolchains Print list of valid TOOLCHAIN values.
Run `fx build -- -h` to see Ninja argument details.