Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import("//third_party/WebKit/Source/bindings/bindings.gni") | 5 import("//third_party/WebKit/Source/bindings/bindings.gni") |
| 6 import("//third_party/WebKit/Source/build/scripts/scripts.gni") | 6 import("//third_party/WebKit/Source/build/scripts/scripts.gni") |
| 7 import("//third_party/WebKit/Source/core/core.gni") | 7 import("//third_party/WebKit/Source/core/core.gni") |
| 8 import("//third_party/WebKit/Source/modules/modules.gni") | 8 import("//third_party/WebKit/Source/modules/modules.gni") |
| 9 | 9 |
| 10 # Make these lists relative to the current directory (they're currently | |
| 11 # relative to the source root). | |
| 12 rel_core_idl_files = rebase_path(core_idl_files, ".", "//") | |
| 13 rel_modules_idl_files = rebase_path(modules_idl_files, ".", "//") | |
| 14 | |
| 15 # Write lists of main IDL files to a file, so that the command lines don't | |
| 16 # exceed OS length limits. | |
| 17 core_idl_files_list = "$target_gen_dir/core_idl_files.tmp" | |
| 18 write_file(core_idl_files_list, | |
| 19 rebase_path(rel_core_idl_files, root_build_dir)) | |
| 20 | |
| 21 modules_idl_files_list = "$target_gen_dir/module_idl_files.tmp" | |
| 22 write_file(modules_idl_files_list, | |
| 23 rebase_path(rel_modules_idl_files, root_build_dir)) | |
| 24 | |
| 25 # Main interface IDL files (excluding dependencies and testing) | 10 # Main interface IDL files (excluding dependencies and testing) |
| 26 # are included as properties on global objects, and in aggregate bindings. | 11 # are included as properties on global objects, and in aggregate bindings. |
| 27 # Relative to the root build dir. | 12 main_interface_idl_files = core_idl_files + modules_idl_files |
| 28 rel_main_interface_idl_files = rel_core_idl_files + rel_modules_idl_files | |
| 29 | 13 |
| 30 main_interface_idl_files_list = "$target_gen_dir/main_interface_idl_files.tmp" | 14 main_interface_idl_files_list = "$target_gen_dir/main_interface_idl_files.tmp" |
| 31 write_file(main_interface_idl_files_list, | 15 write_file(main_interface_idl_files_list, |
| 32 rebase_path(rel_main_interface_idl_files, root_build_dir)) | 16 rebase_path(main_interface_idl_files, root_build_dir)) |
| 33 | |
| 34 # Static IDL files / Generated IDL files | |
| 35 # In GYP, paths need to be passed separately for static and generated files, as | |
| 36 # static files are listed in a temporary file (b/c too long for command line), | |
| 37 # but generated files must be passed at the command line, as their paths are | |
| 38 # not fixed at GYP time, when the temporary file is generated, because their | |
| 39 # paths depend on the build directory, which varies. In GN, the build directory | |
| 40 # *is* known at runtime, but we currently mimic the GYP build. | |
| 41 static_interface_idl_files = | |
| 42 rel_core_idl_files + | |
| 43 rebase_path(webcore_testing_idl_files, ".", "//") + | |
| 44 rel_modules_idl_files | |
| 45 static_dependency_idl_files = | |
| 46 rebase_path(core_dependency_idl_files, ".", "//") + | |
| 47 rebase_path(modules_dependency_idl_files, ".", "//") + | |
| 48 rebase_path(modules_testing_dependency_idl_files, ".", "//") | |
| 49 static_idl_files = static_interface_idl_files + static_dependency_idl_files | |
| 50 static_idl_files_list = "$target_gen_dir/static_idl_files.tmp" | |
| 51 write_file(static_idl_files_list, | |
| 52 rebase_path(static_idl_files, root_build_dir)) | |
| 53 | 17 |
| 54 generated_global_constructors_idl_files = [ | 18 generated_global_constructors_idl_files = [ |
| 55 "$blink_output_dir/WindowConstructors.idl", | 19 "$blink_output_dir/WindowConstructors.idl", |
| 56 "$blink_output_dir/SharedWorkerGlobalScopeConstructors.idl", | 20 "$blink_output_dir/SharedWorkerGlobalScopeConstructors.idl", |
| 57 "$blink_output_dir/DedicatedWorkerGlobalScopeConstructors.idl", | 21 "$blink_output_dir/DedicatedWorkerGlobalScopeConstructors.idl", |
| 58 "$blink_output_dir/ServiceWorkerGlobalScopeConstructors.idl", | 22 "$blink_output_dir/ServiceWorkerGlobalScopeConstructors.idl", |
| 59 ] | 23 ] |
| 60 generated_global_constructors_header_files = [ | 24 generated_global_constructors_header_files = [ |
| 61 "$blink_output_dir/WindowConstructors.h", | 25 "$blink_output_dir/WindowConstructors.h", |
| 62 "$blink_output_dir/SharedWorkerGlobalScopeConstructors.h", | 26 "$blink_output_dir/SharedWorkerGlobalScopeConstructors.h", |
| 63 "$blink_output_dir/DedicatedWorkerGlobalScopeConstructors.h", | 27 "$blink_output_dir/DedicatedWorkerGlobalScopeConstructors.h", |
| 64 "$blink_output_dir/ServiceWorkerGlobalScopeConstructors.h", | 28 "$blink_output_dir/ServiceWorkerGlobalScopeConstructors.h", |
| 65 ] | 29 ] |
| 66 # Interfaces (files relative to current directory). | |
| 67 generated_interface_idl_files = | |
| 68 rebase_path(generated_webcore_testing_idl_files, ".", "//") | |
| 69 # Partial interfaces: | |
| 70 generated_dependency_idl_files = generated_global_constructors_idl_files | |
| 71 generated_idl_files = | |
| 72 generated_interface_idl_files + generated_dependency_idl_files | |
| 73 | 30 |
| 74 interface_idl_files = static_interface_idl_files + generated_interface_idl_files | 31 # FIXME: Generate separate core_global_objects |
| 75 dependency_idl_files = | 32 # http://crbug.com/358074 |
| 76 static_dependency_idl_files + generated_dependency_idl_files | 33 # GYP version: generated.gyp:global_objects |
| 34 action("global_objects") { | |
| 35 script = "scripts/compute_global_objects.py" | |
| 77 | 36 |
| 78 # Python source | 37 source_prereqs = [ |
| 79 jinja_module_files = [ | 38 "scripts/utilities.py", |
| 80 # jinja2/__init__.py contains version string, so sufficient for package | 39 # Only look in main IDL files (exclude dependencies and testing, |
| 81 "//third_party/jinja2/__init__.py", | 40 # which should not define global objects). |
| 82 "//third_party/markupsafe/__init__.py", # jinja2 dep | 41 main_interface_idl_files_list, |
| 83 ] | 42 ] + main_interface_idl_files |
| 84 | 43 |
| 85 idl_lexer_parser_files = [ | 44 outputs = [ |
| 86 # PLY (Python Lex-Yacc) | 45 "$bindings_output_dir/GlobalObjects.pickle", |
| 87 "//third_party/ply/lex.py", | 46 ] |
| 88 "//third_party/ply/yacc.py", | |
| 89 # Web IDL lexer/parser (base parser) | |
| 90 "//tools/idl_parser/idl_lexer.py", | |
| 91 "//tools/idl_parser/idl_node.py", | |
| 92 "//tools/idl_parser/idl_parser.py", | |
| 93 # Blink IDL lexer/parser/constructor | |
| 94 "scripts/blink_idl_lexer.py", | |
| 95 "scripts/blink_idl_parser.py", | |
| 96 ] | |
| 97 | 47 |
| 98 idl_compiler_files = [ | 48 args = [ |
| 99 "scripts/idl_compiler.py", | 49 "--idl-files-list", |
| 100 # Blink IDL front end (ex-lexer/parser) | 50 rebase_path(main_interface_idl_files_list, root_build_dir), |
| 101 "scripts/idl_definitions.py", | 51 "--write-file-only-if-changed=1", # Always true for Ninja. |
|
Nils Barth (inactive)
2014/06/10 08:44:17
Could you add a FIXME to remove this cruft once sw
| |
| 102 "scripts/idl_reader.py", | 52 "--", |
| 103 "scripts/idl_validator.py", | 53 rebase_path("$bindings_output_dir/GlobalObjects.pickle", root_build_dir), |
| 104 "scripts/interface_dependency_resolver.py", | 54 ] |
| 105 # V8 code generator | 55 } |
| 106 "scripts/code_generator_v8.py", | |
| 107 "scripts/v8_attributes.py", | |
| 108 "scripts/v8_callback_interface.py", | |
| 109 "scripts/v8_globals.py", | |
| 110 "scripts/v8_interface.py", | |
| 111 "scripts/v8_methods.py", | |
| 112 "scripts/v8_types.py", | |
| 113 "scripts/v8_utilities.py", | |
| 114 ] | |
| 115 | 56 |
| 116 # Jinja templates | 57 # GYP version: generated.gyp:global_constructors_idls |
| 117 code_generator_template_files = [ | |
| 118 "templates/attributes.cpp", | |
| 119 "templates/callback_interface.cpp", | |
| 120 "templates/callback_interface.h", | |
| 121 "templates/interface_base.cpp", | |
| 122 "templates/interface.cpp", | |
| 123 "templates/interface.h", | |
| 124 "templates/methods.cpp", | |
| 125 ] | |
| 126 | |
| 127 action("global_constructors_idls") { | 58 action("global_constructors_idls") { |
| 128 script = "scripts/generate_global_constructors.py" | 59 script = "scripts/generate_global_constructors.py" |
| 129 | 60 |
| 130 source_prereqs = [ | 61 source_prereqs = [ |
| 131 "scripts/generate_global_constructors.py", | 62 "scripts/generate_global_constructors.py", |
| 132 "scripts/utilities.py", | 63 "scripts/utilities.py", |
| 64 "$bindings_output_dir/GlobalObjects.pickle", | |
| 133 # Only includes main IDL files (exclude dependencies and testing, | 65 # Only includes main IDL files (exclude dependencies and testing, |
| 134 # which should not appear on global objects). | 66 # which should not appear on global objects). |
| 135 main_interface_idl_files_list, | 67 main_interface_idl_files_list, |
| 136 ] + rel_main_interface_idl_files | 68 ] + main_interface_idl_files |
| 137 | 69 |
| 138 outputs = generated_global_constructors_idl_files + | 70 outputs = generated_global_constructors_idl_files + |
| 139 generated_global_constructors_header_files | 71 generated_global_constructors_header_files |
| 140 | 72 |
| 141 args = [ | 73 args = [ |
| 142 "--idl-files-list", | 74 "--idl-files-list", |
| 143 rebase_path(main_interface_idl_files_list, root_build_dir), | 75 rebase_path(main_interface_idl_files_list, root_build_dir), |
| 76 "--global-objects-file", | |
| 77 rebase_path("$bindings_output_dir/GlobalObjects.pickle", root_build_dir), | |
| 144 "--write-file-only-if-changed=1", # Always true for Ninja. | 78 "--write-file-only-if-changed=1", # Always true for Ninja. |
| 145 "--", | 79 "--", |
| 146 "Window", | 80 "Window", |
| 147 rebase_path("$blink_output_dir/WindowConstructors.idl", root_build_dir), | 81 rebase_path("$blink_output_dir/WindowConstructors.idl", root_build_dir), |
| 148 "SharedWorkerGlobalScope", | 82 "SharedWorkerGlobalScope", |
| 149 rebase_path("$blink_output_dir/SharedWorkerGlobalScopeConstructors.idl", | 83 rebase_path("$blink_output_dir/SharedWorkerGlobalScopeConstructors.idl", |
| 150 root_build_dir), | 84 root_build_dir), |
| 151 "DedicatedWorkerGlobalScope", | 85 "DedicatedWorkerGlobalScope", |
| 152 rebase_path("$blink_output_dir/DedicatedWorkerGlobalScopeConstructors.idl", | 86 rebase_path("$blink_output_dir/DedicatedWorkerGlobalScopeConstructors.idl", |
| 153 root_build_dir), | 87 root_build_dir), |
| 154 "ServiceWorkerGlobalScope", | 88 "ServiceWorkerGlobalScope", |
| 155 rebase_path("$blink_output_dir/ServiceWorkerGlobalScopeConstructors.idl", | 89 rebase_path("$blink_output_dir/ServiceWorkerGlobalScopeConstructors.idl", |
| 156 root_build_dir), | 90 root_build_dir), |
| 157 ] | 91 ] |
| 92 | |
| 93 deps = [ ":global_objects" ] | |
| 158 } | 94 } |
| 159 | 95 |
| 160 action("interfaces_info") { | 96 # GYP version: generated.gyp:generated_idls |
| 161 script = "scripts/compute_interfaces_info.py" | 97 group("generated_idls") { |
| 162 | |
| 163 pickle_file = "$blink_output_dir/InterfacesInfo.pickle" | |
| 164 source_prereqs = [ | |
| 165 "scripts/utilities.py", | |
| 166 static_idl_files_list, | |
| 167 ] | |
| 168 source_prereqs += static_idl_files | |
| 169 source_prereqs += generated_idl_files | |
| 170 outputs = [ pickle_file ] | |
| 171 | |
| 172 args = [ | |
| 173 "--idl-files-list", rebase_path(static_idl_files_list, root_build_dir), | |
| 174 "--interfaces-info-file", rebase_path(pickle_file, root_build_dir), | |
| 175 # Always true for Ninja. Remove flag when GYP support no longer needed. | |
| 176 "--write-file-only-if-changed=1", | |
| 177 "--" | |
| 178 ] | |
| 179 # Generated files are passed at command line. | |
| 180 # TODO: This can be merged with the file list when GYP support is no longer | |
| 181 # needed. The reason that this happens in GYP is that the output directory | |
| 182 # is not know (might be Debug or Release) but in GN it is known. | |
| 183 args += rebase_path(generated_idl_files, root_build_dir) | |
| 184 | |
| 185 deps = [ | 98 deps = [ |
| 186 ":global_constructors_idls", | 99 ":global_constructors_idls", |
| 187 "//third_party/WebKit/Source/core:generated_testing_idls", | 100 "//third_party/WebKit/Source/core:generated_testing_idls", |
| 188 ] | 101 ] |
| 189 } | 102 } |
| 190 | |
| 191 # A separate pre-caching step is *not required* to use lex/parse table | |
| 192 # caching in PLY, as the caches are concurrency-safe. | |
| 193 # However, pre-caching ensures that all compiler processes use the cached | |
| 194 # files (hence maximizing speed), instead of early processes building the | |
| 195 # tables themselves (as they've not yet been written when they start). | |
| 196 action("cached_lex_yacc_tables") { | |
| 197 script = "scripts/blink_idl_parser.py" | |
| 198 | |
| 199 source_prereqs = idl_lexer_parser_files | |
| 200 outputs = [ | |
| 201 "$bindings_output_dir/lextab.py", | |
| 202 "$bindings_output_dir/parsetab.pickle", | |
| 203 ] | |
| 204 | |
| 205 args = [ rebase_path(bindings_output_dir, root_build_dir) ] | |
| 206 } | |
| 207 | |
| 208 action("cached_jinja_templates") { | |
| 209 script = "scripts/code_generator_v8.py" | |
| 210 | |
| 211 source_prereqs = jinja_module_files + [ "scripts/code_generator_v8.py" ] + | |
| 212 code_generator_template_files | |
| 213 # Dummy file to track dependency. | |
| 214 stamp_file = "$bindings_output_dir/cached_jinja_templates.stamp" | |
| 215 outputs = [ stamp_file ] | |
| 216 | |
| 217 args = [ | |
| 218 rebase_path(bindings_output_dir, root_build_dir), | |
| 219 rebase_path(stamp_file, root_build_dir), | |
| 220 ] | |
| 221 } | |
| 222 | |
| 223 action_foreach("individual_generated_bindings") { | |
| 224 # TODO(brettw) GYP adds a "-S before the script name to skip "import site" to | |
| 225 # speed up startup. Figure out if we need this and do something similar (not | |
| 226 # really expressible in GN now). | |
| 227 script = "scripts/idl_compiler.py" | |
| 228 | |
| 229 source_prereqs = | |
| 230 idl_lexer_parser_files + # to be explicit (covered by parsetab) | |
| 231 idl_compiler_files | |
| 232 source_prereqs += [ | |
| 233 "$bindings_output_dir/lextab.py", | |
| 234 "$bindings_output_dir/parsetab.pickle", | |
| 235 "$bindings_output_dir/cached_jinja_templates.stamp", | |
| 236 "IDLExtendedAttributes.txt", | |
| 237 # If the dependency structure or public interface info (e.g., | |
| 238 # [ImplementedAs]) changes, we rebuild all files, since we're not | |
| 239 # computing dependencies file-by-file in the build. | |
| 240 # This data is generally stable. | |
| 241 "$blink_output_dir/InterfacesInfo.pickle", | |
| 242 ] | |
| 243 # Further, if any dependency (partial interface or implemented | |
| 244 # interface) changes, rebuild everything, since every IDL potentially | |
| 245 # depends on them, because we're not computing dependencies | |
| 246 # file-by-file. | |
| 247 # FIXME: This is too conservative, and causes excess rebuilds: | |
| 248 # compute this file-by-file. http://crbug.com/341748 | |
| 249 source_prereqs += dependency_idl_files | |
| 250 | |
| 251 sources = interface_idl_files | |
| 252 outputs = [ | |
| 253 "$bindings_output_dir/V8{{source_name_part}}.cpp", | |
| 254 "$bindings_output_dir/V8{{source_name_part}}.h", | |
| 255 ] | |
| 256 | |
| 257 args = [ | |
| 258 "--output-dir", | |
| 259 rebase_path(bindings_output_dir, root_build_dir), | |
| 260 "--interfaces-info", | |
| 261 rebase_path("$blink_output_dir/InterfacesInfo.pickle", root_build_dir), | |
| 262 "--write-file-only-if-changed=1", # Always true for Ninja. | |
| 263 "{{source}}", | |
| 264 ] | |
| 265 | |
| 266 deps = [ | |
| 267 ":interfaces_info", | |
| 268 ":cached_lex_yacc_tables", | |
| 269 ":cached_jinja_templates", | |
| 270 "//third_party/WebKit/Source/core:generated_testing_idls", | |
| 271 ] | |
| 272 } | |
| 273 | |
| 274 action("bindings_core_generated_aggregate") { | |
| 275 script = "scripts/aggregate_generated_bindings.py" | |
| 276 | |
| 277 source_prereqs = [ core_idl_files_list ] + rel_core_idl_files | |
| 278 outputs = bindings_core_generated_aggregate_files | |
| 279 | |
| 280 args = [ rebase_path(core_idl_files_list, root_build_dir) ] | |
| 281 args += [ "--" ] | |
| 282 args += rebase_path(bindings_core_generated_aggregate_files, root_build_dir) | |
| 283 } | |
| 284 | |
| 285 action("bindings_modules_generated_aggregate") { | |
| 286 script = "scripts/aggregate_generated_bindings.py" | |
| 287 | |
| 288 source_prereqs = [ modules_idl_files_list ] + rel_modules_idl_files | |
| 289 outputs = bindings_modules_generated_aggregate_files | |
| 290 | |
| 291 args = [ rebase_path(modules_idl_files_list, root_build_dir) ] | |
| 292 args += [ "--" ] | |
| 293 args += rebase_path(bindings_modules_generated_aggregate_files, | |
| 294 root_build_dir) | |
| 295 } | |
| 296 | |
| 297 # Corresponds to GYP's generated_bindings.gyp:generated_bindings. | |
| 298 group("bindings") { | |
| 299 deps = [ | |
| 300 ":bindings_core_generated_aggregate", | |
| 301 ":bindings_modules_generated_aggregate", | |
| 302 ":individual_generated_bindings", | |
| 303 ] | |
| 304 } | |
| 305 | |
| 306 # "event_interfaces" action in core_bindings_generated.gyp. | |
| 307 generate_event_interfaces("core_bindings_generated") { | |
| 308 # core_event_idl_files paths are relative to the "core" directory. | |
| 309 sources = rebase_path(core_event_idl_files, ".", "../core") | |
| 310 output_file = "EventInterfaces.in" | |
| 311 } | |
| OLD | NEW |