Google is committed to advancing racial equity for Black communities. See how.

fx set

set up a build directory

usage: fx set PRODUCT.BOARD [--with GNLABEL1,GNLABEL2,...]
              [--release] [--auto-dir | --build-dir BUILDDIR]
              [--args ARG] [--help-args [ARG]] [--variant VARIANT]
              [--with-base GNLABEL1,GNLABEL2,...]

where PRODUCT is an entry from `//products` or `//vendor/*/products` and
BOARD is an entry from `//boards` or `//vendor/*/boards`. Use the
`fx list-products` and `fx list-boards` commands to see a list of
possible products and boards (respectively). See the in those
directories for a description of the various options.

BUILDDIR is the directory where the build output goes.
If it begins with `//` or `out/` then it's taken as relative to FUCHSIA_DIR.
Otherwise it should be an absolute path or a path relative to the current
working directory that winds up in `FUCHSIA_DIR/out`.
It defaults to `out/default`.

This command stores the location of the build directory in the //.fx-build-dir
file, which causes subsequent `fx` commands to use that build directory. Use
`fx use` to switch build directories.

Ensures Goma is ready (if Goma is enabled).

This is a wrapper around running `gn gen --check BUILDDIR --args ...`.
If GN fails with an error, `fx set` does not change anything.

optional arguments:
  --args                Additional argument to pass to gn.  If the --args
                        argument is given multiple times, all the specified
                        arguments are passed to gn.
                        N.B. Arguments must be expressed using GN's syntax.
                        In particular this means that for strings they must
                        be quoted with double-quotes, and the quoting must
                        survive, for example, the shell. Thus when passing
                        an argument that takes a string, pass it with
                        something like --args=foo='"bar"'. E.g.,
                        bash$ fx set core.x64 --args=foo='"bar"'
                        More complicated arguments, e.g., lists, require
                        their own special syntax. See GN documentation
                        for the syntax of each kind of argument.
  --auto-dir            Act like `fx --dir out/PRODUCT.BOARD set ...`.
  --ccache|--no-ccache  Whether to use ccache during the build. Ccache attempts
                        to make builds faster by caching build artifacts.
                        Defaults to detecting whether the CCACHE_DIR environment
                        variable is set to a directory.
  --fuzz-with           Pass a sanitizer name, e.g. "--fuzz-with asan" to
                        enable ALL supporting fuzzers.  Use --variant for
                        individual fuzzers, e.g. "--variant asan-fuzzer/foo".
  --goma|--no-goma      Whether to use the goma service during the build. Goma
                        attempts to make builds faster using remote build
                        servers. Defaults to detecting whether goma has been
                        set up via `fx goma bootstrap`.
  --goma-dir            The directory where goma is installed.
                        By default, a Goma client from //prebuilt is used.
  --help-args           Display GN arguments documentation.  If --help-args
                        is followed by a GN build argument identifier, just
                        that argument's documentation is displayed.
                        If --help-args is used alone, all GN build arguments
                        are displayed (lots of output).
                        This option requires an existing build directory.
  --ide                 Pass --ide=VALUE to gn when generating to create project
                        files usable with that IDE. Useful values include "vs"
                        for Visual Studio or "xcode" for Xcode.
  --json-ide-script     Pass --json-ide-script=python_script to gn which runs
                        the given python script after the JSON project file is
                        generated when using --ide json. The path to the project
                        file is given as the first argument to the script.
                        The script may be a path or a gn label.
  --netboot             Ensure that a network ramboot image is always built.
  --no-ensure-goma      Skip ensuring that goma is started when using goma.
  --release             an alias for "--args=is_debug=false"
  --variant             Selects which runtime variant to use (e.g., asan) by
                        passing a `select_variant=[VARIANT*,...]` argument
                        to gn that collects all the --variant arguments in
                        order. Variants are normal builds in most respects,
                        but allow users to test different runtime settings
                        for either the whole build or for a specific target.
                        This can be specified by passing the variant name
                        to this argument (e.g. `--variant asan`) for the
                        former, or the variant name and the target name
                        separated by a slash (e.g. `--variant asan/my_test`)
                        for the latter.
  --with GNLABEL        Labels of additional packages to include in the
                        universe of available packages. These packages can
                        be run ephemerally. Multiple labels can be provided
                        delimited by commas or the --with argument can be
                        provided multiple times.
  --with-base GNLABEL   Labels of additional packages to include in the
                        base set of packages. These packages are included in
                        the system image and can be updated only with an OTA.
                        Multiple labels can be provided delimited by commas
                        or the --with-base argument can be provided multiple
  --cargo-toml-gen      Enable generation of Cargo.toml files


  $ fx set core.x64 --with //bundles:tests
  -> build directory: out/default
     board: //boards/x64.gni
     product: //products/core.gni
     universe: //bundles:tests (all test packages)

set source code