gn

vb gn SUBCOMMAND [OPTIONS]

Description

Run various subcommands to manage and configure build targets, dependencies, and outputs in the GN build system.

Subcommands

vb gn analyze

vb gn analyze [OPTIONS] FILE-LIST

Description

Analyze which targets are affected by a list of files.

vb gn args

vb gn args [OPTIONS]

Description

Display or configure arguments declared by the build.

vb gn check

vb gn check [OPTIONS]

Description

Check header dependencies.

Options

-check-generated

Check generated files if they exist.

-check-system

Check system-style includes.

-default-toolchain

Restrict wildcard targets to the default toolchain.

-force

Ignore check_includes=false and check all matching files.

vb gn clean

vb gn clean

Description

Clean the output directory.

vb gn clean_stale

vb gn clean_stale

Description

Clean the stale output files from the output directory.

vb gn desc

vb gn desc TARGET

Description

Show detailed information about a target or configuration.

vb gn format

vb gn format [OPTIONS]

Description

Format .gn files.

Options

--dry-run

Print files that would be reformatted without writing.

--dump-tree[=(text, json)]

Dump the parse tree to stdout.

--stdin

Read input from stdin instead of updating files in-place.

--read-tree=json

Read an AST from stdin in JSON format.

vb gn gen

vb gn gen [OPTIONS] <out_dir>

Description

Generate Ninja build files.

Options

--check

Perform a check to ensure the generated files are correct.

vb gn ls

vb gn ls [OPTIONS] [GLOB]

Description

List matching targets.

Options

--as=(buildfile, label, output)

Specify the output format (buildfile, label, output).

--default-toolchain

Restrict targets to the default toolchain.

--testonly=(true, false)

Filter by testonly flag.

--type=(action, copy, executable, group, loadable_module, shared_library, source_set, static_library)

Restrict by target type.

vb gn meta

vb gn meta <out_dir> <target>* --data=<key>[,<key>*]* [--walk=<key>[,<key>*]*] [--rebase=<dest dir>]

Description

List target metadata collection results.

Options

--data

A comma-separated list of keys to extract from metadata.

--walk

A list of keys to control metadata walking.

--rebase

Rebase metadata paths to a new directory.

vb gn outputs

vb gn outputs DIR

Description

Show which files a target generates.

vb gn path

vb gn path [OPTIONS] TARGET1 TARGET2

Description

Find paths between two targets.

Options

--all

Print all interesting paths, not just the first one.

--public

Only consider public paths.

--with-data

Include data dependencies.

vb gn refs

vb gn refs [OPTIONS] TARGET

Description

Find targets or files referencing a specific target.

Options

--all

Recurse and display all unique dependencies.

--as=(buildfile, label, output)

Specify how to print targets.

--tree

Display a reverse dependency tree.

See Also

See also

build

Examples

  • Format a GN file (dry run)

$ vb gn format --dry-run BUILD.gn
BUILD.gn
  • Generate Ninja files for an output directory

vb gn gen out
vb build -C out