summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/WebKit/Source/bindings/derived_sources.gyp
blob: 20f34614da054ff6bc6409865c6e9f8c85112f7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
#
# Copyright (C) 2013 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
#     * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#     * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
#     * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

{
  'includes': [
    '../build/scripts/scripts.gypi',
    '../build/win/precompile.gypi',
    '../build/scripts/scripts.gypi',
    '../core/core.gypi',
    '../modules/modules.gypi',
    'bindings.gypi',
  ],

  'variables': {
    'main_idl_files': [
      '<@(core_idl_files)',
      '<@(modules_idl_files)',
      '<@(svg_idl_files)',
    ],
    'support_idl_files': [
      '<@(webcore_testing_support_idl_files)',
      '<@(modules_testing_support_idl_files)',
    ],
    'generated_support_idl_files': [
      '<@(generated_webcore_testing_support_idl_files)',
    ],
    'compiler_module_files': [
        'scripts/idl_compiler.py',
        '<(DEPTH)/third_party/ply/lex.py',
        '<(DEPTH)/third_party/ply/yacc.py',
        # jinja2/__init__.py contains version string, so sufficient for package
        '<(DEPTH)/third_party/jinja2/__init__.py',
        '<(DEPTH)/third_party/markupsafe/__init__.py',  # jinja2 dep
        '<(DEPTH)/tools/idl_parser/idl_lexer.py',
        '<(DEPTH)/tools/idl_parser/idl_node.py',
        '<(DEPTH)/tools/idl_parser/idl_parser.py',
        'scripts/blink_idl_lexer.py',
        'scripts/blink_idl_parser.py',
        'scripts/code_generator_v8.py',
        'scripts/idl_definitions.py',
        'scripts/idl_definitions_builder.py',
        'scripts/idl_reader.py',
        'scripts/idl_validator.py',
        'scripts/interface_dependency_resolver.py',
        'scripts/v8_attributes.py',
        'scripts/v8_callback_interface.py',
        'scripts/v8_interface.py',
        'scripts/v8_types.py',
        'scripts/v8_utilities.py',
    ],
    'code_generator_template_files': [
        'templates/attributes.cpp',
        'templates/callback_interface.cpp',
        'templates/callback_interface.h',
        'templates/interface_base.cpp',
        'templates/interface.cpp',
        'templates/interface.h',
    ],

    'bindings_output_dir': '<(SHARED_INTERMEDIATE_DIR)/blink/bindings',
    'generated_global_constructors_idl_files': [
         '<(SHARED_INTERMEDIATE_DIR)/blink/WindowConstructors.idl',
         '<(SHARED_INTERMEDIATE_DIR)/blink/WorkerGlobalScopeConstructors.idl',
         '<(SHARED_INTERMEDIATE_DIR)/blink/SharedWorkerGlobalScopeConstructors.idl',
         '<(SHARED_INTERMEDIATE_DIR)/blink/DedicatedWorkerGlobalScopeConstructors.idl',
         '<(SHARED_INTERMEDIATE_DIR)/ServiceWorkerGlobalScopeConstructors.idl',
    ],

    'conditions': [
      ['OS=="win" and buildtype=="Official"', {
        # On windows official release builds, we try to preserve symbol space.
        'derived_sources_aggregate_files': [
          '<(bindings_output_dir)/V8DerivedSourcesAll.cpp',
        ],
      },{
        'derived_sources_aggregate_files': [
          '<(bindings_output_dir)/V8DerivedSources01.cpp',
          '<(bindings_output_dir)/V8DerivedSources02.cpp',
          '<(bindings_output_dir)/V8DerivedSources03.cpp',
          '<(bindings_output_dir)/V8DerivedSources04.cpp',
          '<(bindings_output_dir)/V8DerivedSources05.cpp',
          '<(bindings_output_dir)/V8DerivedSources06.cpp',
          '<(bindings_output_dir)/V8DerivedSources07.cpp',
          '<(bindings_output_dir)/V8DerivedSources08.cpp',
          '<(bindings_output_dir)/V8DerivedSources09.cpp',
          '<(bindings_output_dir)/V8DerivedSources10.cpp',
          '<(bindings_output_dir)/V8DerivedSources11.cpp',
          '<(bindings_output_dir)/V8DerivedSources12.cpp',
          '<(bindings_output_dir)/V8DerivedSources13.cpp',
          '<(bindings_output_dir)/V8DerivedSources14.cpp',
          '<(bindings_output_dir)/V8DerivedSources15.cpp',
          '<(bindings_output_dir)/V8DerivedSources16.cpp',
          '<(bindings_output_dir)/V8DerivedSources17.cpp',
          '<(bindings_output_dir)/V8DerivedSources18.cpp',
          '<(bindings_output_dir)/V8DerivedSources19.cpp',
        ],
      }],
      # The bindings generator can not write generated files if they are identical
      # to the already existing file – that way they don't need to be recompiled.
      # However, a reverse dependency having a newer timestamp than a
      # generated binding can confuse some build systems, so only use this on
      # ninja which explicitly supports this use case (gyp turns all actions into
      # ninja restat rules).
      ['"<(GENERATOR)"=="ninja"', {
        'write_file_only_if_changed': '--write-file-only-if-changed 1',
      },{
        'write_file_only_if_changed': '--write-file-only-if-changed 0',
      }],
    ],
  },

  'target_defaults': {
    'variables': {
      'optimize': 'max',
    },
  },

  'targets': [{
    'target_name': 'interface_dependencies',
    'type': 'none',
    'actions': [{
      'action_name': 'compute_interface_dependencies',
      'variables': {
        # Write sources into a file, so that the action command line won't
        # exceed OS limits.
        'main_idl_files_list': '<|(main_idl_files_list.tmp <@(main_idl_files))',
        'support_idl_files_list': '<|(support_idl_files_list.tmp <@(support_idl_files))',
      },
      'inputs': [
        'scripts/compute_dependencies.py',
        '<(main_idl_files_list)',
        '<@(main_idl_files)',
        '<(support_idl_files_list)',
        '<@(support_idl_files)',
       ],
       'outputs': [
         '<(SHARED_INTERMEDIATE_DIR)/blink/InterfaceDependencies.txt',
         '<(SHARED_INTERMEDIATE_DIR)/blink/BindingsDerivedSources.txt',
         '<@(generated_global_constructors_idl_files)',
         '<(SHARED_INTERMEDIATE_DIR)/blink/EventInterfaces.in',
       ],
       'msvs_cygwin_shell': 0,
       'action': [
         'python',
         'scripts/compute_dependencies.py',
         '--main-idl-files-list',
         '<(main_idl_files_list)',
         '--support-idl-files-list',
         '<(support_idl_files_list)',
         '--interface-dependencies-file',
         '<(SHARED_INTERMEDIATE_DIR)/blink/InterfaceDependencies.txt',
         '--bindings-derived-sources-file',
         '<(SHARED_INTERMEDIATE_DIR)/blink/BindingsDerivedSources.txt',
         '--window-constructors-file',
         '<(SHARED_INTERMEDIATE_DIR)/blink/WindowConstructors.idl',
         '--workerglobalscope-constructors-file',
         '<(SHARED_INTERMEDIATE_DIR)/blink/WorkerGlobalScopeConstructors.idl',
         '--sharedworkerglobalscope-constructors-file',
         '<(SHARED_INTERMEDIATE_DIR)/blink/SharedWorkerGlobalScopeConstructors.idl',
         '--dedicatedworkerglobalscope-constructors-file',
         '<(SHARED_INTERMEDIATE_DIR)/blink/DedicatedWorkerGlobalScopeConstructors.idl',
         '--serviceworkerglobalscope-constructors-file',
         '<(SHARED_INTERMEDIATE_DIR)/ServiceWorkerGlobalScopeConstructors.idl',
         '--event-names-file',
         '<(SHARED_INTERMEDIATE_DIR)/blink/EventInterfaces.in',
         '<@(write_file_only_if_changed)',
       ],
       'message': 'Resolving partial interfaces dependencies in all IDL files',
      }]
    },
    {
      'target_name': 'bindings_sources',
      'type': 'none',
      # The 'binding' rule generates .h files, so mark as hard_dependency, per:
      # https://code.google.com/p/gyp/wiki/InputFormatReference#Linking_Dependencies
      'hard_dependency': 1,
      'dependencies': [
        'interface_dependencies',
        '../config.gyp:config',
        '../core/core_derived_sources.gyp:generate_test_support_idls',
      ],
      'sources': [
        '<@(main_idl_files)',
        '<@(support_idl_files)',
        '<@(generated_support_idl_files)',
      ],
      'rules': [{
        'rule_name': 'binding',
        'extension': 'idl',
        'msvs_external_rule': 1,
        'inputs': [
          'scripts/generate_bindings.pl',
          'scripts/code_generator_v8.pm',
          'scripts/idl_parser.pm',
          'scripts/idl_serializer.pm',
          '../build/scripts/preprocessor.pm',
          'IDLExtendedAttributes.txt',
          # FIXME: If the dependency structure changes, we rebuild all files,
          # since we're not computing dependencies file-by-file in the build.
          '<(SHARED_INTERMEDIATE_DIR)/blink/InterfaceDependencies.txt',
          # FIXME: Similarly, if any partial interface changes, rebuild
          # everything, since every IDL potentially depends on them, because
          # we're not computing dependencies file-by-file.
          #
          # If a new partial interface is added, need to regyp to update these
          # dependencies, as these are computed statically at gyp runtime.
          '<!@pymod_do_main(list_idl_files_with_partial_interface <@(main_idl_files) <@(support_idl_files))',
          # Generated IDLs are all partial interfaces, hence everything
          # potentially depends on them.
          '<@(generated_global_constructors_idl_files)',
        ],
        'outputs': [
          '<(bindings_output_dir)/V8<(RULE_INPUT_ROOT).cpp',
          '<(bindings_output_dir)/V8<(RULE_INPUT_ROOT).h',
        ],
        'variables': {
          # IDL include paths. The generator will search recursively for IDL
          # files under these locations.
          'generator_include_dirs': [
            '--include', '../core',
            '--include', '../modules',
            '--include', '<(SHARED_INTERMEDIATE_DIR)/blink',
          ],
          # Hook for embedders to specify extra directories to find IDL files.
          'extra_blink_generator_include_dirs%': [],
        },
        'msvs_cygwin_shell': 0,
        # sanitize-win-build-log.sed uses a regex which matches this command
        # line (Perl script + .idl file being processed).
        # Update that regex if command line changes (other than changing flags)
        'action': [
          '<(perl_exe)',
          '-w',
          '-Iscripts',
          '-I../build/scripts',
          '-I<(DEPTH)/third_party/JSON/out/lib/perl5',
          'scripts/generate_bindings.pl',
          '--outputDir',
          '<(bindings_output_dir)',
          '--idlAttributesFile',
          'IDLExtendedAttributes.txt',
          '<@(generator_include_dirs)',
          '<@(extra_blink_generator_include_dirs)',
          '--interfaceDependenciesFile',
          '<(SHARED_INTERMEDIATE_DIR)/blink/InterfaceDependencies.txt',
          '--additionalIdlFiles',
          # Generated IDL files aren't listed in InterfaceDependencies.txt,
          # b/c they aren't available at GYP run time, so we need to sort them
          # manually, depending on whether they are (main) interface files,
          # for which we generate bindings, or dependencies, for which we don't.
          # generated_support_idl_files are main interfaces, so generate
          # bindings, but generated_global_constructors_idl_files are all
          # partial interfaces, so don't (b/c generated by dependents).
          '<(generated_support_idl_files)',
          '<@(preprocessor)',
          '<@(write_file_only_if_changed)',
          '<(RULE_INPUT_PATH)',
        ],
        'message': 'Generating binding from <(RULE_INPUT_PATH)',
      }],
    },
    {
      'target_name': 'bindings_derived_sources',
      'type': 'none',
      'dependencies': [
        'interface_dependencies',
        'bindings_sources',
      ],
      'actions': [{
        'action_name': 'derived_sources_all_in_one',
        'inputs': [
          '../build/scripts/action_derivedsourcesallinone.py',
          '<(SHARED_INTERMEDIATE_DIR)/blink/BindingsDerivedSources.txt',
        ],
        'outputs': [
          '<@(derived_sources_aggregate_files)',
        ],
        'action': [
          'python',
          '../build/scripts/action_derivedsourcesallinone.py',
          '<(SHARED_INTERMEDIATE_DIR)/blink/BindingsDerivedSources.txt',
          '--',
          '<@(derived_sources_aggregate_files)',
        ],
        'message': 'Generating bindings derived sources',
      }],
    },
  ],
}