• Home
  • Raw
  • Download

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)
51 * [getenv: Get an environment variable.](#func_getenv)
57 * [read_file: Read a file into a variable.](#func_read_file)
74 * [gn_version: [number] The version of gn.](#var_gn_version)
166 * [dotfile: Info about the toplevel .gn file.](#dotfile)
183 ### <a name="cmd_analyze"></a>**gn analyze &lt;out_dir&gt; &lt;input_path&gt; &lt;output_path&gt;**
259 ### <a name="cmd_args"></a>**gn args**: (command-line tool)
264 gn args <out_dir> [--list] [--short] [--args] [--overrides-only]
266 See also "gn help buildargs" for a more high-level overview of how
273 gn args <out_dir>
285 Note: you can edit the build args manually by editing the file "args.gn"
286 in the build directory and then running "gn gen <out_dir>".
288 gn args <out_dir> --list[=<exact_arg>] [--short] [--overrides-only] [--json]
302 be printed. Overrides come from the <out_dir>/args.gn file and //.gn
328 gn args out/Debug
331 gn args out/Debug --list --short
335 gn args out/Debug --list --short --overrides-only
338 gn args out/Debug --list=target_cpu
343 gn args --list --args="os=\"android\" enable_doom_melon=true"
348 ### <a name="cmd_check"></a>**gn check &lt;out_dir&gt; [&lt;label_pattern&gt;] [\--force] [\--check…
354 "gn check" is the same thing as "gn gen" with the "--check" flag except that
360 matching targets will be checked. See "gn help label_pattern" for details.
391 The .gn file may specify a list of targets to be checked in the list
392 check_targets (see "gn help dotfile"). Alternatively, the .gn file may
398 "gn help check_includes").
409 "gn help nogncheck").
428 ("gn path" is a good way to diagnose problems).
443 other target is annotated accordingly. See "gn help
456 "gn help nogncheck" for an example).
461 "gn help allow_circular_includes_from").
467 those headers. That source set's files will still need to pass "gn check" in
477 gn check out/Debug
480 gn check out/Default //foo:bar
483 gn check out/Default "//foo/*
486 ### <a name="cmd_clean"></a>**gn clean &lt;out_dir&gt;...**
489 Deletes the contents of the output directory except for args.gn and
492 ### <a name="cmd_clean_stale"></a>**gn clean_stale [\--ninja-executable=...] &lt;out_dir&gt;...**
510 ### <a name="cmd_desc"></a>**gn desc**
513 gn desc <out_dir> <label or pattern> [<what to show>] [--blame]
520 pattern (see "gn help label_pattern"). A label pattern will only match
564 and does not correspond to any GN variable, unlike most other values
568 "gn help runtime_deps" for how this is computed. This also works with
602 include configs specified in the "configs" variable of the target, and also
671 gn desc out/Debug //base:base
674 gn desc out/Foo :base_unittests deps --tree
678 gn desc out/Debug //base defines --blame
682 ### <a name="cmd_format"></a>**gn format [\--dump-tree] (\--stdin | &lt;list of build_files...&gt;)…
685 Formats .gn file to a standard format.
719 supported is json.) The given .gn file will be overwritten. This can be
720 used to programmatically transform .gn files.
725 gn format //some/BUILD.gn //some/other/BUILD.gn //and/another/BUILD.gn
726 gn format some\\BUILD.gn
727 gn format /abspath/some/BUILD.gn
728 gn format --stdin
729 gn format --read-tree=json //rewritten/BUILD.gn
731 ### <a name="cmd_gen"></a>**gn gen [\--check] [&lt;ide options&gt;] &lt;out_dir&gt;**
742 "gn gen --check" is the same as running "gn check". "gn gen --check=system" is
743 the same as running "gn check --check-system". See "gn help check" for
746 See "gn help switches" for the common command-line switches.
763 provided by the --ninja-executable switch. Also see "gn help clean_stale".
788 generated projects (see "gn help label_pattern"). Only matching targets
909 ### <a name="cmd_help"></a>**gn help &lt;anything&gt;**
928 gn help --markdown all
931 ### <a name="cmd_ls"></a>**gn ls &lt;out_dir&gt; [&lt;label_pattern&gt;] [\--default-toolchain] [\-…
940 not a general regular expression (see "gn help label_pattern"). If you need
981 gn ls out/Debug
984 gn ls out/Debug "//base/*"
987 gn ls out/Debug "//base:*"
988 Lists all targets defined in //base/BUILD.gn.
990 gn ls out/Debug //base --as=output
993 gn ls out/Debug --type=executable
996 gn ls out/Debug "//base/*" --as=output | xargs ninja -C out/Debug
999 ### <a name="cmd_meta"></a>**gn meta**
1002 gn meta <out_dir> <target>* --data=<key>[,<key>*]* [--walk=<key>[,<key>*]*]
1008 See `gn help generated_file` for more information on the walk.
1020 present, the contents of those variable in the scope are appended to the
1040 gn meta out/Debug "//base/foo" --data=files
1044 gn meta out/Debug "//base/foo" --data=files,other
1048 gn meta out/Debug "//base/foo" --data=files --walk=stop
1052 gn meta out/Debug "//base/foo" --data=files --rebase="/"
1057 ### <a name="cmd_outputs"></a>**gn outputs &lt;out_dir&gt; &lt;list of target or file names...&gt;**
1102 gn outputs out/debug some/directory:some_target
1105 gn outputs out/debug src/project/my_file.cc | xargs ninja -C out/debug
1108 git diff --name-only | xargs gn outputs out/x64 | xargs ninja -C out/x64
1111 ### <a name="cmd_path"></a>**gn path &lt;out_dir&gt; &lt;target_one&gt; &lt;target_two&gt;**
1154 gn path out/Default //base //gn
1156 ### <a name="cmd_refs"></a>**gn refs**
1159 gn refs <out_dir> (<label_pattern>|<label>|<file>|@<response_file>)* [--all]
1172 general regular expressions, see "gn help label_pattern" for details.
1243 gn refs out/Debug //gn:gn
1246 gn refs out/Debug //base:i18n --as=buildfiles | xargs gvim
1247 Edit all .gn files containing references to //base:i18n
1249 gn refs out/Debug //base --all
1252 gn refs out/Debug "//base/*"
1256 gn refs out/Debug "//base:*"
1258 //base/BUILD.gn.
1260 gn refs out/Debug //base --tree
1267 gn refs out/Debug //base/macros.h
1270 gn refs out/Debug //base/macros.h --tree
1274 gn refs out/Debug //base/macros.h //base/at_exit.h --all
1278 gn refs out/Debug //base/macros.h --testonly=true --type=executable
1290 input files, see "gn help action_foreach".
1305 input file changes) by writing a depfile when the script is run (see "gn help
1309 args to your script. See "gn help response_file_contents".
1311 It is recommended you put inputs to your script in the "sources" variable,
1313 variable.
1318 using substitution patterns in the script args (see "gn help args") to
1337 to your script, see "gn help rebase_path" for how to convert
1393 "gn help action".
1399 The script will be run once per file in the "sources" variable. The "outputs"
1400 variable should specify one or more files with a source expansion pattern in
1401 it (see "gn help source_expansion"). The output file(s) for each script
1407 variable. These files are treated as dependencies of each script invocation.
1410 args to your script. See "gn help response_file_contents".
1413 input file changes) by writing a depfile when the script is run (see "gn help
1429 to your script, see "gn help rebase_path" for how to convert
1494 bundle, see "gn help create_bundle" for help.
1504 See "gn help create_bundle" for more information.
1558 (see "gn help source_expansion"). The placeholders will look like
1608 can be configured via the code_signing_script variable.
1617 rebased) and additional inputs may be listed with the variable
1710 "$bundle_root_dir/embedded.mobileprovision",
1764 The `outputs` variable is required to be a list with a single element,
1767 The `output_conversion` variable specified the format to write the
1768 value. See `gn help io_conversion`.
1774 `gn help metadata`.
1783 Given the following targets defined in //base/BUILD.gn, where A depends on B
2252 See also "gn help buildargs" for an overview.
2256 1. The declare_args() block executes. Any variable defined in the enclosing
2257 scope is available for reading, but any variable defined earlier in
2263 via args.gn.
2265 3. User-defined overrides are applied. Anything set in "gn args" now
2278 - Because you cannot read the value of a variable defined in the same
2301 gn --args="enable_doom_melon=true enable_teleporter=true"
2353 rebase_path() function to make file names relative to this path (see "gn help
2358 variable, see "gn help dotfile".
2373 Controls how the file is read and parsed. See `gn help io_conversion`.
2407 "gn help file_pattern"). Any elements in values matching at least one
2425 "gn help file_pattern"). Only elements from values matching at least
2447 The block does not introduce a new scope, so that variable assignments inside
2450 The loop variable will temporarily shadow any existing variables with the
2452 variable will no longer be in scope, and the previous value (if any) will be
2488 When an explicit list of variables is supplied, if the variable exists in the
2495 of variable names that will not be forwarded. This is mostly useful when
2527 # This is a template around a target whose type depends on a global variable.
2536 # variable, and forwards all others to the nested target.
2556 See also "gn help get_target_outputs".
2564 "target_name" variable inside that target's declaration. For the label
2573 the "target_gen_dir" variable when inside that target's declaration.
2577 value of the "root_gen_dir" variable when inside that target's
2582 "target_out_dir" variable when inside that target's declaration.
2586 value of the "root_out_dir" variable when inside that target's
2599 "current_toolchain" variable when inside that target's declaration.
2715 specified in the "outputs" variable of the target.
2718 template to the sources (see "gn help source_expansion"). This will be the
2720 process_file_template will return for those inputs (see "gn help
2742 ### <a name="func_getenv"></a>**getenv**: Get an environment variable.
2747 Returns the value of the given environment variable. If the value is not
2748 found, it will try to look up the variable with the "opposite" case (based on
2749 the case of the first letter of the variable), but is otherwise
2752 If the environment variable is not found, the empty string will be returned.
2774 Note that you can not import a BUILD.gn file that's otherwise used in the
2780 file define some variable or rule with the same name but different value), a
2906 source list is applied. See "gn help source_expansion".
2927 ### <a name="func_read_file"></a>**read_file**: Read a file into a variable.
2943 Controls how the file is read and parsed. See `gn help io_conversion`.
3052 The given label should identify a toolchain definition (see "gn help
3096 When the target type is used, the variable copying is very strict. If a
3097 variable with that name is already in scope, the build will fail with an
3105 wants). If you want to share defaults, store them in a separate variable.
3218 files will import (see "gn help import") so your template rule can be shared
3230 to the template code as an implicit "invoker" variable. The template uses
3269 variable. This should also be the basis for how other targets that a template
3302 # giving the user an error about an undefined variable in the file defining
3321 # variable.
3332 # See "gn help source_expansion" for more.
3440 but will be overridden by the "output_dir" variable in a target, if one
3453 by by the "output extension" variable in a target, if one is specified.
3541 that are embedded in the linker output.
3596 See also "gn help pool".
3624 (see "gn help output_prefix_override").
3644 See "gn help precompiled_header" for more.
3686 added to runtime deps (see "gn help runtime_deps"). By default (if
3734 value of the "output_name" variable if one is specified in the target.
3815 The value of the "output_dir" variable in the target, or the the value
3830 The value of the "output_extension" variable in the target, or the
3838 (if the solink tool specifies a "link_output" variable separate from
3860 Swift .swiftmodule files that needs to be embedded into the binary.
3862 Swift compiler (the .swiftmodule file cannot be embedded in object
3909 compilation (see "module_name" variable).
4015 set_default_toolchain() (see "gn help set_default_toolchain") to tell GN the
4019 When a target has a dependency on a target using different toolchain (see "gn
4049 "gn help tool".
4053 This is a variable of type "scope" where the variable names correspond to
4061 Any default system arguments or arguments passed in via "gn args" will also
4068 See also "gn help buildargs" for an overview of these arguments.
4080 When true, configs (public and all-dependent) will cross the boundary out
4081 of this toolchain as if the toolchain boundary wasn't there. This only
4166 files for this purpose. See "gn help response_file_contents".
4179 Controls how the output is written. See `gn help io_conversion`.
4187 "host_cpu" (see "gn help host_cpu") and then threads this through the
4195 See "gn help target_cpu" for a list of common values returned.
4201 "target_os" (see "gn help target_os"), and then threads this through the
4209 See "gn help target_os" for a list of common values returned.
4232 ### <a name="var_gn_version"></a>**gn_version**: [number] The version of gn.
4235 Corresponds to the number printed by `gn --version`.
4281 Inside a template invocation, this variable refers to the scope of the
4282 invoker of the template. Outside of template invocations, this variable is
4292 See "gn help template" for more examples.
4322 Most often this is used with rebase_path (see "gn help rebase_path") to
4334 rebase_path() (see "gn help rebase_path") to convert it to be relative to the
4351 to a script, you will want to pass it through rebase_path() (see "gn help
4383 command line or in the args.gn file.
4412 rebase_path() (see "gn help rebase_path") to convert it to be relative to the
4415 See also "gn help root_gen_dir".
4429 Inside a target or template invocation, this variable refers to the name
4430 given to the target or template invocation. Outside of these, this variable
4441 invocation in this case, you should save target_name to a temporary variable
4444 See "gn help template" for more examples.
4473 cross-compiles, it may be different. This variable differs from "current_os"
4492 line or in the args.gn file.
4515 (see "gn help rebase_path") to convert it to be relative to the build
4518 See also "gn help root_out_dir".
4567 those, will have the configs listed in this variable added to them. These
4572 force-added configs in their "configs" variable while the script is running,
4615 B as a dependency. This invariant is enforced by the "gn check" command (and
4616 the --check flag to "gn gen" -- see "gn help check").
4703 ### <a name="var_args"></a>**args**: (target variable) Arguments passed to an action.
4707 to the script. Typically you would use source expansion (see "gn help
4711 variables in the same way that compiler tools (see "gn help tool") do. These
4718 See also "gn help action" and "gn help action_foreach".
4764 See "gn help label_pattern" for the format of the entries in the list. These
4804 See "gn help bundle_root_dir" for examples.
4819 See "gn help create_bundle" for more information.
4849 See "gn help bundle_root_dir" for examples.
4863 See "gn help bundle_root_dir" for examples.
5064 When true (the default), the "gn check" command (as well as "gn gen" with the
5073 can exclude headers individually by annotating them with "nogncheck" (see "gn
5076 The topic "gn help check" has general information on how checking works and
5093 to the code signing script. Typically you would use source expansion (see "gn
5096 See also "gn help create_bundle".
5104 See also "gn help create_bundle".
5112 See also "gn help create_bundle".
5121 See also "gn help create_bundle".
5255 See "gn help generated_file".
5310 category of "gn desc" or written during build generation via
5323 gathering data. See "gn help create_bundle" for details.
5325 See "gn help runtime_deps" for how these are used.
5340 gathering data_deps. See "gn help create_bundle" for details.
5342 See also "gn help deps" and "gn help data".
5360 See "gn help generated_file".
5407 file expansions described in "gn help action_foreach" to name the .d file
5461 Data dependencies are propagated differently. See "gn help data_deps" and
5462 "gn help runtime_deps".
5557 A list of label patterns (see "gn help label_pattern") that allow dependent
5560 Normally if a target lists headers in the "public" list (see "gn help
5563 The "gn check" function performs this validation.
5621 (see "gn help execution"). If this target is generated, then any targets in
5683 the action write a depfile (see "gn help depfile"). This allows the script to
5835 "lib_dirs" so the given library is found. Your BUILD.gn file should not
5907 See `gn help io_conversion`.
5923 executables (see "gn help tool"). You will have to consult that for the
5949 "gn help tool".
5988 This variable is valid for all binary output target types.
6007 (see "gn help tool"). Sometimes this prefix is undesired.
6009 See also "gn help output_extension".
6033 map a single input name to a single output name. See "gn help copy".
6039 the name of the input file). See "gn help action_foreach".
6043 with no source expansions. See "gn help action".
6053 been invoked or not. See "gn help create_bundle".
6076 "gn help tool"). The tool will also specify what type of precompiled headers
6141 See "gn help precompiled_header".
6148 of the target. See "gn help precompiled_header".
6163 via the "check" command (see "gn help check").
6167 variable is defined on a target, dependent targets may only include files on
6168 this whitelist unless that target is marked as a friend (see "gn help
6173 headers indicate which subset of those files are permitted. See "gn help
6188 "gn help friend" for more.
6218 variable added to them. These configs will also apply to the current target.
6222 See also "gn help all_dependent_configs".
6230 higher in the dependency tree by depending on it via public_deps (see "gn
6254 force-added configs in their "configs" variable while the script is running,
6260 depending on the value of the propagates_configs flag (see "gn help
6306 Public dependencies are like private dependencies (see "gn help deps") but
6322 See also "gn help public_configs".
6368 See also "gn help generated_file".
6379 If the response_file_contents variable is defined and non-empty, the list
6412 action and action_foreach targets (see "gn help action" and "gn help
6451 The sources will be treated the same as inputs. See "gn help inputs" for
6509 "gn help check").
6525 See "gn help label_pattern" for more details on what types of patterns are
6546 Any target in "//bar/BUILD.gn":
6571 See "gn help generated_file".
6621 See "gn help runtime_deps" for how the runtime dependencies are computed.
6626 same as requesting the runtime deps be written on the command line (see "gn
6645 See "gn help create_bundle" for more information.
6654 See "gn help create_bundle" for more information.
6687 the default_args variable of //.gn. See "gn help dotfile" for more.
6691 be used (this is in the file args.gn in the build directory).
6697 specify Posix, for example. See "gn help toolchain" for more.
6706 gn args out/FooBar
6712 gn gen out/FooBar --args="enable_doom_melon=true os=\"android\""
6731 ### <a name="dotfile"></a>**.gn file**
6734 When gn starts, it will search the current directory and parent directories
6735 for a file called ".gn". This indicates the source root. You can override
6738 The .gn file in the source root will be executed. The syntax is the same as a
6741 If you specify --root, by default GN will look for the file .gn in that
6745 gn gen out/Debug --root=/home/build --dotfile=/home/my_gn_file.gn
6753 args.gn content when you run `gn args`.
6761 "gn check" or "gn gen --check". If neither check_targets or
6767 The format of this list is identical to that of "visibility" so see "gn
6772 running "gn check" or "gn gen --check". All other targets will be checked.
6777 The format of this list is identical to that of "visibility" so see "gn
6782 when running "gn check" or "gn gen --check". System style includes are
6786 "gn check --check-system" or "gn gen --check=system"
6789 A list of .gn/.gni files (not labels) that have permission to call the
6803 "//base/BUILD.gn",
6810 cause the file //BUILD.gn to be loaded. Note that build_file_extension
6813 The command-line switch --root-target will override this value (see "gn
6826 for a BUILD.gn file (or the build config file discussed above), the file
6831 This behavior is intended to be used when BUILD.gn files can't be checked
6840 args.gn file.
6848 GN will look for build files named "BUILD.$build_file_extension.gn".
6858 #### **Example .gn file contents**
6861 buildconfig = "//build/config/BUILDCONFIG.gn"
6883 1. Look for ".gn" file (see "gn help dotfile") in the current directory and
6888 2. Execute the build config file identified by .gn to set up the global
6892 3. Load the //BUILD.gn (in the source root directory).
6894 4. Recursively evaluate rules and load BUILD.gn in other directories as
6897 the secondary_source defined in the dotfile (see "gn help dotfile").
6904 Note that the BUILD.gn file name may be modulated by .gn arguments such as
6913 label (see "gn help label"). The exception is the get_target_outputs()
6924 (see "gn help target"). You can define new types using templates (see "gn
6929 applied (see "gn help set_defaults"). It will inject implicit variable
6938 All targets encountered in the default toolchain (see "gn help toolchain")
6941 "all" rule (see "gn help ninja_rules").
6954 See also "gn help ninja_rules".
6961 configs around the build tree and allowing includes for the purposes of "gn
7025 characters with possible escape sequences and variable expansions.
7045 An expansion will evaluate the variable following the '$' and insert a
7049 Use the "${var_one}" format to be explicitly deliniate the variable for
7119 - Scopes: Scopes are like dictionaries that use variable names for keys. See
7163 recursively search all parent scopes until the variable is found or there are
7167 = foo" can do useful work by copying a variable into the current scope that
7230 and you read the result into a variable named "val", then you could
7269 will produce an error if assigned to a variable.
7317 - "\b" Matches a path boundary. This will match the beginning or end of a
7349 "//foo/bar:*" (all targets in the //foo/bar/BUILD.gn file)
7381 to look for the thing named "test_support" in "base/test/BUILD.gn".
7430 //tools/gn -> //tools/gn:gn
7449 "gn help generated_file" for more detail.
7463 Targets can declare a 'metadata' variable containing a scope, and this
7580 All generated targets (see "gn help execution") will be added to an implicit
7597 2. Targets in the toplevel //BUILD.gn file.
7657 The topic "gn help check" has general information on how checking works and
7659 "gn help check_includes".
7665 of "gn desc" (see "gn help desc") or they can be written at build generation
7666 time via write_runtime_deps(), or --runtime-deps-list-file (see "gn help
7754 See "gn help copy" and "gn help action_foreach" for more on how this is
7762 placeholders used in the definition of tools. See "gn help tool" for those.
7766 be used for specifying inputs to a script in the "args" variable.
7794 source file is in a different directory than the BUILD.gn file.
7801 build.gn file.
7821 Details: source expansions can be used in the "outputs" variable, the "args"
7822 variable, and in calls to "process_file_template". The "args" are passed to a
7855 Do "gn help --the_switch_you_want_help_on" for more. Individual commands may
7862 * --dotfile: Override the name of the ".gn" file.