2 # Copyright (C) 2013 Google Inc. All rights reserved.
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above
11 # copyright notice, this list of conditions and the following disclaimer
12 # in the documentation and/or other materials provided with the
14 # * Neither the name of Google Inc. nor the names of its
15 # contributors may be used to endorse or promote products derived from
16 # this software without specific prior written permission.
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 # Generate IDL bindings, together with auxiliary files
32 # (constructors on global objects, aggregate bindings files).
34 # Design doc: http://www.chromium.org/developers/design-documents/idl-build
40 '../modules/modules.gypi',
44 # IDL file lists; see: http://www.chromium.org/developers/web-idl-interfaces
46 # Interface IDL files / Dependency IDL files
47 # Interface IDL files: generate individual bindings (includes testing)
48 'interface_idl_files': [
49 '<@(static_interface_idl_files)',
50 '<@(generated_interface_idl_files)',
52 # Dependency IDL files: don't generate individual bindings, but do process
53 # in IDL dependency computation, and count as build dependencies
54 'dependency_idl_files': [
55 '<@(static_dependency_idl_files)',
56 '<@(generated_dependency_idl_files)',
58 # Main interface IDL files (excluding dependencies and testing)
59 # are included as properties on global objects, and in aggregate bindings
60 'main_interface_idl_files': [
62 '<@(modules_idl_files)',
64 # Write lists of main IDL files to a file, so that the command lines don't
65 # exceed OS length limits.
66 'main_interface_idl_files_list': '<|(main_interface_idl_files_list.tmp <@(main_interface_idl_files))',
67 'core_idl_files_list': '<|(core_idl_files_list.tmp <@(core_idl_files))',
68 'modules_idl_files_list': '<|(modules_idl_files_list.tmp <@(modules_idl_files))',
70 # Static IDL files / Generated IDL files
71 # Paths need to be passed separately for static and generated files, as
72 # static files are listed in a temporary file (b/c too long for command
73 # line), but generated files must be passed at the command line, as their
74 # paths are not fixed at GYP time, when the temporary file is generated,
75 # because their paths depend on the build directory, which varies.
77 '<@(static_interface_idl_files)',
78 '<@(static_dependency_idl_files)',
80 'static_idl_files_list': '<|(static_idl_files_list.tmp <@(static_idl_files))',
81 'generated_idl_files': [
82 '<@(generated_interface_idl_files)',
83 '<@(generated_dependency_idl_files)',
87 'static_interface_idl_files': [
89 '<@(webcore_testing_idl_files)',
90 '<@(modules_idl_files)',
92 'static_dependency_idl_files': [
93 '<@(core_dependency_idl_files)',
94 '<@(modules_dependency_idl_files)',
95 '<@(modules_testing_dependency_idl_files)',
99 'generated_interface_idl_files': [
100 '<@(generated_webcore_testing_idl_files)', # interfaces
102 'generated_dependency_idl_files': [
103 '<@(generated_global_constructors_idl_files)', # partial interfaces
106 'generated_global_constructors_idl_files': [
107 '<(blink_output_dir)/WindowConstructors.idl',
108 '<(blink_output_dir)/SharedWorkerGlobalScopeConstructors.idl',
109 '<(blink_output_dir)/DedicatedWorkerGlobalScopeConstructors.idl',
110 '<(blink_output_dir)/ServiceWorkerGlobalScopeConstructors.idl',
113 'generated_global_constructors_header_files': [
114 '<(blink_output_dir)/WindowConstructors.h',
115 '<(blink_output_dir)/SharedWorkerGlobalScopeConstructors.h',
116 '<(blink_output_dir)/DedicatedWorkerGlobalScopeConstructors.h',
117 '<(blink_output_dir)/ServiceWorkerGlobalScopeConstructors.h',
122 'jinja_module_files': [
123 # jinja2/__init__.py contains version string, so sufficient for package
124 '<(DEPTH)/third_party/jinja2/__init__.py',
125 '<(DEPTH)/third_party/markupsafe/__init__.py', # jinja2 dep
127 'idl_lexer_parser_files': [
128 # PLY (Python Lex-Yacc)
129 '<(DEPTH)/third_party/ply/lex.py',
130 '<(DEPTH)/third_party/ply/yacc.py',
131 # Web IDL lexer/parser (base parser)
132 '<(DEPTH)/tools/idl_parser/idl_lexer.py',
133 '<(DEPTH)/tools/idl_parser/idl_node.py',
134 '<(DEPTH)/tools/idl_parser/idl_parser.py',
135 # Blink IDL lexer/parser/constructor
136 'scripts/blink_idl_lexer.py',
137 'scripts/blink_idl_parser.py',
139 'idl_compiler_files': [
140 'scripts/idl_compiler.py',
141 # Blink IDL front end (ex-lexer/parser)
142 'scripts/idl_definitions.py',
143 'scripts/idl_reader.py',
144 'scripts/idl_validator.py',
145 'scripts/interface_dependency_resolver.py',
147 'scripts/code_generator_v8.py',
148 'scripts/v8_attributes.py',
149 'scripts/v8_callback_interface.py',
150 'scripts/v8_globals.py',
151 'scripts/v8_interface.py',
152 'scripts/v8_methods.py',
153 'scripts/v8_types.py',
154 'scripts/v8_utilities.py',
158 'code_generator_template_files': [
159 'templates/attributes.cpp',
160 'templates/callback_interface.cpp',
161 'templates/callback_interface.h',
162 'templates/interface_base.cpp',
163 'templates/interface.cpp',
164 'templates/interface.h',
165 'templates/methods.cpp',
170 ################################################################################
172 'target_name': 'global_constructors_idls',
175 'action_name': 'generate_global_constructors_idls',
177 'scripts/generate_global_constructors.py',
178 'scripts/utilities.py',
179 # Only includes main IDL files (exclude dependencies and testing,
180 # which should not appear on global objects).
181 '<(main_interface_idl_files_list)',
182 '<@(main_interface_idl_files)',
185 '<@(generated_global_constructors_idl_files)',
186 '<@(generated_global_constructors_header_files)',
190 'scripts/generate_global_constructors.py',
192 '<(main_interface_idl_files_list)',
193 '--write-file-only-if-changed',
194 '<(write_file_only_if_changed)',
197 '<(blink_output_dir)/WindowConstructors.idl',
198 'SharedWorkerGlobalScope',
199 '<(blink_output_dir)/SharedWorkerGlobalScopeConstructors.idl',
200 'DedicatedWorkerGlobalScope',
201 '<(blink_output_dir)/DedicatedWorkerGlobalScopeConstructors.idl',
202 'ServiceWorkerGlobalScope',
203 '<(blink_output_dir)/ServiceWorkerGlobalScopeConstructors.idl',
205 'message': 'Generating IDL files for constructors on global objects',
208 ################################################################################
210 'target_name': 'interfaces_info',
214 'global_constructors_idls',
215 '../core/core_generated.gyp:generated_testing_idls',
218 'action_name': 'compute_interfaces_info',
220 'scripts/compute_interfaces_info.py',
221 'scripts/utilities.py',
222 '<(static_idl_files_list)',
223 '<@(static_idl_files)',
224 '<@(generated_idl_files)',
227 '<(blink_output_dir)/InterfacesInfo.pickle',
231 'scripts/compute_interfaces_info.py',
233 '<(static_idl_files_list)',
234 '--interfaces-info-file',
235 '<(blink_output_dir)/InterfacesInfo.pickle',
236 '--write-file-only-if-changed',
237 '<(write_file_only_if_changed)',
239 # Generated files must be passed at command line
240 '<@(generated_idl_files)',
242 'message': 'Computing global information about IDL files',
245 ################################################################################
247 # A separate pre-caching step is *not required* to use lex/parse table
248 # caching in PLY, as the caches are concurrency-safe.
249 # However, pre-caching ensures that all compiler processes use the cached
250 # files (hence maximizing speed), instead of early processes building the
251 # tables themselves (as they've not yet been written when they start).
252 'target_name': 'cached_lex_yacc_tables',
255 'action_name': 'cache_lex_yacc_tables',
257 '<@(idl_lexer_parser_files)',
260 '<(bindings_output_dir)/lextab.py',
261 '<(bindings_output_dir)/parsetab.pickle',
265 'scripts/blink_idl_parser.py',
266 '<(bindings_output_dir)',
268 'message': 'Caching PLY lex & yacc lex/parse tables',
271 ################################################################################
273 # A separate pre-caching step is *required* to use bytecode caching in
274 # Jinja (which improves speed significantly), as the bytecode cache is
275 # not concurrency-safe on write; details in code_generator_v8.py.
276 'target_name': 'cached_jinja_templates',
279 'action_name': 'cache_jinja_templates',
281 '<@(jinja_module_files)',
282 'scripts/code_generator_v8.py',
283 '<@(code_generator_template_files)',
286 '<(bindings_output_dir)/cached_jinja_templates.stamp', # Dummy to track dependency
290 'scripts/code_generator_v8.py',
291 '<(bindings_output_dir)',
292 '<(bindings_output_dir)/cached_jinja_templates.stamp',
294 'message': 'Caching bytecode of Jinja templates',
297 ################################################################################
299 'target_name': 'individual_generated_bindings',
301 # The 'binding' rule generates .h files, so mark as hard_dependency, per:
302 # https://code.google.com/p/gyp/wiki/InputFormatReference#Linking_Dependencies
303 'hard_dependency': 1,
306 'cached_lex_yacc_tables',
307 'cached_jinja_templates',
308 '../core/core_generated.gyp:generated_testing_idls',
311 '<@(interface_idl_files)',
314 'rule_name': 'binding',
316 'msvs_external_rule': 1,
318 '<@(idl_lexer_parser_files)', # to be explicit (covered by parsetab)
319 '<@(idl_compiler_files)',
320 '<(bindings_output_dir)/lextab.py',
321 '<(bindings_output_dir)/parsetab.pickle',
322 '<(bindings_output_dir)/cached_jinja_templates.stamp',
323 'IDLExtendedAttributes.txt',
324 # If the dependency structure or public interface info (e.g.,
325 # [ImplementedAs]) changes, we rebuild all files, since we're not
326 # computing dependencies file-by-file in the build.
327 # This data is generally stable.
328 '<(blink_output_dir)/InterfacesInfo.pickle',
329 # Further, if any dependency (partial interface or implemented
330 # interface) changes, rebuild everything, since every IDL potentially
331 # depends on them, because we're not computing dependencies
333 # FIXME: This is too conservative, and causes excess rebuilds:
334 # compute this file-by-file. http://crbug.com/341748
335 '<@(dependency_idl_files)',
338 '<(bindings_output_dir)/V8<(RULE_INPUT_ROOT).cpp',
339 '<(bindings_output_dir)/V8<(RULE_INPUT_ROOT).h',
341 # sanitize-win-build-log.sed uses a regex which matches this command
342 # line (Python script + .idl file being processed).
343 # Update that regex if command line changes (other than changing flags)
346 '-S', # skip 'import site' to speed up startup
347 'scripts/idl_compiler.py',
349 '<(bindings_output_dir)',
351 '<(blink_output_dir)/InterfacesInfo.pickle',
352 '--write-file-only-if-changed',
353 '<(write_file_only_if_changed)',
354 '<(RULE_INPUT_PATH)',
356 'message': 'Generating binding from <(RULE_INPUT_PATH)',
359 ################################################################################
361 'target_name': 'bindings_core_generated_aggregate',
364 'action_name': 'generate_aggregate_bindings_core',
366 'scripts/aggregate_generated_bindings.py',
367 '<(core_idl_files_list)',
370 '<@(bindings_core_generated_aggregate_files)',
374 'scripts/aggregate_generated_bindings.py',
375 '<(core_idl_files_list)',
377 '<@(bindings_core_generated_aggregate_files)',
379 'message': 'Generating aggregate generated core bindings files',
382 ################################################################################
384 'target_name': 'bindings_modules_generated_aggregate',
387 'action_name': 'generate_aggregate_bindings_modules',
389 'scripts/aggregate_generated_bindings.py',
390 '<(modules_idl_files_list)',
393 '<@(bindings_modules_generated_aggregate_files)',
397 'scripts/aggregate_generated_bindings.py',
398 '<(modules_idl_files_list)',
400 '<@(bindings_modules_generated_aggregate_files)',
402 'message': 'Generating aggregate generated modules bindings files',
405 ################################################################################
407 'target_name': 'generated_bindings',
410 'bindings_core_generated_aggregate',
411 'bindings_modules_generated_aggregate',
412 'individual_generated_bindings',
415 ################################################################################