Lines Matching +refs:gn +refs:embedded +refs:variable +refs:boundary
3 *This page is automatically generated from* `gn help --markdown all`.
14 * [format: Format .gn files.](#cmd_format)
53 * [getenv: Get an environment variable.](#func_getenv)
61 * [read_file: Read a file into a variable.](#func_read_file)
78 * [gn_version: [number] The version of gn.](#var_gn_version)
177 * [dotfile: Info about the toplevel .gn file.](#dotfile)
194 ### <a name="cmd_analyze"></a>**gn analyze <out_dir> <input_path> <output_path>**
270 ### <a name="cmd_args"></a>**gn args**: (command-line tool)
275 gn args <out_dir> [--list] [--short] [--args] [--overrides-only]
277 See also "gn help buildargs" for a more high-level overview of how
284 gn args <out_dir>
296 Note: you can edit the build args manually by editing the file "args.gn"
297 in the build directory and then running "gn gen <out_dir>".
299 gn args <out_dir> --list[=<exact_arg>] [--short] [--overrides-only] [--json]
313 be printed. Overrides come from the <out_dir>/args.gn file and //.gn
339 gn args out/Debug
342 gn args out/Debug --list --short
346 gn args out/Debug --list --short --overrides-only
349 gn args out/Debug --list=target_cpu
354 gn args --list --args="os=\"android\" enable_doom_melon=true"
359 ### <a name="cmd_check"></a>**gn check <out_dir> [<label_pattern>] [\--force] [\--check…
365 "gn check" is the same thing as "gn gen" with the "--check" flag except that
371 matching targets will be checked. See "gn help label_pattern" for details.
402 The .gn file may specify a list of targets to be checked in the list
403 check_targets (see "gn help dotfile"). Alternatively, the .gn file may
409 "gn help check_includes").
420 "gn help nogncheck").
439 ("gn path" is a good way to diagnose problems).
454 other target is annotated accordingly. See "gn help
467 "gn help nogncheck" for an example).
472 "gn help allow_circular_includes_from").
478 those headers. That source set's files will still need to pass "gn check" in
488 gn check out/Debug
491 gn check out/Default //foo:bar
494 gn check out/Default "//foo/*
497 ### <a name="cmd_clean"></a>**gn clean <out_dir>...**
500 Deletes the contents of the output directory except for args.gn and
503 ### <a name="cmd_clean_stale"></a>**gn clean_stale [\--ninja-executable=...] <out_dir>...**
521 ### <a name="cmd_desc"></a>**gn desc**
524 gn desc <out_dir> <label or pattern> [<what to show>] [--blame]
531 pattern (see "gn help label_pattern"). A label pattern will only match
575 and does not correspond to any GN variable, unlike most other values
579 "gn help runtime_deps" for how this is computed. This also works with
613 include configs specified in the "configs" variable of the target, and also
682 gn desc out/Debug //base:base
685 gn desc out/Foo :base_unittests deps --tree
689 gn desc out/Debug //base defines --blame
693 ### <a name="cmd_format"></a>**gn format [\--dump-tree] (\--stdin | <list of build_files...>)…
696 Formats .gn file to a standard format.
730 supported is json.) The given .gn file will be overwritten. This can be
731 used to programmatically transform .gn files.
736 gn format //some/BUILD.gn //some/other/BUILD.gn //and/another/BUILD.gn
737 gn format some\\BUILD.gn
738 gn format /abspath/some/BUILD.gn
739 gn format --stdin
740 gn format --read-tree=json //rewritten/BUILD.gn
742 ### <a name="cmd_gen"></a>**gn gen [\--check] [<ide options>] <out_dir>**
753 "gn gen --check" is the same as running "gn check". "gn gen --check=system" is
754 the same as running "gn check --check-system". See "gn help check" for
757 See "gn help switches" for the common command-line switches.
774 provided by the --ninja-executable switch. Also see "gn help clean_stale".
799 generated projects (see "gn help label_pattern"). Only matching targets
850 the directory where ninja needs to be invoked. This variable can be
853 gn build directory with the correct args.gn for each).
961 Adds an additional label pattern (see "gn help label_pattern") of a
963 list values specified in the export_compile_commands variable in the
964 .gn file (see "gn help dotfile"). This allows the user to add additional
975 DEPRECATED https://bugs.chromium.org/p/gn/issues/detail?id=302.
977 the "export_compile_commands" value in the project-level .gn file (see
978 "gn help dotfile") for per-project configuration.
980 Overrides the value of the export_compile_commands in the .gn file (see
981 "gn help dotfile") as well as the --add-export-compile-commands switch.
983 Unlike the .gn setting, this switch takes a legacy format which is a list
992 ### <a name="cmd_help"></a>**gn help <anything>**
1011 gn help --markdown all
1014 ### <a name="cmd_ls"></a>**gn ls <out_dir> [<label_pattern>] [\--default-toolchain] [\-…
1023 not a general regular expression (see "gn help label_pattern"). If you need
1064 gn ls out/Debug
1067 gn ls out/Debug "//base/*"
1070 gn ls out/Debug "//base:*"
1071 Lists all targets defined in //base/BUILD.gn.
1073 gn ls out/Debug //base --as=output
1076 gn ls out/Debug --type=executable
1079 gn ls out/Debug "//base/*" --as=output | xargs ninja -C out/Debug
1082 ### <a name="cmd_meta"></a>**gn meta**
1085 gn meta <out_dir> <target>* --data=<key>[,<key>*]* [--walk=<key>[,<key>*]*]
1091 See `gn help generated_file` for more information on the walk.
1103 present, the contents of those variable in the scope are appended to the
1123 gn meta out/Debug "//base/foo" --data=files
1127 gn meta out/Debug "//base/foo" --data=files,other
1131 gn meta out/Debug "//base/foo" --data=files --walk=stop
1135 gn meta out/Debug "//base/foo" --data=files --rebase="/"
1140 ### <a name="cmd_outputs"></a>**gn outputs <out_dir> <list of target or file names...>**
1185 gn outputs out/debug some/directory:some_target
1188 gn outputs out/debug src/project/my_file.cc | xargs ninja -C out/debug
1191 git diff --name-only | xargs gn outputs out/x64 | xargs ninja -C out/x64
1194 ### <a name="cmd_path"></a>**gn path <out_dir> <target_one> <target_two>**
1237 gn path out/Default //base //gn
1239 ### <a name="cmd_refs"></a>**gn refs**
1242 gn refs <out_dir> (<label_pattern>|<label>|<file>|@<response_file>)* [--all]
1255 general regular expressions, see "gn help label_pattern" for details.
1326 gn refs out/Debug //gn:gn
1329 gn refs out/Debug //base:i18n --as=buildfile | xargs gvim
1330 Edit all .gn files containing references to //base:i18n
1332 gn refs out/Debug //base --all
1335 gn refs out/Debug "//base/*"
1339 gn refs out/Debug "//base:*"
1341 //base/BUILD.gn.
1343 gn refs out/Debug //base --tree
1350 gn refs out/Debug //base/macros.h
1353 gn refs out/Debug //base/macros.h --tree
1357 gn refs out/Debug //base/macros.h //base/at_exit.h --all
1361 gn refs out/Debug //base/macros.h --testonly=true --type=executable
1373 input files, see "gn help action_foreach".
1388 input file changes) by writing a depfile when the script is run (see "gn help
1392 args to your script. See "gn help response_file_contents".
1394 It is recommended you put inputs to your script in the "sources" variable,
1396 variable.
1401 using substitution patterns in the script args (see "gn help args") to
1420 to your script, see "gn help rebase_path" for how to convert
1485 "gn help action".
1491 The script will be run once per file in the "sources" variable. The "outputs"
1492 variable should specify one or more files with a source expansion pattern in
1493 it (see "gn help source_expansion"). The output file(s) for each script
1499 variable. These files are treated as dependencies of each script invocation.
1502 args to your script. See "gn help response_file_contents".
1505 input file changes) by writing a depfile when the script is run (see "gn help
1521 to your script, see "gn help rebase_path" for how to convert
1600 bundle, see "gn help create_bundle" for help.
1615 See "gn help create_bundle" for more information.
1675 (see "gn help source_expansion"). The placeholders will look like
1760 step can be configured via the post_processing_script variable.
1877 "$bundle_root_dir/embedded.mobileprovision",
1932 The `outputs` variable is required to be a list with a single element,
1935 The `output_conversion` variable specified the format to write the
1936 value. See `gn help io_conversion`.
1942 `gn help metadata`.
1963 Given the following targets defined in //base/BUILD.gn, where A depends on B
2333 Targets will also have variables specific to that type, see "gn help <type>"
2444 See also "gn help buildargs" for an overview.
2448 1. The declare_args() block executes. Any variable defined in the enclosing
2449 scope is available for reading, but any variable defined earlier in
2455 via args.gn.
2457 3. User-defined overrides are applied. Anything set in "gn args" now
2470 - Because you cannot read the value of a variable defined in the same
2493 gn --args="enable_doom_melon=true enable_teleporter=true"
2552 rebase_path() function to make file names relative to this path (see "gn help
2557 variable, see "gn help dotfile".
2572 Controls how the file is read and parsed. See `gn help io_conversion`.
2606 "gn help file_pattern"). Any elements in values matching at least one
2624 "gn help file_pattern"). Only elements from values matching at least
2642 "gn help label_pattern"). Only elements from labels matching at least
2660 "gn help label_pattern"). Only elements from labels matching at least
2682 The block does not introduce a new scope, so that variable assignments inside
2685 The loop variable will temporarily shadow any existing variables with the
2687 variable will no longer be in scope, and the previous value (if any) will be
2723 When an explicit list of variables is supplied, if the variable exists in the
2730 of variable names that will not be forwarded. This is mostly useful when
2762 # This is a template around a target whose type depends on a global variable.
2771 # variable, and forwards all others to the nested target.
2791 See also "gn help get_target_outputs".
2799 "target_name" variable inside that target's declaration. For the label
2808 the "target_gen_dir" variable when inside that target's declaration.
2812 value of the "root_gen_dir" variable when inside that target's
2817 "target_out_dir" variable when inside that target's declaration.
2821 value of the "root_out_dir" variable when inside that target's
2834 "current_toolchain" variable when inside that target's declaration.
2950 specified in the "outputs" variable of the target.
2953 template to the sources (see "gn help source_expansion"). This will be the
2955 process_file_template will return for those inputs (see "gn help
2977 ### <a name="func_getenv"></a>**getenv**: Get an environment variable.
2982 Returns the value of the given environment variable. If the value is not
2983 found, it will try to look up the variable with the "opposite" case (based on
2984 the case of the first letter of the variable), but is otherwise
2987 If the environment variable is not found, the empty string will be returned.
3009 Note that you can not import a BUILD.gn file that's otherwise used in the
3015 file define some variable or rule with the same name but different value), a
3038 "gn help label_pattern"). If the target_label matches any of the patterns,
3156 print_stack_trace() initiated at //build.gn:2
3157 bar("lala") //BUILD.gn:9
3158 foo("lala.foo") //BUILD.gn:5
3159 print_stack_trace() //BUILD.gn:2
3185 source list is applied. See "gn help source_expansion".
3206 ### <a name="func_read_file"></a>**read_file**: Read a file into a variable.
3222 Controls how the file is read and parsed. See `gn help io_conversion`.
3331 The given label should identify a toolchain definition (see "gn help
3375 When the target type is used, the variable copying is very strict. If a
3376 variable with that name is already in scope, the build will fail with an
3384 wants). If you want to share defaults, store them in a separate variable.
3497 files will import (see "gn help import") so your template rule can be shared
3509 to the template code as an implicit "invoker" variable. The template uses
3548 variable. This should also be the basis for how other targets that a template
3581 # giving the user an error about an undefined variable in the file defining
3600 # variable.
3611 # See "gn help source_expansion" for more.
3719 but will be overridden by the "output_dir" variable in a target, if one
3732 by by the "output extension" variable in a target, if one is specified.
3820 that are embedded in the linker output.
3875 See also "gn help pool".
3903 (see "gn help output_prefix_override").
3923 See "gn help precompiled_header" for more.
3965 added to runtime deps (see "gn help runtime_deps"). By default (if
3982 This switch is inserted by gn into rustc command lines before
3986 inserted into the {{rustdeps}} variable at the appropriate place;
4027 value of the "output_name" variable if one is specified in the target.
4108 The value of the "output_dir" variable in the target, or the the value
4123 The value of the "output_extension" variable in the target, or the
4131 (if the solink tool specifies a "link_output" variable separate from
4153 Swift .swiftmodule files that needs to be embedded into the binary.
4155 Swift compiler (the .swiftmodule file cannot be embedded in object
4206 compilation (see "module_name" variable).
4312 set_default_toolchain() (see "gn help set_default_toolchain") to tell GN the
4316 When a target has a dependency on a target using different toolchain (see "gn
4346 "gn help tool".
4350 This is a variable of type "scope" where the variable names correspond to
4358 Any default system arguments or arguments passed in via "gn args" will also
4365 See also "gn help buildargs" for an overview of these arguments.
4377 When true, configs (public and all-dependent) will cross the boundary out
4378 of this toolchain as if the toolchain boundary wasn't there. This only
4463 files for this purpose. See "gn help response_file_contents".
4476 Controls how the output is written. See `gn help io_conversion`.
4484 "host_cpu" (see "gn help host_cpu") and then threads this through the
4492 See "gn help target_cpu" for a list of common values returned.
4498 "target_os" (see "gn help target_os"), and then threads this through the
4506 See "gn help target_os" for a list of common values returned.
4529 ### <a name="var_gn_version"></a>**gn_version**: [number] The version of gn.
4532 Corresponds to the number printed by `gn --version`.
4578 Inside a template invocation, this variable refers to the scope of the
4579 invoker of the template. Outside of template invocations, this variable is
4589 See "gn help template" for more examples.
4619 Most often this is used with rebase_path (see "gn help rebase_path") to
4631 rebase_path() (see "gn help rebase_path") to convert it to be relative to the
4648 to a script, you will want to pass it through rebase_path() (see "gn help
4680 command line or in the args.gn file.
4709 rebase_path() (see "gn help rebase_path") to convert it to be relative to the
4712 See also "gn help root_gen_dir".
4726 Inside a target or template invocation, this variable refers to the name
4727 given to the target or template invocation. Outside of these, this variable
4738 invocation in this case, you should save target_name to a temporary variable
4741 See "gn help template" for more examples.
4770 cross-compiles, it may be different. This variable differs from "current_os"
4789 line or in the args.gn file.
4812 (see "gn help rebase_path") to convert it to be relative to the build
4815 See also "gn help root_out_dir".
4864 those, will have the configs listed in this variable added to them. These
4869 force-added configs in their "configs" variable while the script is running,
4912 B as a dependency. This invariant is enforced by the "gn check" command (and
4913 the --check flag to "gn gen" -- see "gn help check").
5000 ### <a name="var_args"></a>**args**: (target variable) Arguments passed to an action.
5004 to the script. Typically you would use source expansion (see "gn help
5008 variables in the same way that compiler tools (see "gn help tool") do. These
5015 See also "gn help action" and "gn help action_foreach".
5061 See "gn help label_pattern" for the format of the entries in the list. These
5101 See "gn help bundle_root_dir" for examples.
5116 See "gn help create_bundle" for more information.
5146 See "gn help bundle_root_dir" for examples.
5160 See "gn help bundle_root_dir" for examples.
5361 When true (the default), the "gn check" command (as well as "gn gen" with the
5370 can exclude headers individually by annotating them with "nogncheck" (see "gn
5373 The topic "gn help check" has general information on how checking works and
5391 (see "gn help source_expansion") to insert the source file names.
5397 See also "gn help create_bundle" and "gn help post_processing_args".
5409 See also "gn help create_bundle" and "gn help post_processing_args".
5421 See also "gn help create_bundle" and "gn help post_processing_args".
5434 See also "gn help create_bundle" and "gn help post_processing_args".
5568 See "gn help generated_file".
5623 category of "gn desc" or written during build generation via
5636 gathering data. See "gn help create_bundle" for details.
5638 See "gn help runtime_deps" for how these are used.
5653 gathering data_deps. See "gn help create_bundle" for details.
5655 See also "gn help deps" and "gn help data".
5673 See "gn help generated_file".
5720 file expansions described in "gn help action_foreach" to name the .d file
5778 Data dependencies are propagated differently. See "gn help data_deps" and
5779 "gn help runtime_deps".
5874 A list of label patterns (see "gn help label_pattern") that allow dependent
5877 Normally if a target lists headers in the "public" list (see "gn help
5880 The "gn check" function performs this validation.
5938 (see "gn help execution"). If this target is generated, then any targets in
6000 the action write a depfile (see "gn help depfile"). This allows the script to
6152 "lib_dirs" so the given library is found. Your BUILD.gn file should not
6235 See `gn help io_conversion`.
6251 executables (see "gn help tool"). You will have to consult that for the
6277 "gn help tool".
6316 This variable is valid for all binary output target types.
6335 (see "gn help tool"). Sometimes this prefix is undesired.
6337 See also "gn help output_extension".
6361 map a single input name to a single output name. See "gn help copy".
6367 the name of the input file). See "gn help action_foreach".
6371 with no source expansions. See "gn help action".
6381 been invoked or not. See "gn help create_bundle".
6408 (see "gn help source_expansion") to insert the source file names.
6410 See also "gn help create_bundle".
6418 See also "gn help create_bundle".
6426 See also "gn help create_bundle".
6435 See also "gn help create_bundle".
6443 "gn help tool"). The tool will also specify what type of precompiled headers
6508 See "gn help precompiled_header".
6515 of the target. See "gn help precompiled_header".
6533 via the "check" command (see "gn help check").
6537 variable is defined on a target, dependent targets may only include files on
6538 this whitelist unless that target is marked as a friend (see "gn help
6543 headers indicate which subset of those files are permitted. See "gn help
6558 "gn help friend" for more.
6588 variable added to them. These configs will also apply to the current target.
6592 See also "gn help all_dependent_configs".
6600 higher in the dependency tree by depending on it via public_deps (see "gn
6624 force-added configs in their "configs" variable while the script is running,
6630 depending on the value of the propagates_configs flag (see "gn help
6676 Public dependencies are like private dependencies (see "gn help deps") but
6692 See also "gn help public_configs".
6738 See also "gn help generated_file".
6749 If the response_file_contents variable is defined and non-empty, the list
6789 action and action_foreach targets (see "gn help action" and "gn help
6828 The sources will be treated the same as inputs. See "gn help inputs" for
6896 "gn help check").
6912 See "gn help label_pattern" for more details on what types of patterns are
6933 Any target in "//bar/BUILD.gn":
6958 See "gn help generated_file".
7008 See "gn help runtime_deps" for how the runtime dependencies are computed.
7013 same as requesting the runtime deps be written on the command line (see "gn
7032 See "gn help create_bundle" for more information.
7041 See "gn help create_bundle" for more information.
7074 the default_args variable of //.gn. See "gn help dotfile" for more.
7078 be used (this is in the file args.gn in the build directory).
7084 specify Posix, for example. See "gn help toolchain" for more.
7093 gn args out/FooBar
7099 gn gen out/FooBar --args="enable_doom_melon=true os=\"android\""
7118 ### <a name="dotfile"></a>**.gn file**
7121 When gn starts, it will search the current directory and parent directories
7122 for a file called ".gn". This indicates the source root. You can override
7125 The .gn file in the source root will be executed. The syntax is the same as a
7128 If you specify --root, by default GN will look for the file .gn in that
7132 gn gen out/Debug --root=/home/build --dotfile=/home/my_gn_file.gn
7140 args.gn content when you run `gn args`.
7148 "gn check" or "gn gen --check". If neither check_targets or
7154 The format of this list is identical to that of "visibility" so see "gn
7159 running "gn check" or "gn gen --check". All other targets will be checked.
7164 The format of this list is identical to that of "visibility" so see "gn
7169 when running "gn check" or "gn gen --check". System style includes are
7173 "gn check --check-system" or "gn gen --check=system"
7176 A list of .gn/.gni files (not labels) that have permission to call the
7190 "//base/BUILD.gn",
7196 database (see "gn help label_pattern" for the string format).
7204 The switch --add-export-compile-commands to "gn gen" (see "gn help gen")
7207 The deprecated switch --export-compile-commands to "gn gen" (see "gn help
7219 cause the file //BUILD.gn to be loaded. Note that build_file_extension
7222 The command-line switch --root-target will override this value (see "gn
7227 graph will contain all targets from any BUILD.gn evaluated in the default
7235 "gn help --root-pattern")
7245 "gn help --script-executable")
7249 for a BUILD.gn file (or the build config file discussed above), the file
7254 This behavior is intended to be used when BUILD.gn files can't be checked
7263 args.gn file.
7271 GN will look for build files named "BUILD.$build_file_extension.gn".
7281 #### **Example .gn file contents**
7284 buildconfig = "//build/config/BUILDCONFIG.gn"
7306 1. Look for ".gn" file (see "gn help dotfile") in the current directory and
7311 2. Execute the build config file identified by .gn to set up the global
7315 3. Load the //BUILD.gn (in the source root directory).
7317 4. Recursively evaluate rules and load BUILD.gn in other directories as
7320 the secondary_source defined in the dotfile (see "gn help dotfile").
7327 Note that the BUILD.gn file name may be modulated by .gn arguments such as
7336 label (see "gn help label"). The exception is the get_target_outputs()
7347 (see "gn help target"). You can define new types using templates (see "gn
7352 applied (see "gn help set_defaults"). It will inject implicit variable
7361 All targets encountered in the default toolchain (see "gn help toolchain")
7364 "all" rule (see "gn help ninja_rules").
7377 See also "gn help ninja_rules".
7384 configs around the build tree and allowing includes for the purposes of "gn
7448 characters with possible escape sequences and variable expansions.
7468 An expansion will evaluate the variable following the '$' and insert a
7472 Use the "${var_one}" format to be explicitly deliniate the variable for
7542 - Scopes: Scopes are like dictionaries that use variable names for keys. See
7586 recursively search all parent scopes until the variable is found or there are
7590 = foo" can do useful work by copying a variable into the current scope that
7653 and you read the result into a variable named "val", then you could
7692 will produce an error if assigned to a variable.
7740 - "\b" Matches a path boundary. This will match the beginning or end of a
7772 "//foo/bar:*" (all targets in the //foo/bar/BUILD.gn file)
7804 to look for the thing named "test_support" in "base/test/BUILD.gn".
7853 //tools/gn -> //tools/gn:gn
7872 "gn help generated_file" for more detail.
7886 Targets can declare a 'metadata' variable containing a scope, and this
8003 All generated targets (see "gn help execution") will be added to an implicit
8020 2. Targets in the toplevel //BUILD.gn file.
8084 The topic "gn help check" has general information on how checking works and
8086 "gn help check_includes".
8092 of "gn desc" (see "gn help desc") or they can be written at build generation
8093 time via write_runtime_deps(), or --runtime-deps-list-file (see "gn help
8181 See "gn help copy" and "gn help action_foreach" for more on how this is
8189 placeholders used in the definition of tools. See "gn help tool" for those.
8193 be used for specifying inputs to a script in the "args" variable.
8221 source file is in a different directory than the BUILD.gn file.
8228 build.gn file.
8248 Details: source expansions can be used in the "outputs" variable, the "args"
8249 variable, and in calls to "process_file_template". The "args" are passed to a
8282 Do "gn help --the_switch_you_want_help_on" for more. Individual commands may
8289 * --dotfile: Override the name of the ".gn" file.