Home | History | Annotate | Download | only in scripts
      1 # Copyright 2014 The Chromium Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 #
      5 # This file is meant to be included into a target to provide an action
      6 # to compute global objects in a component.
      7 #
      8 # To use this, create a gyp target with the following form:
      9 # {
     10 #   'target_name': 'core_global_constructors_idls',
     11 #   'dependencies': [
     12 #     'component_global_objects',
     13 #   ],
     14 #   'variables': {
     15 #     'idl_files': '<(list_of_idl_files)',
     16 #     'global_objects_file': '<(some_dir)/GlobalObjectsComponent.pickle',
     17 #     'global_names_idl_files': [
     18 #       'GlobalName',
     19 #       '<(blink_core_output_dir)/GlobalScopeComponentConstructors.idl',
     20 #       # ...
     21 #     ],
     22 #     'outputs': [
     23 #       '<@(component_global_constructors_generated_idl_files)',
     24 #       '<@(component_global_constructors_generated_header_files)',
     25 #     ],
     26 #   },
     27 #   'includes': ['path/to/this/gypi/file'],
     28 # },
     29 #
     30 # Required variables:
     31 #  idl_files - List of .idl files that will be searched in.
     32 #    This should *only* contain main IDL files, excluding dependencies and
     33 #    testing, which should not appear on global objects.
     34 #  global_objects - Pickle file of global objects.
     35 #  global_names_idl_files - pairs (GlobalName, Constructors.idl)
     36 #  outputs - List of output files.
     37 #    Passed as a variable here, included by the template in the action.
     38 #
     39 # Spec: http://heycam.github.io/webidl/#Global
     40 #       http://heycam.github.io/webidl/#Exposed
     41 # Design document: http://www.chromium.org/developers/design-documents/idl-build
     42 
     43 {
     44   'type': 'none',
     45   'actions': [{
     46     'action_name': 'generate_<(_target_name)',
     47     'message': 'Generating IDL files for constructors on global objects for <(_target_name)',
     48     'variables': {
     49       'idl_files_list': '<|(<(_target_name)_idl_files_list.tmp <@(idl_files))',
     50     },
     51     'includes': ['scripts.gypi'],
     52     'inputs': [
     53       '<(bindings_scripts_dir)/generate_global_constructors.py',
     54       '<(bindings_scripts_dir)/utilities.py',
     55       '<(idl_files_list)',
     56       '<@(idl_files)',
     57       '<(global_objects_file)',
     58     ],
     59     'outputs': ['<@(outputs)'],
     60     'action': [
     61       'python',
     62       '<(bindings_scripts_dir)/generate_global_constructors.py',
     63       '--idl-files-list',
     64       '<(idl_files_list)',
     65       '--global-objects-file',
     66       '<(global_objects_file)',
     67       '--write-file-only-if-changed',
     68       '<(write_file_only_if_changed)',
     69       '--',
     70       '<@(global_names_idl_files)',
     71     ],
     72   }],
     73 }
     74