| OLD | NEW |
| (Empty) |
| 1 # Copyright 2015 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("//sky/engine/bindings2/bindings.gni") | |
| 6 import("//sky/engine/core/core.gni") | |
| 7 | |
| 8 source_set("bindings2") { | |
| 9 sources = [ | |
| 10 "builtin.cc", | |
| 11 "builtin.h", | |
| 12 "builtin_natives.cc", | |
| 13 "builtin_natives.h", | |
| 14 "builtin_sky.cc", | |
| 15 "builtin_sky.h", | |
| 16 "dart_callback.cc", | |
| 17 "dart_callback.h", | |
| 18 "dart_event_listener.cc", | |
| 19 "dart_event_listener.h", | |
| 20 "exception_messages.cc", | |
| 21 "exception_messages.h", | |
| 22 "exception_state.cc", | |
| 23 "exception_state.h", | |
| 24 "exception_state_placeholder.cc", | |
| 25 "exception_state_placeholder.h", | |
| 26 "mojo_natives.cc", | |
| 27 "mojo_natives.h", | |
| 28 "nullable.h", | |
| 29 "scheduled_action.cc", | |
| 30 "scheduled_action.h", | |
| 31 ] | |
| 32 deps = [ | |
| 33 "//base", | |
| 34 "//dart/runtime/bin:libdart_withcore", | |
| 35 "//mojo/public/c/system", | |
| 36 "//mojo/public/cpp/system", | |
| 37 "//sky/engine/platform:platform", | |
| 38 "//sky/engine/tonic", | |
| 39 "//sky/engine/wtf", | |
| 40 ":generated_bindings", | |
| 41 ":snapshot_cc", | |
| 42 ] | |
| 43 include_dirs = [ | |
| 44 "..", | |
| 45 "$root_build_dir", | |
| 46 ] | |
| 47 } | |
| 48 | |
| 49 action("generate_snapshot_bin") { | |
| 50 deps = [ | |
| 51 "//dart/runtime/bin:gen_snapshot($host_toolchain)", | |
| 52 ":generate_sky_core_dart", | |
| 53 ] | |
| 54 inputs = [ | |
| 55 "//dart/runtime/tools/create_snapshot_bin.py", | |
| 56 "//sky/engine/bindings2/builtin.dart", | |
| 57 "//mojo/public/dart/bindings.dart", | |
| 58 "//mojo/public/dart/core.dart", | |
| 59 "//mojo/public/dart/src/application.dart", | |
| 60 "//mojo/public/dart/src/buffer.dart", | |
| 61 "//mojo/public/dart/src/codec.dart", | |
| 62 "//mojo/public/dart/src/data_pipe.dart", | |
| 63 "//mojo/public/dart/src/drain_data.dart", | |
| 64 "//mojo/public/dart/src/event_stream.dart", | |
| 65 "//mojo/public/dart/src/handle.dart", | |
| 66 "//mojo/public/dart/src/handle_watcher.dart", | |
| 67 "//mojo/public/dart/src/message.dart", | |
| 68 "//mojo/public/dart/src/message_pipe.dart", | |
| 69 "//mojo/public/dart/src/proxy.dart", | |
| 70 "//mojo/public/dart/src/service_provider.dart", | |
| 71 "//mojo/public/dart/src/struct.dart", | |
| 72 "//mojo/public/dart/src/stub.dart", | |
| 73 "//mojo/public/dart/src/timer_queue.dart", | |
| 74 "//mojo/public/dart/src/types.dart", | |
| 75 "snapshot.dart", | |
| 76 ] | |
| 77 output = "$target_gen_dir/snapshot_gen.bin" | |
| 78 outputs = [ | |
| 79 output, | |
| 80 ] | |
| 81 | |
| 82 builtin_path = rebase_path("//sky/engine/bindings2/builtin.dart") | |
| 83 sky_core_path = rebase_path("$bindings_output_dir/sky_core.dart") | |
| 84 mojo_bindings_path = rebase_path("//mojo/public/dart/bindings.dart") | |
| 85 mojo_core_path = rebase_path("//mojo/public/dart/core.dart") | |
| 86 | |
| 87 gen_snapshot_dir = | |
| 88 get_label_info("//dart/runtime/bin:gen_snapshot($host_toolchain)", | |
| 89 "root_out_dir") | |
| 90 script = "//dart/runtime/tools/create_snapshot_bin.py" | |
| 91 | |
| 92 args = [ | |
| 93 "--executable", | |
| 94 rebase_path("$gen_snapshot_dir/gen_snapshot"), | |
| 95 "--package_root", | |
| 96 rebase_path("$root_gen_dir"), | |
| 97 "--script", | |
| 98 rebase_path("snapshot.dart"), | |
| 99 "--output_bin", | |
| 100 rebase_path(output, root_build_dir), | |
| 101 "--target_os", | |
| 102 os, | |
| 103 "--url_mapping=dart:sky,$sky_core_path", | |
| 104 "--url_mapping=dart:mojo_bindings,$mojo_bindings_path", | |
| 105 "--url_mapping=dart:mojo_core,$mojo_core_path", | |
| 106 "--url_mapping=dart:sky_builtin,$builtin_path", | |
| 107 ] | |
| 108 } | |
| 109 | |
| 110 action("generate_snapshot_file") { | |
| 111 deps = [ | |
| 112 ":generate_snapshot_bin", | |
| 113 ] | |
| 114 inputs = [ | |
| 115 "//dart/runtime/tools/create_snapshot_file.py", | |
| 116 "snapshot.cc.tmpl", | |
| 117 "$target_gen_dir/snapshot_gen.bin", | |
| 118 ] | |
| 119 output = "$target_gen_dir/snapshot.cc" | |
| 120 outputs = [ | |
| 121 output, | |
| 122 ] | |
| 123 | |
| 124 script = "//dart/runtime/tools/create_snapshot_file.py" | |
| 125 args = [ | |
| 126 "--input_bin", | |
| 127 rebase_path("$target_gen_dir/snapshot_gen.bin"), | |
| 128 "--input_cc", | |
| 129 rebase_path("snapshot.cc.tmpl"), | |
| 130 "--output", | |
| 131 rebase_path(output), | |
| 132 ] | |
| 133 } | |
| 134 | |
| 135 source_set("snapshot_cc") { | |
| 136 sources = [ | |
| 137 "$target_gen_dir/snapshot.cc", | |
| 138 ] | |
| 139 | |
| 140 deps = [ | |
| 141 ":generate_snapshot_file", | |
| 142 ] | |
| 143 } | |
| 144 | |
| 145 action("compute_interfaces_info_individual") { | |
| 146 sources = core_idl_files + core_dependency_idl_files | |
| 147 script = "$bindings_scripts_dir/compute_interfaces_info_individual.py" | |
| 148 output_file = "$bindings_output_dir/InterfacesInfoIndividual.pickle" | |
| 149 | |
| 150 # TODO(eseidel): This is no longer needed, could pass these as args. | |
| 151 file_list = "$target_gen_dir/${target_name}_file_list.txt" | |
| 152 write_file(file_list, rebase_path(sources, root_build_dir)) | |
| 153 | |
| 154 # TODO(eseidel): Use depfile instead of this manual list. | |
| 155 inputs = [ "$bindings_scripts_dir/utilities.py" ] + sources | |
| 156 | |
| 157 outputs = [ | |
| 158 file_list, | |
| 159 output_file, | |
| 160 ] | |
| 161 | |
| 162 args = [ | |
| 163 # TODO(eseidel): Remove component-dir, it is meaningless in sky. | |
| 164 "--component-dir", | |
| 165 "ignored", | |
| 166 "--idl-files-list", | |
| 167 rebase_path(file_list, root_build_dir), | |
| 168 "--interfaces-info-file", | |
| 169 rebase_path(output_file, root_build_dir), | |
| 170 | |
| 171 # TODO(eseidel): only-if-changed is always true, remove | |
| 172 "--write-file-only-if-changed=1", | |
| 173 ] | |
| 174 } | |
| 175 | |
| 176 interfaces_info_individual_path = | |
| 177 "$bindings_output_dir/InterfacesInfoIndividual.pickle" | |
| 178 | |
| 179 interfaces_info_overall_path = | |
| 180 "$bindings_output_dir/InterfacesInfoOverall.pickle" | |
| 181 | |
| 182 action("compute_interfaces_info_overall") { | |
| 183 script = "$bindings_scripts_dir/compute_interfaces_info_overall.py" | |
| 184 | |
| 185 inputs = [ | |
| 186 interfaces_info_individual_path, | |
| 187 ] | |
| 188 outputs = [ | |
| 189 interfaces_info_overall_path, | |
| 190 ] | |
| 191 | |
| 192 args = [ | |
| 193 # TODO(eseidel): only-if-changed is always true, remove | |
| 194 "--write-file-only-if-changed=1", | |
| 195 "--", | |
| 196 ] | |
| 197 args += rebase_path(inputs, root_build_dir) | |
| 198 args += rebase_path(outputs, root_build_dir) | |
| 199 | |
| 200 deps = [ | |
| 201 ":compute_interfaces_info_individual", | |
| 202 ] | |
| 203 } | |
| 204 | |
| 205 # This separate pre-caching step is required to use lex/parse table | |
| 206 # caching in PLY, since PLY itself does not check if the cache is | |
| 207 # valid, and thus may end up using a stale cache if this step hasn"t | |
| 208 # been run to update it. | |
| 209 # | |
| 210 # This action"s dependencies *is* the cache validation. | |
| 211 # | |
| 212 # GYP version: scripts.gyp:cached_lex_yacc_tables | |
| 213 action("cached_lex_yacc_tables") { | |
| 214 script = "scripts/blink_idl_parser.py" | |
| 215 | |
| 216 inputs = idl_lexer_parser_files | |
| 217 outputs = [ | |
| 218 "$bindings_output_dir/lextab.py", | |
| 219 "$bindings_output_dir/parsetab.pickle", | |
| 220 ] | |
| 221 | |
| 222 args = [ rebase_path(bindings_output_dir, root_build_dir) ] | |
| 223 } | |
| 224 | |
| 225 # Runs the idl_compiler script over a list of sources. | |
| 226 # | |
| 227 # Parameters: | |
| 228 # sources = list of IDL files to compile | |
| 229 # output_dir = string containing the directory to put the output files. | |
| 230 template("idl_compiler") { | |
| 231 output_dir = invoker.output_dir | |
| 232 | |
| 233 action_foreach(target_name) { | |
| 234 # TODO(brettw) GYP adds a "-S before the script name to skip "import site" t
o | |
| 235 # speed up startup. Figure out if we need this and do something similar (not | |
| 236 # really expressible in GN now). | |
| 237 script = "$bindings_scripts_dir/compiler.py" | |
| 238 | |
| 239 inputs = idl_lexer_parser_files + idl_compiler_files | |
| 240 inputs += [ | |
| 241 "scripts/templates/attributes_cpp.template", | |
| 242 "scripts/templates/callback_interface_cpp.template", | |
| 243 "scripts/templates/callback_interface_dart.template", | |
| 244 "scripts/templates/callback_interface_h.template", | |
| 245 "scripts/templates/interface_base_cpp.template", | |
| 246 "scripts/templates/interface_cpp.template", | |
| 247 "scripts/templates/interface_dart.template", | |
| 248 "scripts/templates/interface_h.template", | |
| 249 "scripts/templates/methods_cpp.template", | |
| 250 ] | |
| 251 inputs += [ | |
| 252 "$bindings_output_dir/lextab.py", | |
| 253 "$bindings_output_dir/parsetab.pickle", | |
| 254 | |
| 255 # "$bindings_output_dir/cached_jinja_templates.stamp", | |
| 256 "//sky/engine/bindings2/IDLExtendedAttributes.txt", | |
| 257 | |
| 258 # If the dependency structure or public interface info (e.g., | |
| 259 # [ImplementedAs]) changes, we rebuild all files, since we"re not | |
| 260 # computing dependencies file-by-file in the build. | |
| 261 # This data is generally stable. | |
| 262 interfaces_info_overall_path, | |
| 263 ] | |
| 264 | |
| 265 # Further, if any dependency (partial interface or implemented | |
| 266 # interface) changes, rebuild everything, since every IDL potentially | |
| 267 # depends on them, because we"re not computing dependencies | |
| 268 # file-by-file. | |
| 269 # FIXME: This is too conservative, and causes excess rebuilds: | |
| 270 # compute this file-by-file. http://crbug.com/341748 | |
| 271 # This should theoretically just be the IDL files passed in. | |
| 272 inputs += core_dependency_idl_files | |
| 273 | |
| 274 sources = invoker.sources | |
| 275 outputs = [ | |
| 276 "$output_dir/Dart{{source_name_part}}.cpp", | |
| 277 "$output_dir/Dart{{source_name_part}}.h", | |
| 278 "$output_dir/{{source_name_part}}.dart", | |
| 279 ] | |
| 280 | |
| 281 args = [ | |
| 282 "--output-dir", | |
| 283 rebase_path(output_dir, root_build_dir), | |
| 284 "--interfaces-info", | |
| 285 rebase_path(interfaces_info_overall_path, root_build_dir), | |
| 286 "--write-file-only-if-changed=1", # Always true for Ninja. | |
| 287 "{{source}}", | |
| 288 ] | |
| 289 | |
| 290 deps = [ | |
| 291 ":compute_interfaces_info_overall", | |
| 292 ":cached_lex_yacc_tables", | |
| 293 | |
| 294 # ":cached_jinja_templates", | |
| 295 ] | |
| 296 } | |
| 297 } | |
| 298 | |
| 299 idl_compiler("compile_idls") { | |
| 300 sources = core_idl_files | |
| 301 output_dir = bindings_output_dir | |
| 302 } | |
| 303 | |
| 304 action("generate_dart_globals") { | |
| 305 sources = core_idl_files | |
| 306 script = "$bindings_scripts_dir/compiler.py" | |
| 307 | |
| 308 file_list = "$target_gen_dir/${target_name}_file_list.txt" | |
| 309 write_file(file_list, rebase_path(sources, root_build_dir)) | |
| 310 | |
| 311 inputs = sources + idl_compiler_files | |
| 312 inputs += [ | |
| 313 "scripts/templates/global_cpp.template", | |
| 314 "scripts/templates/global_h.template", | |
| 315 ] | |
| 316 | |
| 317 outputs = [ | |
| 318 file_list, | |
| 319 "$bindings_output_dir/DartGlobal.h", | |
| 320 "$bindings_output_dir/DartGlobal.cpp", | |
| 321 ] | |
| 322 | |
| 323 args = [ | |
| 324 "--output-directory", | |
| 325 rebase_path(bindings_output_dir, root_build_dir), | |
| 326 "--generate-globals", | |
| 327 rebase_path(bindings_output_dir, root_build_dir), | |
| 328 rebase_path(file_list, root_build_dir), | |
| 329 ] | |
| 330 | |
| 331 deps = [ | |
| 332 ":compile_idls", | |
| 333 ] | |
| 334 } | |
| 335 | |
| 336 action("generate_sky_core_dart") { | |
| 337 sources = core_idl_files | |
| 338 script = "$bindings_scripts_dir/compiler.py" | |
| 339 | |
| 340 file_list = "$target_gen_dir/${target_name}_file_list.txt" | |
| 341 write_file(file_list, rebase_path(sources, root_build_dir)) | |
| 342 | |
| 343 inputs = | |
| 344 sources + idl_compiler_files + [ "scripts/templates/dart_blink.template" ] | |
| 345 | |
| 346 outputs = [ | |
| 347 file_list, | |
| 348 "$bindings_output_dir/sky_core.dart", | |
| 349 ] | |
| 350 | |
| 351 args = [ | |
| 352 "--output-directory", | |
| 353 rebase_path(bindings_output_dir, root_build_dir), | |
| 354 "--generate-dart-blink", | |
| 355 rebase_path(bindings_output_dir, root_build_dir), | |
| 356 rebase_path(file_list, root_build_dir), | |
| 357 ] | |
| 358 | |
| 359 deps = [ | |
| 360 ":compile_idls", | |
| 361 ] | |
| 362 } | |
| 363 | |
| 364 source_set("generated_bindings") { | |
| 365 deps = [ | |
| 366 "//base", | |
| 367 "//dart/runtime/bin:libdart_withcore", | |
| 368 "//gpu/command_buffer/client:gles2_c_lib", | |
| 369 "//mojo/application", | |
| 370 "//mojo/common", | |
| 371 "//mojo/edk/js", | |
| 372 "//mojo/public/c/system", | |
| 373 "//mojo/public/cpp/bindings", | |
| 374 "//mojo/public/cpp/system", | |
| 375 "//mojo/public/cpp/utility", | |
| 376 "//mojo/public/interfaces/application", | |
| 377 "//mojo/services/keyboard/public/interfaces", | |
| 378 "//mojo/services/navigation/public/interfaces", | |
| 379 "//mojo/services/view_manager/public/cpp", | |
| 380 "//skia", | |
| 381 "//sky/engine/wtf", | |
| 382 "//third_party/angle:translator", | |
| 383 "//third_party/iccjpeg", | |
| 384 "//third_party/libpng", | |
| 385 "//third_party/ots", | |
| 386 "//third_party/qcms", | |
| 387 "//third_party/zlib", | |
| 388 "//url", | |
| 389 ":generate_dart_globals", | |
| 390 ] | |
| 391 | |
| 392 include_dirs = [ | |
| 393 "..", | |
| 394 "$root_build_dir", | |
| 395 ] | |
| 396 | |
| 397 sources = get_target_outputs(":compile_idls") | |
| 398 sources += get_target_outputs(":generate_dart_globals") | |
| 399 } | |
| OLD | NEW |