File Explorer

/var/lang/lib/node_modules/npm/node_modules/node-gyp/gyp/docs

This explorer reads the filesystem of the server it runs on, so /workspace/user isn't present here. Browsing and the terminal still work against this server's own disk from /.

0 dirs
7 files
InputFormatReference.md38.1 KB · 1084 lines
# Input Format Reference ## Primitive Types The following primitive types are found within input files:   * String values, which may be represented by enclosing them in    `'single quotes'` or `"double quotes"`.  By convention, single    quotes are used.  * Integer values, which are represented in decimal without any special    decoration.  Integers are fairly rare in input files, but have a few    applications in boolean contexts, where the convention is to    represent true values with `1` and false with `0`.  * Lists, which are represented as a sequence of items separated by    commas (`,`) within square brackets (`[` and `]`).  A list may    contain any other primitive types, including other lists.    Generally, each item of a list must be of the same type as all other    items in the list, but in some cases (such as within `conditions`    sections), the list structure is more tightly specified.  A trailing    comma is permitted.     This example list contains three string values.       ```      [ 'Generate', 'Your', 'Projects', ]      ```   * Dictionaries, which map keys to values.  All keys are strings.    Values may be of any other primitive type, including other    dictionaries.  A dictionary is enclosed within curly braces (`{` and    `}`).  Keys precede values, separated by a colon (`:`).  Successive    dictionary entries are separated by commas (`,`).  A trailing comma    is permitted.  It is an error for keys to be duplicated within a    single dictionary as written in an input file, although keys may    replace other keys during [merging](#Merging).     This example dictionary maps each of three keys to different values.       ```      {        'inputs': ['version.c.in'],        'outputs': ['version.c'],        'process_outputs_as_sources': 1,      }      ``` ## Overall Structure A GYP input file is organized as structured data.  At the root scope ofeach `.gyp` or `.gypi` (include) file is a dictionary.  The keys andvalues of this dictionary, along with any descendants contained withinthe values, provide the data contained within the file.  This data isgiven meaning by interpreting specific key names and their associatedvalues in specific ways (see [Settings Keys](#Settings_Keys)). ### Comments (#) Within an input file, a comment is introduced by a pound sign (`#`) notwithin a string.  Any text following the pound sign, up until the end ofthe line, is treated as a comment. #### Example ```{  'school_supplies': [    'Marble composition book',    'Sharp #2 pencil',    'Safety scissors',  # You still shouldn't run with these  ],}``` In this example, the # in `'Sharp #2 pencil'` is not taken asintroducing a comment because it occurs within a string, but the textafter `'Safety scissors'` is treated as a comment having no impact onthe data within the file. ## Merging ### Merge Basics (=, ?, +) Many operations on GYP input files occurs by merging dictionary and listitems together.  During merge operations, it is important to recognizethe distinction between source and destination values.  Items from thesource value are merged into the destination, which leaves the sourceunchanged and the destination modified by the source.  A dictionary mayonly be merged into another dictionary, and a list may only be mergedinto another list.   * When merging a dictionary, for each key in the source:    * If the key does not exist in the destination dictionary, insert it      and copy the associated value directly.    * If the key does exist:      * If the associated value is a dictionary, perform the dictionary        merging procedure using the source's and destination's value        dictionaries.      * If the associated value is a list, perform the list merging        procedure using the source's and destination's value lists.      * If the associated value is a string or integer, the destination        value is replaced by the source value.  * When merging a list, merge according to the suffix appended to the    key name, if the list is a value within a dictionary.    * If the key ends with an equals sign (`=`), the policy is for the      source list to completely replace the destination list if it      exists.  _Mnemonic: `=` for assignment._    * If the key ends with a question mark (`?`), the policy is for the      source list to be set as the destination list only if the key is      not already present in the destination.  _Mnemonic: `?` for      conditional assignment_.    * If the key ends with a plus sign (`+`), the policy is for the      source list contents to be prepended to the destination list.      _Mnemonic: `+` for addition or concatenation._    * If the list key is undecorated, the policy is for the source list      contents to be appended to the destination list.  This is the      default list merge policy. #### Example Source dictionary: ```{  'include_dirs+': [    'shared_stuff/public',  ],  'link_settings': {    'libraries': [      '-lshared_stuff',    ],  },  'test': 1,}``` Destination dictionary: ```{  'target_name': 'hello',  'sources': [    'kitty.cc',  ],  'include_dirs': [    'headers',  ],  'link_settings': {    'libraries': [      '-lm',    ],    'library_dirs': [      '/usr/lib',    ],  },  'test': 0,}``` Merged dictionary: ```{  'target_name': 'hello',  'sources': [    'kitty.cc',  ],  'include_dirs': [    'shared_stuff/public',  # Merged, list item prepended due to include_dirs+    'headers',  ],  'link_settings': {    'libraries': [      '-lm',      '-lshared_stuff',  # Merged, list item appended    ],    'library_dirs': [      '/usr/lib',    ],  },  'test': 1,  # Merged, int value replaced}``` ## Pathname Relativization In a `.gyp` or `.gypi` file, many string values are treated as pathnamesrelative to the file in which they are defined. String values associated with the following keys, or contained withinlists associated with the following keys, are treated as pathnames:   * destination  * files  * include\_dirs  * inputs  * libraries  * library\_dirs  * outputs  * sources  * mac\_bundle\_resources  * mac\_framework\_dirs  * msvs\_cygwin\_dirs  * msvs\_props Additionally, string values associated with keys ending in the followingsuffixes, or contained within lists associated with keys ending in thefollowing suffixes, are treated as pathnames:   * `_dir`  * `_dirs`  * `_file`  * `_files`  * `_path`  * `_paths` However, any string value beginning with any of these characters isexcluded from pathname relativization:   * `/` for identifying absolute paths.  * `$` for introducing build system variable expansions.  * `-` to support specifying such items as `-llib`, meaning “library    `lib` in the library search path.”  * `<`, `>`, and `!` for GYP expansions. When merging such relative pathnames, they are adjusted so that they canremain valid relative pathnames, despite being relative to a new home. #### Example Source dictionary from `../build/common.gypi`: ```{  'include_dirs': ['include'],  # Treated as relative to ../build  'library_dirs': ['lib'],      # Treated as relative to ../build  'libraries': ['-lz'],   # Not treated as a pathname, begins with a dash  'defines': ['NDEBUG'],  # defines does not contain pathnames}``` Target dictionary, from `base.gyp`: ```{  'sources': ['string_util.cc'],}``` Merged dictionary: ```{  'sources': ['string_util.cc'],  'include_dirs': ['../build/include'],  'library_dirs': ['../build/lib'],  'libraries': ['-lz'],  'defines': ['NDEBUG'],}``` Because of pathname relativization, after the merge is complete, all ofthe pathnames in the merged dictionary are valid relative to thedirectory containing `base.gyp`. ## List Singletons Some list items are treated as singletons, and the list merge processwill enforce special rules when merging them.  At present, any stringitem in a list that does not begin with a dash (`-`) is treated as asingleton, although **this is subject to change.**  When appending orprepending a singleton to a list, if the item is already in the list,only the earlier instance is retained in the merged list. #### Example Source dictionary: ```{  'defines': [    'EXPERIMENT=1',    'NDEBUG',  ],}``` Destination dictionary: ```{  'defines': [    'NDEBUG',    'USE_THREADS',  ],}``` Merged dictionary: ```{  'defines': [    'NDEBUG',    'USE_THREADS',    'EXPERIMENT=1',  # Note that NDEBUG is not appended after this.  ],}``` ## Including Other Files If the `-I` (`--include`) argument was used to invoke GYP, any filesspecified will be implicitly merged into the root dictionary of all`.gyp` files. An [includes](#includes) section may be placed anywhere within a`.gyp` or `.gypi` (include) file.  `includes` sections contain lists ofother files to include.  They are processed sequentially and merged intothe enclosing dictionary at the point that the `includes` section wasfound.  `includes` sections at the root of a `.gyp` file dictionary aremerged after any `-I` includes from the command line. [includes](#includes) sections are processed immediately after a file isloaded, even before [variable and conditionalprocessing](#Variables_and_Conditionals), so it is not possible toinclude a file based on a [variable reference](#Variable_Expansions).While it would be useful to be able to include files based on variableexpansions, it is most likely more useful to allow included files accessto variables set by the files that included them. An [includes](#includes) section may, however, be placed within a[conditional](#Conditionals) section.  The included file itself willbe loaded unconditionally, but its dictionary will be discarded if theassociated condition is not true. ## Variables and Conditionals ### Variables There are three main types of variables within GYP.   * Predefined variables.  By convention, these are named with    `CAPITAL_LETTERS`.  Predefined variables are set automatically by    GYP.  They may be overridden, but it is not advisable to do so.  See    [Predefined Variables](#Predefined_Variables) for a list of    variables that GYP provides.  * User-defined variables.  Within any dictionary, a key named    `variables` can be provided, containing a mapping between variable    names (keys) and their contents (values), which may be strings,    integers, or lists of strings.  By convention, user-defined    variables are named with `lowercase_letters`.  * Automatic variables.  Within any dictionary, any key with a string    value has a corresponding automatic variable whose name is the same    as the key name with an underscore (`_`) prefixed.  For example, if    your dictionary contains `type: 'static_library'`, an automatic    variable named `_type` will be provided, and its value will be a    string, `'static_library'`. Variables are inherited from enclosing scopes. ### Providing Default Values for Variables (%) Within a `variables` section, keys named with percent sign (`%`)suffixes mean that the variable should be set only if it is undefined atthe time it is processed.  This can be used to provide defaults forvariables that would otherwise be undefined, so that they may reliablybe used in [variable expansion or conditionalprocessing](#Variables_and_Conditionals). ### Predefined Variables Each GYP generator module provides defaults for the following variables:   * `OS`: The name of the operating system that the generator produces    output for.  Common values for values for `OS` are:     * `'linux'`    * `'mac'`    * `'win'`     But other values may be encountered and this list should not be    considered exhaustive.  The `gypd` (debug) generator module does not    provide a predefined value for `OS`.  When invoking GYP with the    `gypd` module, if a value for `OS` is needed, it must be provided on    the command line, such as `gyp -f gypd -DOS=mac`.     GYP generators also provide defaults for these variables.  They may    be expressed in terms of variables used by the build system that    they generate for, often in `$(VARIABLE)` format.  For example, the    GYP `PRODUCT_DIR` variable maps to the Xcode `BUILT_PRODUCTS_DIR`    variable, so `PRODUCT_DIR` is defined by the Xcode generator as    `$(BUILT_PRODUCTS_DIR)`.  * `EXECUTABLE_PREFIX`: A prefix, if any, applied to executable names.    Usually this will be an empty string.  * `EXECUTABLE_SUFFIX`: A suffix, if any, applied to executable names.    On Windows, this will be `.exe`, elsewhere, it will usually be an    empty string.  * `INTERMEDIATE_DIR`: A directory that can be used to place    intermediate build results in.  `INTERMEDIATE_DIR` is only    guaranteed to be accessible within a single target (See targets).    This variable is most useful within the context of rules and actions    (See rules, See actions).  Compare with `SHARED_INTERMEDIATE_DIR`.  * `PRODUCT_DIR`: The directory in which the primary output of each    target, such as executables and libraries, is placed.  * `RULE_INPUT_ROOT`: The base name for the input file (e.g. "`foo`").    See Rules.  * `RULE_INPUT_EXT`: The file extension for the input file (e.g.    "`.cc`").  See Rules.  * `RULE_INPUT_NAME`: Full name of the input file (e.g. "`foo.cc`").    See Rules.  * `RULE_INPUT_PATH`: Full path to the input file (e.g.    "`/bar/foo.cc`").  See Rules.  * `SHARED_INTERMEDIATE_DIR`: A directory that can be used to place    intermediate build results in, and have them be accessible to other    targets.  Unlike `INTERMEDIATE_DIR`, each target in a project,    possibly spanning multiple `.gyp` files, shares the same    `SHARED_INTERMEDIATE_DIR`. The following additional predefined variables may be available undercertain circumstances:   * `DEPTH`.  When GYP is invoked with a `--depth` argument, when    processing any `.gyp` file, `DEPTH` will be a relative path from the    `.gyp` file to the directory specified by the `--depth` argument. ### User-Defined Variables A user-defined variable may be defined in terms of other variables, butnot other variables that have definitions provided in the same scope. ### Variable Expansions (<, >, <@, >@) GYP provides two forms of variable expansions, “early” or “pre”expansions, and “late,” “post,” or “target” expansions.  They havesimilar syntax, differing only in the character used to introduce them.   * Early expansions are introduced by a less-than (`<`) character.    _Mnemonic: the arrow points to the left, earlier on a timeline._  * Late expansions are introduced by a less-than (`>`) character.    _Mnemonic: the arrow points to the right, later on a timeline._ The difference the two phases of expansion is described in [Early andLate Phases](#Early_and_Late_Phases). These characters were chosen based upon the requirement that they notconflict with the variable format used natively by build systems.  Whilethe dollar sign (`$`) is the most natural fit for variable expansions,its use was ruled out because most build systems already use thatcharacter for their own variable expansions.  Using different charactersmeans that no escaping mechanism was needed to differentiate between GYPvariables and build system variables, and writing build system variablesinto GYP files is not cumbersome. Variables may contain lists or strings, and variable expansions mayoccur in list or string context.  There are variant forms of variableexpansions that may be used to determine how each type of variable is tobe expanded in each context.   * When a variable is referenced by `<(VAR)` or `>(VAR)`:    * If `VAR` is a string, the variable reference within the string is      replaced by variable's string value.    * If `VAR` is a list, the variable reference within the string is      replaced by a string containing the concatenation of all of the      variable’s list items.  Generally, the items are joined with      spaces between each, but the specific behavior is      generator-specific.  The precise encoding used by any generator      should be one that would allow each list item to be treated as a      separate argument when used as program arguments on the system      that the generator produces output for.  * When a variable is referenced by `<@(VAR)` or `>@(VAR)`:    * The expansion must occur in list context.    * The list item must be `'<@(VAR)'` or `'>@(VAR)'` exactly.    * If `VAR` is a list, each of its elements are inserted into the      list in which expansion is taking place, replacing the list item      containing the variable reference.    * If `VAR` is a string, the string is converted to a list which is      inserted into the list in which expansion is taking place as      above.  The conversion into a list is generator-specific, but      generally, spaces in the string are taken as separators between      list items.  The specific method of converting the string to a      list should be the inverse of the encoding method used to expand      list variables in string context, above. GYP treats references to undefined variables as errors. ### Command Expansions (<!, <!@) Command expansions function similarly to variable expansions, butinstead of resolving variable references, they cause GYP to execute acommand at generation time and use the command’s output as thereplacement.  Command expansions are introduced by a less than andexclamation mark (`<!`). In a command expansion, the entire string contained within theparentheses is passed to the system’s shell.  The command’s output isassigned to a string value that may subsequently be expanded in listcontext in the same way as variable expansions if an `@` character isused. In addition, command expansions (unlike other variable expansions) mayinclude nested variable expansions.  So something like this is allowed: ```'variables' : [  'foo': '<!(echo Build Date <!(date))',],``` expands to: ```'variables' : [  'foo': 'Build Date 02:10:38 PM Fri Jul 24, 2009 -0700 PDT',],``` You may also put commands into arrays in order to quote arguments (butnote that you need to use a different string quoting character): ```'variables' : [  'files': '<!(["ls", "-1", "Filename With Spaces"])',],``` GYP treats command failures (as indicated by a nonzero exit status)during command expansion as errors. #### Example ```{  'sources': [    '!(echo filename with space.cc)',  ],  'libraries': [    '!@(pkg-config --libs-only-l apr-1)',  ],}``` might expand to: ```{  'sources': [    'filename with space.cc',  # no @, expands into a single string  ],  'libraries': [  # @ was used, so there's a separate list item for each lib    '-lapr-1',    '-lpthread',  ],}``` ## Conditionals Conditionals use the same set of variables used for variable expansion.As with variable expansion, there are two phases of conditionalevaluation:   * “Early” or “pre” conditional evaluation, introduced in    [conditions](#conditions) sections.  * “Late,” “post,” or “target” conditional evaluation, introduced in    [target\_conditions](#target_conditions) sections. The syntax for each type is identical, they differ only in the key nameused to identify them and the timing of their evaluation.  A morecomplete description of syntax and use is provided in[conditions](#conditions). The difference the two phases of evaluation is described in [Early andLate Phases](#Early_and_Late_Phases). ## Timing of Variable Expansion and Conditional Evaluation ### Early and Late Phases GYP performs two phases of variable expansion and conditional evaluation:   * The “early” or “pre” phase operates on [conditions](#conditions)    sections and the `<` form of [variable    expansions](#Variable_Expansions).  * The “late,” “post,” or “target” phase operates on    [target\_conditions](#target_conditions) sections, the `>` form    of [variable expansions](#Variable_Expansions),    and on the `!` form of [command    expansions](#Command_Expansions_(!,_!@)). These two phases are provided because there are some circumstances inwhich each is desirable. The “early” phase is appropriate for most expansions and evaluations.“Early” expansions and evaluations may be performed anywhere within any`.gyp` or `.gypi` file. The “late” phase is appropriate when expansion or evaluation must bedeferred until a specific section has been merged into target context.“Late” expansions and evaluations only occur within `targets` sectionsand their descendants.  The typical use case for a late-phase expansionis to provide, in some globally-included `.gypi` file, distinctbehaviors depending on the specifics of a target. #### Example Given this input: ```{  'target_defaults': {    'target_conditions': [      ['_type=="shared_library"', {'cflags': ['-fPIC']}],    ],  },  'targets': [    {      'target_name': 'sharing_is_caring',      'type': 'shared_library',    },    {      'target_name': 'static_in_the_attic',      'type': 'static_library',    },  ]}``` The conditional needs to be evaluated only in target context; it isnonsense outside of target context because no `_type` variable isdefined.  [target\_conditions](#target_conditions) allows evaluationto be deferred until after the [targets](#targets) sections aremerged into their copies of [target\_defaults](#target_defaults).The resulting targets, after “late” phase processing: ```{  'targets': [    {      'target_name': 'sharing_is_caring',      'type': 'shared_library',      'cflags': ['-fPIC'],    },    {      'target_name': 'static_in_the_attic',      'type': 'static_library',    },  ]}``` ### Expansion and Evaluation Performed Simultaneously During any expansion and evaluation phase, both expansion and evaluationare performed simultaneously.  The process for handling variableexpansions and conditional evaluation within a dictionary is:   * Load [automatic variables](#Variables) (those with leading    underscores).  * If a [variables](#variables) section is present, recurse into its    dictionary.  This allows [conditionals](#Conditionals) to be    present within the `variables` dictionary.  * Load [Variables user-defined variables](#User-Defined) from the    [variables](#variables) section.  * For each string value in the dictionary, perform [variable    expansion](#Variable_Expansions) and, if operating    during the “late” phase, [command    expansions](#Command_Expansions).  * Reload [automatic variables](#Variables) and [Variables    user-defined variables](#User-Defined) because the variable    expansion step may have resulted in changes to the automatic    variables.  * If a [conditions](#conditions) or    [target\_conditions](#target_conditions) section (depending on    phase) is present, recurse into its dictionary.  This is done after    variable expansion so that conditionals may take advantage of    expanded automatic variables.  * Evaluate [conditionals](#Conditionals).  * Reload [automatic variables](#Variables) and [Variables    user-defined variables](#User-Defined) because the conditional    evaluation step may have resulted in changes to the automatic    variables.  * Recurse into child dictionaries or lists that have not yet been    processed. One quirk of this ordering is that you cannot expect a[variables](#variables) section within a dictionary’s[conditional](#Conditionals) to be effective in the dictionaryitself, but the added variables will be effective in any childdictionaries or lists.  It is thought to be far more worthwhile toprovide resolved [automatic variables](#Variables) to[conditional](#Conditionals) sections, though.  As a workaround, toconditionalize variable values, place a [conditions](#conditions) or[target\_conditions](#target_conditions) section within the[variables](#variables) section. ## Dependencies and Dependents In GYP, “dependents” are targets that rely on other targets, called“dependencies.”  Dependents declare their reliance with a specialsection within their target dictionary,[dependencies](#dependencies). ### Dependent Settings It is useful for targets to “advertise” settings to their dependents.For example, a target might require that all of its dependents addcertain directories to their include paths, link against speciallibraries, or define certain preprocessor macros.  GYP allows thesecases to be handled gracefully with “dependent settings” sections.There are three types of such sections:   * [direct\_dependent\_settings](#direct_dependent_settings), which    advertises settings to a target's direct dependents only.  * [all\_dependent\_settings](#all_dependnet_settings), which    advertises settings to all of a target's dependents, both direct and    indirect.  * [link\_settings](#link_settings), which contains settings that    should be applied when a target’s object files are used as linker    input. Furthermore, in some cases, a target needs to pass its dependencies’settings on to its own dependents.  This might happen when a target’sown public header files include header files provided by its dependency.[export\_dependent\_settings](#export_dependent_settings) allows atarget to declare dependencies for which[direct\_dependent\_settings](#direct_dependent_settings) should bepassed through to its own dependents. Dependent settings processing merges a copy of the relevant dependentsettings dictionary from a dependency into its relevant dependenttargets. In most instances,[direct\_dependent\_settings](#direct_dependent_settings) will beused.  There are very few cases where[all\_dependent\_settings](#all_dependent_settings) is actuallycorrect; in most of the cases where it is tempting to use, it would bepreferable to declare[export\_dependent\_settings](#export_dependent_settings).  Most[libraries](#libraries) and [library\_dirs](#library_dirs)sections should be placed within [link\_settings](#link_settings)sections. #### Example Given: ```{  'targets': [    {      'target_name': 'cruncher',      'type': 'static_library',      'sources': ['cruncher.cc'],      'direct_dependent_settings': {        'include_dirs': ['.'],  # dependents need to find cruncher.h.      },      'link_settings': {        'libraries': ['-lm'],  # cruncher.cc does math.      },    },    {      'target_name': 'cruncher_test',      'type': 'executable',      'dependencies': ['cruncher'],      'sources': ['cruncher_test.cc'],    },  ],}``` After dependent settings processing, the dictionary for `cruncher_test`will be: ```{  'target_name': 'cruncher_test',  'type': 'executable',  'dependencies': ['cruncher'],  # implies linking against cruncher  'sources': ['cruncher_test.cc'],  'include_dirs': ['.']  'libraries': ['-lm'],},``` If `cruncher` was declared as a `shared_library` instead of a`static_library`, the `cruncher_test` target would not contain `-lm`,but instead, `cruncher` itself would link against `-lm`. ## Linking Dependencies The precise meaning of a dependency relationship varies with the[types](#type) of the [targets](#targets) at either end of therelationship.  In GYP, a dependency relationship can indicate two thingsabout how targets relate to each other:   * Whether the dependent target needs to link against the dependency.  * Whether the dependency target needs to be built prior to the    dependent.  If the former case is true, this case must be true as    well. The analysis of the first item is complicated by the differences betweenstatic and shared libraries.   * Static libraries are simply collections of object files (`.o` or    `.obj`) that are used as inputs to a linker (`ld` or `link.exe`).    Static libraries don't link against other libraries, they’re    collected together and used when eventually linking a shared library    or executable.  * Shared libraries are linker output and must undergo symbol    resolution.  They must link against other libraries (static or    shared) in order to facilitate symbol resolution.  They may be used    as libraries in subsequent link steps.  * Executables are also linker output, and also undergo symbol    resolution.  Like shared libraries, they must link against static    and shared libraries to facilitate symbol resolution.  They may not    be reused as linker inputs in subsequent link steps. Accordingly, GYP performs an operation referred to as “static librarydependency adjustment,” in which it makes each linker output target(shared libraries and executables) link against the static libraries itdepends on, either directly or indirectly.  Because the linkable targetslink against these static libraries, they are also made directdependents of the static libraries. As part of this process, GYP is also able to remove the directdependency relationships between two static library targets, as adependent static library does not actually need to link against adependency static library.  This removal facilitates speedier buildsunder some build systems, as they are now free to build the two targetsin parallel.  The removal of this dependency is incorrect in some cases,such as when the dependency target contains [rules](#rules) or[actions](#actions) that generate header files required by thedependent target.  In such cases, the dependency target, the oneproviding the side-effect files, must declare itself as a[hard\_dependency](#hard_dependency).  This setting instructs GYP tonot remove the dependency link between two static library targets in itsgenerated output. ## Loading Files to Resolve Dependencies When GYP runs, it loads all `.gyp` files needed to resolve dependenciesfound in [dependencies](#dependencies) sections.  These files are notmerged into the files that reference them, but they may contain specialsections that are merged into dependent target dictionaries. ## Build Configurations Explain this. ## List Filters GYP allows list items to be filtered by “exclusions” and “patterns.”Any list containing string values in a dictionary may have thisfiltering applied.  For the purposes of this section, a list modified byexclusions or patterns is referred to as a “base list”, in contrast tothe “exclusion list” and “pattern list” that operates on it.   * For a base list identified by key name `key`, the `key!` list    provides exclusions.  * For a base list identified by key name `key`, the `key/` list    provides regular expression pattern-based filtering. Both `key!` and `key/` may be present.  The `key!` exclusion list willbe processed first, followed by the `key/` pattern list. Exclusion lists are most powerful when used in conjunction with[conditionals](#Conditionals). ## Exclusion Lists (!) An exclusion list provides a way to remove items from the related listbased on exact matching.  Any item found in an exclusion list will beremoved from the corresponding base list. #### Example This example excludes files from the `sources` based on the setting ofthe `OS` variable. ```{  'sources:' [    'mac_util.mm',    'win_util.cc',  ],  'conditions': [    ['OS=="mac"', {'sources!': ['win_util.cc']}],    ['OS=="win"', {'sources!': ['mac_util.cc']}],  ],}``` ## Pattern Lists (/) Pattern lists are similar to, but more powerful than, [exclusionlists](#Exclusion_Lists_(!)).  Each item in a pattern list is itselfa two-element list.  The first item is a string, either `'include'` or`'exclude'`, specifying the action to take.  The second item is a stringspecifying a regular expression.  Any item in the base list matching theregular expression pattern will either be included or excluded, based onthe action specified. Items in a pattern list are processed in sequence, and an excluded itemthat is later included will not be removed from the list (unless it issubsequently excluded again.) Pattern lists are processed after [exclusionlists](#Exclusion_Lists_(!)), so it is possible for a pattern list tore-include items previously excluded by an exclusion list. Nothing is actually removed from a base list until all items in an[exclusion list](#Exclusion_Lists_(!)) and pattern list have beenevaluated.  This allows items to retain their correct position relativeto one another even after being excluded and subsequently included. #### Example In this example, a uniform naming scheme is adopted forplatform-specific files. ```{  'sources': [    'io_posix.cc',    'io_win.cc',    'launcher_mac.cc',    'main.cc',    'platform_util_linux.cc',    'platform_util_mac.mm',  ],  'sources/': [    ['exclude', '_win\\.cc$'],  ],  'conditions': [    ['OS!="linux"', {'sources/': [['exclude', '_linux\\.cc$']]}],    ['OS!="mac"', {'sources/': [['exclude', '_mac\\.cc|mm?$']]}],    ['OS=="win"', {'sources/': [      ['include', '_win\\.cc$'],      ['exclude', '_posix\\.cc$'],    ]}],  ],}``` After the pattern list is applied, `sources` will have the followingvalues, depending on the setting of `OS`:   * When `OS` is `linux`: `['io_posix.cc', 'main.cc',    'platform_util_linux.cc']`  * When `OS` is `mac`: `['io_posix.cc', 'launcher_mac.cc', 'main.cc',    'platform_util_mac.mm']`  * When `OS` is `win`: `['io_win.cc', 'main.cc',    'platform_util_win.cc']` Note that when `OS` is `win`, the `include` for `_win.cc` files isprocessed after the `exclude` matching the same pattern, because the`sources/` list participates in [merging](#Merging) during[conditional evaluation](#Conditonals) just like any other listwould.  This guarantees that the `_win.cc` files, previouslyunconditionally excluded, will be re-included when `OS` is `win`. ## Locating Excluded Items In some cases, a GYP generator needs to access to items that wereexcluded by an [exclusion list](#Exclusion_Lists_(!)) or [patternlist](#Pattern_Lists_(/)).  When GYP excludes items during processingof either of these list types, it places the results in an `_excluded`list.  In the example above, when `OS` is `mac`, `sources_excluded`would be set to `['io_win.cc', 'platform_util_linux.cc']`.  Some GYPgenerators use this feature to display excluded files in the projectfiles they generate for the convenience of users, who may wish to referto other implementations. ## Processing Order GYP uses a defined and predictable order to execute the various stepsperformed between loading files and generating output.   * Load files.    * Load `.gyp` files.  Merge any [command-line      includes](#Including_Other_Files) into each `.gyp` file’s root      dictionary.  As [includes](#Including_Other_Files) are found,      load them as well and [merge](#Merging) them into the scope in      which the [includes](#includes) section was found.    * Perform [“early” or “pre”](#Early_and_Late_Phases) [variable      expansion and conditional      evaluation](#Variables_and_Conditionals).    * [Merge](#Merging) each [target’s](#targets) dictionary into      the `.gyp` file’s root [target\_defaults](#target_defaults)      dictionary.    * Scan each [target](#targets) for      [dependencies](#dependencies), and repeat the above steps for      any newly-referenced `.gyp` files not yet loaded.  * Scan each [target](#targets) for wildcard    [dependencies](#dependencies), expanding the wildcards.  * Process [dependent settings](#Dependent_Settings).  These    sections are processed, in order:    * [all\_dependent\_settings](#all_dependent_settings)    * [direct\_dependent\_settings](#direct_dependent_settings)    * [link\_dependent\_settings](#link_dependent_settings)  * Perform [static library dependency    adjustment](#Linking_Dependencies).  * Perform [“late,” “post,” or “target”](#Early_and_Late_Phases)    [variable expansion and conditional    evaluation](#Variables_and_Conditionals) on [target](#targets)    dictionaries.  * Merge [target](#targets) settings into    [configurations](#configurations) as appropriate.  * Process [exclusion and pattern    lists](#List_Exclusions_and_Patterns). ## Settings Keys ### Settings that may appear anywhere #### conditions _List of `condition` items_ A `conditions` section introduces a subdictionary that is only mergedinto the enclosing scope based on the evaluation of a conditionalexpression.  Each `condition` within a `conditions` list is itself alist of at least two items:   1. A string containing the conditional expression itself.  Conditional  expressions may take the following forms:    * For string values, `var=="value"` and `var!="value"` to test      equality and inequality.  For example, `'OS=="linux"'` is true      when the `OS` variable is set to `"linux"`.    * For integer values, `var==value`, `var!=value`, `var<value`,      `var<=value`, `var>=value`, and `var>value`, to test equality and      several common forms of inequality.  For example,      `'chromium_code==0'` is true when the `chromium_code` variable is      set to `0`.    * It is an error for a conditional expression to reference any      undefined variable.  1. A dictionary containing the subdictionary to be merged into the  enclosing scope if the conditional expression evaluates to true. These two items can be followed by any number of similar two items thatwill be evaluated if the previous conditional expression does notevaluate to true. An additional optional dictionary can be appended to this sequence oftwo items.  This optional dictionary will be merged into the enclosingscope if none of the conditional expressions evaluate to true. Within a `conditions` section, each item is processed sequentially, soit is possible to predict the order in which operations will occur. There is no restriction on nesting `conditions` sections. `conditions` sections are very similar to `target_conditions` sections.See target\_conditions. #### Example ```{  'sources': [    'common.cc',  ],  'conditions': [    ['OS=="mac"', {'sources': ['mac_util.mm']}],    ['OS=="win"', {'sources': ['win_main.cc']}, {'sources': ['posix_main.cc']}],    ['OS=="mac"', {'sources': ['mac_impl.mm']},     'OS=="win"', {'sources': ['win_impl.cc']},     {'sources': ['default_impl.cc']}    ],  ],}``` Given this input, the `sources` list will take on different values basedon the `OS` variable.   * If `OS` is `"mac"`, `sources` will contain `['common.cc',    'mac_util.mm', 'posix_main.cc', 'mac_impl.mm']`.  * If `OS` is `"win"`, `sources` will contain `['common.cc',    'win_main.cc', 'win_impl.cc']`.  * If `OS` is any other value such as `"linux"`, `sources` will contain    `['common.cc', 'posix_main.cc', 'default_impl.cc']`.