OLD | NEW |
1 # GN Reference | 1 # GN Reference |
2 | 2 |
3 *This page is automatically generated from* `gn help --markdown all`. | 3 *This page is automatically generated from* `gn help --markdown all`. |
4 | 4 |
5 ## Contents | 5 ## Contents |
6 | 6 |
7 * [Commands](#commands) | 7 * [Commands](#commands) |
8 * [analyze: Analyze which targets are affected by a list of files.](#analy
ze) | 8 * [analyze: Analyze which targets are affected by a list of files.](#analy
ze) |
9 * [args: Display or configure arguments declared by the build.](#args) | 9 * [args: Display or configure arguments declared by the build.](#args) |
10 * [check: Check header dependencies.](#check) | 10 * [check: Check header dependencies.](#check) |
(...skipping 24 matching lines...) Expand all Loading... |
35 * [declare_args: Declare build arguments.](#declare_args) | 35 * [declare_args: Declare build arguments.](#declare_args) |
36 * [defined: Returns whether an identifier is defined.](#defined) | 36 * [defined: Returns whether an identifier is defined.](#defined) |
37 * [exec_script: Synchronously run a script and return the output.](#exec_s
cript) | 37 * [exec_script: Synchronously run a script and return the output.](#exec_s
cript) |
38 * [foreach: Iterate over a list.](#foreach) | 38 * [foreach: Iterate over a list.](#foreach) |
39 * [forward_variables_from: Copies variables from a different scope.](#forw
ard_variables_from) | 39 * [forward_variables_from: Copies variables from a different scope.](#forw
ard_variables_from) |
40 * [get_label_info: Get an attribute from a target's label.](#get_label_inf
o) | 40 * [get_label_info: Get an attribute from a target's label.](#get_label_inf
o) |
41 * [get_path_info: Extract parts of a file or directory name.](#get_path_in
fo) | 41 * [get_path_info: Extract parts of a file or directory name.](#get_path_in
fo) |
42 * [get_target_outputs: [file list] Get the list of outputs from a target.]
(#get_target_outputs) | 42 * [get_target_outputs: [file list] Get the list of outputs from a target.]
(#get_target_outputs) |
43 * [getenv: Get an environment variable.](#getenv) | 43 * [getenv: Get an environment variable.](#getenv) |
44 * [import: Import a file into the current scope.](#import) | 44 * [import: Import a file into the current scope.](#import) |
| 45 * [not_needed: Mark variables from scope as not needed.](#not_needed) |
45 * [pool: Defines a pool object.](#pool) | 46 * [pool: Defines a pool object.](#pool) |
46 * [print: Prints to the console.](#print) | 47 * [print: Prints to the console.](#print) |
47 * [process_file_template: Do template expansion over a list of files.](#pr
ocess_file_template) | 48 * [process_file_template: Do template expansion over a list of files.](#pr
ocess_file_template) |
48 * [read_file: Read a file into a variable.](#read_file) | 49 * [read_file: Read a file into a variable.](#read_file) |
49 * [rebase_path: Rebase a file or directory to another location.](#rebase_p
ath) | 50 * [rebase_path: Rebase a file or directory to another location.](#rebase_p
ath) |
50 * [set_default_toolchain: Sets the default toolchain name.](#set_default_t
oolchain) | 51 * [set_default_toolchain: Sets the default toolchain name.](#set_default_t
oolchain) |
51 * [set_defaults: Set default values for a target type.](#set_defaults) | 52 * [set_defaults: Set default values for a target type.](#set_defaults) |
52 * [set_sources_assignment_filter: Set a pattern to filter source files.](#
set_sources_assignment_filter) | 53 * [set_sources_assignment_filter: Set a pattern to filter source files.](#
set_sources_assignment_filter) |
53 * [split_list: Splits a list into N different sub-lists.](#split_list) | 54 * [split_list: Splits a list into N different sub-lists.](#split_list) |
54 * [template: Define a template rule.](#template) | 55 * [template: Define a template rule.](#template) |
(...skipping 2075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2130 ``` | 2131 ``` |
2131 | 2132 |
2132 #### **Examples** | 2133 #### **Examples** |
2133 | 2134 |
2134 ``` | 2135 ``` |
2135 import("//build/rules/idl_compilation_rule.gni") | 2136 import("//build/rules/idl_compilation_rule.gni") |
2136 | 2137 |
2137 # Looks in the current directory. | 2138 # Looks in the current directory. |
2138 import("my_vars.gni") | 2139 import("my_vars.gni") |
2139 ``` | 2140 ``` |
| 2141 ### <a name="not_needed"></a>**not_needed**: Mark variables from scope as not ne
eded. |
| 2142 |
| 2143 ``` |
| 2144 not_needed(variable_list_or_star, variable_to_ignore_list = []) |
| 2145 not_needed(from_scope, variable_list_or_star, |
| 2146 variable_to_ignore_list = []) |
| 2147 |
| 2148 Mark the variables in the current or given scope as not needed, which means |
| 2149 you will not get an error about unused variables for these. |
| 2150 ``` |
| 2151 |
| 2152 #### **Example** |
| 2153 |
| 2154 ``` |
| 2155 not_needed("*", [ "config" ]) |
| 2156 not_needed([ "data_deps", "deps" ]) |
| 2157 not_needed(invoker, "*", [ "config" ]) |
| 2158 not_needed(invoker, [ "data_deps", "deps" ]) |
| 2159 ``` |
2140 ### <a name="pool"></a>**pool**: Defines a pool object. | 2160 ### <a name="pool"></a>**pool**: Defines a pool object. |
2141 | 2161 |
2142 ``` | 2162 ``` |
2143 Pool objects can be applied to a tool to limit the parallelism of the | 2163 Pool objects can be applied to a tool to limit the parallelism of the |
2144 build. This object has a single property "depth" corresponding to | 2164 build. This object has a single property "depth" corresponding to |
2145 the number of tasks that may run simultaneously. | 2165 the number of tasks that may run simultaneously. |
2146 | 2166 |
2147 As the file containing the pool definition may be executed in the | 2167 As the file containing the pool definition may be executed in the |
2148 context of more than one toolchain it is recommended to specify an | 2168 context of more than one toolchain it is recommended to specify an |
2149 explicit toolchain when defining and referencing a pool. | 2169 explicit toolchain when defining and referencing a pool. |
(...skipping 4045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6195 * [--root: Explicitly specify source root.](#--root) | 6215 * [--root: Explicitly specify source root.](#--root) |
6196 * [--runtime-deps-list-file: Save runtime dependencies for targets in file
.](#--runtime-deps-list-file) | 6216 * [--runtime-deps-list-file: Save runtime dependencies for targets in file
.](#--runtime-deps-list-file) |
6197 * [--script-executable: Set the executable used to execute scripts.](#--sc
ript-executable) | 6217 * [--script-executable: Set the executable used to execute scripts.](#--sc
ript-executable) |
6198 * [--threads: Specify number of worker threads.](#--threads) | 6218 * [--threads: Specify number of worker threads.](#--threads) |
6199 * [--time: Outputs a summary of how long everything took.](#--time) | 6219 * [--time: Outputs a summary of how long everything took.](#--time) |
6200 * [--tracelog: Writes a Chrome-compatible trace log to the given file.](#-
-tracelog) | 6220 * [--tracelog: Writes a Chrome-compatible trace log to the given file.](#-
-tracelog) |
6201 * [-v: Verbose logging.](#-v) | 6221 * [-v: Verbose logging.](#-v) |
6202 * [--version: Prints the GN version number and exits.](#--version) | 6222 * [--version: Prints the GN version number and exits.](#--version) |
6203 ``` | 6223 ``` |
6204 | 6224 |
OLD | NEW |