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