| OLD | NEW |
| (Empty) |
| 1 # | |
| 2 # Copyright (C) 2013 Google Inc. All rights reserved. | |
| 3 # | |
| 4 # Redistribution and use in source and binary forms, with or without | |
| 5 # modification, are permitted provided that the following conditions are | |
| 6 # met: | |
| 7 # | |
| 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 | |
| 13 # distribution. | |
| 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. | |
| 17 # | |
| 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. | |
| 29 # | |
| 30 | |
| 31 # Generate IDL bindings, together with auxiliary files | |
| 32 # (constructors on global objects, aggregate bindings files). | |
| 33 # | |
| 34 # Design doc: http://www.chromium.org/developers/design-documents/idl-build | |
| 35 | |
| 36 { | |
| 37 'includes': [ | |
| 38 'bindings.gypi', | |
| 39 '../core/core.gypi', | |
| 40 '../modules/modules.gypi', | |
| 41 ], | |
| 42 | |
| 43 'variables': { | |
| 44 # IDL file lists; see: http://www.chromium.org/developers/web-idl-interfaces | |
| 45 # | |
| 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)', | |
| 51 ], | |
| 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)', | |
| 57 ], | |
| 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': [ | |
| 61 '<@(core_idl_files)', | |
| 62 '<@(modules_idl_files)', | |
| 63 ], | |
| 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 <@(ma
in_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_file
s))', | |
| 69 | |
| 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. | |
| 76 'static_idl_files': [ | |
| 77 '<@(static_interface_idl_files)', | |
| 78 '<@(static_dependency_idl_files)', | |
| 79 ], | |
| 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)', | |
| 84 ], | |
| 85 | |
| 86 # Static IDL files | |
| 87 'static_interface_idl_files': [ | |
| 88 '<@(core_idl_files)', | |
| 89 '<@(webcore_testing_idl_files)', | |
| 90 '<@(modules_idl_files)', | |
| 91 ], | |
| 92 'static_dependency_idl_files': [ | |
| 93 '<@(core_dependency_idl_files)', | |
| 94 '<@(modules_dependency_idl_files)', | |
| 95 '<@(modules_testing_dependency_idl_files)', | |
| 96 ], | |
| 97 | |
| 98 # Generated IDL files | |
| 99 'generated_interface_idl_files': [ | |
| 100 '<@(generated_webcore_testing_idl_files)', # interfaces | |
| 101 ], | |
| 102 'generated_dependency_idl_files': [ | |
| 103 '<@(generated_global_constructors_idl_files)', # partial interfaces | |
| 104 ], | |
| 105 | |
| 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', | |
| 111 ], | |
| 112 | |
| 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', | |
| 118 ], | |
| 119 | |
| 120 | |
| 121 # Python source | |
| 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 | |
| 126 ], | |
| 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', | |
| 138 ], | |
| 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', | |
| 146 # V8 code generator | |
| 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', | |
| 155 ], | |
| 156 | |
| 157 # Jinja templates | |
| 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', | |
| 166 ], | |
| 167 }, | |
| 168 | |
| 169 'targets': [ | |
| 170 ################################################################################ | |
| 171 { | |
| 172 'target_name': 'global_constructors_idls', | |
| 173 'type': 'none', | |
| 174 'actions': [{ | |
| 175 'action_name': 'generate_global_constructors_idls', | |
| 176 'inputs': [ | |
| 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)', | |
| 183 ], | |
| 184 'outputs': [ | |
| 185 '<@(generated_global_constructors_idl_files)', | |
| 186 '<@(generated_global_constructors_header_files)', | |
| 187 ], | |
| 188 'action': [ | |
| 189 'python', | |
| 190 'scripts/generate_global_constructors.py', | |
| 191 '--idl-files-list', | |
| 192 '<(main_interface_idl_files_list)', | |
| 193 '--write-file-only-if-changed', | |
| 194 '<(write_file_only_if_changed)', | |
| 195 '--', | |
| 196 'Window', | |
| 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', | |
| 204 ], | |
| 205 'message': 'Generating IDL files for constructors on global objects', | |
| 206 }] | |
| 207 }, | |
| 208 ################################################################################ | |
| 209 { | |
| 210 'target_name': 'interfaces_info', | |
| 211 'type': 'none', | |
| 212 'dependencies': [ | |
| 213 # Generated IDLs | |
| 214 'global_constructors_idls', | |
| 215 '../core/core_generated.gyp:generated_testing_idls', | |
| 216 ], | |
| 217 'actions': [{ | |
| 218 'action_name': 'compute_interfaces_info', | |
| 219 'inputs': [ | |
| 220 'scripts/compute_interfaces_info.py', | |
| 221 'scripts/utilities.py', | |
| 222 '<(static_idl_files_list)', | |
| 223 '<@(static_idl_files)', | |
| 224 '<@(generated_idl_files)', | |
| 225 ], | |
| 226 'outputs': [ | |
| 227 '<(blink_output_dir)/InterfacesInfo.pickle', | |
| 228 ], | |
| 229 'action': [ | |
| 230 'python', | |
| 231 'scripts/compute_interfaces_info.py', | |
| 232 '--idl-files-list', | |
| 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)', | |
| 238 '--', | |
| 239 # Generated files must be passed at command line | |
| 240 '<@(generated_idl_files)', | |
| 241 ], | |
| 242 'message': 'Computing global information about IDL files', | |
| 243 }] | |
| 244 }, | |
| 245 ################################################################################ | |
| 246 { | |
| 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', | |
| 253 'type': 'none', | |
| 254 'actions': [{ | |
| 255 'action_name': 'cache_lex_yacc_tables', | |
| 256 'inputs': [ | |
| 257 '<@(idl_lexer_parser_files)', | |
| 258 ], | |
| 259 'outputs': [ | |
| 260 '<(bindings_output_dir)/lextab.py', | |
| 261 '<(bindings_output_dir)/parsetab.pickle', | |
| 262 ], | |
| 263 'action': [ | |
| 264 'python', | |
| 265 'scripts/blink_idl_parser.py', | |
| 266 '<(bindings_output_dir)', | |
| 267 ], | |
| 268 'message': 'Caching PLY lex & yacc lex/parse tables', | |
| 269 }], | |
| 270 }, | |
| 271 ################################################################################ | |
| 272 { | |
| 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', | |
| 277 'type': 'none', | |
| 278 'actions': [{ | |
| 279 'action_name': 'cache_jinja_templates', | |
| 280 'inputs': [ | |
| 281 '<@(jinja_module_files)', | |
| 282 'scripts/code_generator_v8.py', | |
| 283 '<@(code_generator_template_files)', | |
| 284 ], | |
| 285 'outputs': [ | |
| 286 '<(bindings_output_dir)/cached_jinja_templates.stamp', # Dummy to track
dependency | |
| 287 ], | |
| 288 'action': [ | |
| 289 'python', | |
| 290 'scripts/code_generator_v8.py', | |
| 291 '<(bindings_output_dir)', | |
| 292 '<(bindings_output_dir)/cached_jinja_templates.stamp', | |
| 293 ], | |
| 294 'message': 'Caching bytecode of Jinja templates', | |
| 295 }], | |
| 296 }, | |
| 297 ################################################################################ | |
| 298 { | |
| 299 'target_name': 'individual_generated_bindings', | |
| 300 'type': 'none', | |
| 301 # The 'binding' rule generates .h files, so mark as hard_dependency, per: | |
| 302 # https://code.google.com/p/gyp/wiki/InputFormatReference#Linking_Dependenci
es | |
| 303 'hard_dependency': 1, | |
| 304 'dependencies': [ | |
| 305 'interfaces_info', | |
| 306 'cached_lex_yacc_tables', | |
| 307 'cached_jinja_templates', | |
| 308 '../core/core_generated.gyp:generated_testing_idls', | |
| 309 ], | |
| 310 'sources': [ | |
| 311 '<@(interface_idl_files)', | |
| 312 ], | |
| 313 'rules': [{ | |
| 314 'rule_name': 'binding', | |
| 315 'extension': 'idl', | |
| 316 'msvs_external_rule': 1, | |
| 317 'inputs': [ | |
| 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 | |
| 332 # file-by-file. | |
| 333 # FIXME: This is too conservative, and causes excess rebuilds: | |
| 334 # compute this file-by-file. http://crbug.com/341748 | |
| 335 '<@(dependency_idl_files)', | |
| 336 ], | |
| 337 'outputs': [ | |
| 338 '<(bindings_output_dir)/V8<(RULE_INPUT_ROOT).cpp', | |
| 339 '<(bindings_output_dir)/V8<(RULE_INPUT_ROOT).h', | |
| 340 ], | |
| 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) | |
| 344 'action': [ | |
| 345 'python', | |
| 346 '-S', # skip 'import site' to speed up startup | |
| 347 'scripts/idl_compiler.py', | |
| 348 '--output-dir', | |
| 349 '<(bindings_output_dir)', | |
| 350 '--interfaces-info', | |
| 351 '<(blink_output_dir)/InterfacesInfo.pickle', | |
| 352 '--write-file-only-if-changed', | |
| 353 '<(write_file_only_if_changed)', | |
| 354 '<(RULE_INPUT_PATH)', | |
| 355 ], | |
| 356 'message': 'Generating binding from <(RULE_INPUT_PATH)', | |
| 357 }], | |
| 358 }, | |
| 359 ################################################################################ | |
| 360 { | |
| 361 'target_name': 'bindings_core_generated_aggregate', | |
| 362 'type': 'none', | |
| 363 'actions': [{ | |
| 364 'action_name': 'generate_aggregate_bindings_core', | |
| 365 'inputs': [ | |
| 366 'scripts/aggregate_generated_bindings.py', | |
| 367 '<(core_idl_files_list)', | |
| 368 ], | |
| 369 'outputs': [ | |
| 370 '<@(bindings_core_generated_aggregate_files)', | |
| 371 ], | |
| 372 'action': [ | |
| 373 'python', | |
| 374 'scripts/aggregate_generated_bindings.py', | |
| 375 '<(core_idl_files_list)', | |
| 376 '--', | |
| 377 '<@(bindings_core_generated_aggregate_files)', | |
| 378 ], | |
| 379 'message': 'Generating aggregate generated core bindings files', | |
| 380 }], | |
| 381 }, | |
| 382 ################################################################################ | |
| 383 { | |
| 384 'target_name': 'bindings_modules_generated_aggregate', | |
| 385 'type': 'none', | |
| 386 'actions': [{ | |
| 387 'action_name': 'generate_aggregate_bindings_modules', | |
| 388 'inputs': [ | |
| 389 'scripts/aggregate_generated_bindings.py', | |
| 390 '<(modules_idl_files_list)', | |
| 391 ], | |
| 392 'outputs': [ | |
| 393 '<@(bindings_modules_generated_aggregate_files)', | |
| 394 ], | |
| 395 'action': [ | |
| 396 'python', | |
| 397 'scripts/aggregate_generated_bindings.py', | |
| 398 '<(modules_idl_files_list)', | |
| 399 '--', | |
| 400 '<@(bindings_modules_generated_aggregate_files)', | |
| 401 ], | |
| 402 'message': 'Generating aggregate generated modules bindings files', | |
| 403 }], | |
| 404 }, | |
| 405 ################################################################################ | |
| 406 { | |
| 407 'target_name': 'generated_bindings', | |
| 408 'type': 'none', | |
| 409 'dependencies': [ | |
| 410 'bindings_core_generated_aggregate', | |
| 411 'bindings_modules_generated_aggregate', | |
| 412 'individual_generated_bindings', | |
| 413 ], | |
| 414 }, | |
| 415 ################################################################################ | |
| 416 ], # targets | |
| 417 } | |
| OLD | NEW |