Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 # for details. All rights reserved. Use of this source code is governed by a | 2 # for details. All rights reserved. Use of this source code is governed by a |
| 3 # BSD-style license that can be found in the LICENSE file. | 3 # BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 config("libdart_vm_config") { | 5 config("libdart_vm_config") { |
| 6 if (defined(is_fuchsia) && is_fuchsia) { | 6 if (defined(is_fuchsia) && is_fuchsia) { |
| 7 libs = [ | 7 libs = [ |
| 8 "magenta", | 8 "magenta", |
| 9 ] | 9 ] |
| 10 } else if (is_win) { | 10 } else if (is_win) { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 "..:dart_no_snapshot_config",] | 134 "..:dart_no_snapshot_config",] |
| 135 public_configs = [":libdart_vm_config"] | 135 public_configs = [":libdart_vm_config"] |
| 136 set_sources_assignment_filter(["*_test.cc", "*_test.h"]) | 136 set_sources_assignment_filter(["*_test.cc", "*_test.h"]) |
| 137 sources = vm_sources_list.sources | 137 sources = vm_sources_list.sources |
| 138 include_dirs = [ | 138 include_dirs = [ |
| 139 "..", | 139 "..", |
| 140 ] | 140 ] |
| 141 } | 141 } |
| 142 | 142 |
| 143 | 143 |
| 144 template("generate_library_source") { | 144 template("process_library_source") { |
| 145 assert(defined(invoker.libname), "Need libname in $target_name") | |
| 146 assert(defined(invoker.filename), "Need a filename in $target_name") | 145 assert(defined(invoker.filename), "Need a filename in $target_name") |
| 147 assert(defined(invoker.kind), "Need kind in $target_name") | |
| 148 assert(defined(invoker.output), "Need output in $target_name") | 146 assert(defined(invoker.output), "Need output in $target_name") |
| 149 assert(defined(invoker.path), "Need path in $target_name") | 147 assert(defined(invoker.path), "Need path in $target_name") |
| 150 action(target_name) { | 148 action(target_name) { |
| 151 visibility = [ ":*" ] # Only targets in this file can see this. | 149 visibility = [ ":*" ] # Only targets in this file can see this. |
| 152 libname = invoker.libname | |
| 153 filename = invoker.filename | 150 filename = invoker.filename |
| 154 kind = invoker.kind | |
| 155 path = invoker.path | 151 path = invoker.path |
| 156 | 152 |
| 157 lib_sources_gypi = | 153 lib_sources_gypi = |
| 158 exec_script("../../tools/gypi_to_gn.py", | 154 exec_script("../../tools/gypi_to_gn.py", |
| 159 [rebase_path("${path}/${filename}_sources.gypi")], | 155 [rebase_path("${path}/${filename}_sources.gypi")], |
| 160 "scope", | 156 "scope", |
| 161 ["${path}/${filename}_sources.gypi"]) | 157 ["${path}/${filename}_sources.gypi"]) |
| 162 lib_sources = | 158 lib_sources = |
| 163 rebase_path(lib_sources_gypi.sources, ".", path) | 159 rebase_path(lib_sources_gypi.sources, ".", path) |
| 164 | 160 |
| 161 script = invoker.script | |
| 162 inputs = invoker.inputs + [script] | |
| 163 inputs += lib_sources | |
| 164 outputs = [invoker.output] | |
| 165 args = invoker.args + rebase_path(lib_sources, root_build_dir) | |
| 166 } | |
| 167 } | |
| 168 | |
| 169 | |
| 170 template("generate_library_source") { | |
| 171 assert(defined(invoker.libname), "Need libname in $target_name") | |
| 172 assert(defined(invoker.filename), "Need a filename in $target_name") | |
| 173 assert(defined(invoker.kind), "Need kind in $target_name") | |
| 174 assert(defined(invoker.output), "Need output in $target_name") | |
| 175 assert(defined(invoker.path), "Need path in $target_name") | |
| 176 | |
| 177 process_library_source(target_name) { | |
| 178 libname = invoker.libname | |
| 179 filename = invoker.filename | |
| 180 kind = invoker.kind | |
| 181 output = invoker.output | |
| 182 path = invoker.path | |
| 165 script = "../tools/gen_library_src_paths.py" | 183 script = "../tools/gen_library_src_paths.py" |
| 166 inputs = [ | 184 inputs = ["../lib/libgen_in.cc"] |
| 167 "../tools/gen_library_src_paths.py", | |
| 168 "../lib/libgen_in.cc", | |
| 169 ] | |
| 170 inputs += lib_sources | |
| 171 outputs = [ invoker.output, ] | |
| 172 args = [ | 185 args = [ |
| 173 "--output", rebase_path(invoker.output, root_build_dir), | 186 "--output", rebase_path(invoker.output, root_build_dir), |
| 174 "--input_cc", rebase_path("../lib/libgen_in.cc", root_build_dir), | 187 "--input_cc", rebase_path("../lib/libgen_in.cc", root_build_dir), |
| 175 "--include", "vm/bootstrap.h", | 188 "--include", "vm/bootstrap.h", |
| 176 "--var_name", "dart::Bootstrap::${libname}_${kind}_paths_", | 189 "--var_name", "dart::Bootstrap::${libname}_${kind}_paths_", |
| 177 "--library_name", "dart:${libname}",] + | 190 "--library_name", "dart:${libname}", |
| 178 rebase_path(lib_sources, root_build_dir) | 191 ] |
| 179 } | 192 } |
| 180 } | 193 } |
| 181 | 194 |
| 182 | 195 |
| 183 # This templates expects invoker.sources to be a list of pairs of strings. | 196 # This templates expects invoker.sources to be a list of pairs of strings. |
| 184 # The pairs of strings mean the following. | 197 # The pairs of strings mean the following. |
| 185 # library name, file name | 198 # library name, file name |
| 186 # e.g. for the "internal" library named "dart:_internal", | 199 # e.g. for the "internal" library named "dart:_internal", |
| 187 # with sources listed at sdk/lib/internal/internal_sources.gypi and | 200 # with sources listed at sdk/lib/internal/internal_sources.gypi and |
| 188 # lib/internal_sources.gypi, we have: ["_internal", "internal"] | 201 # lib/internal_sources.gypi, we have: ["_internal", "internal"] |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 ["developer", "developer", true, "../../sdk/lib/developer", "../lib"], | 305 ["developer", "developer", true, "../../sdk/lib/developer", "../lib"], |
| 293 ["_internal", "internal", true, "../../sdk/lib/internal", "../lib"], | 306 ["_internal", "internal", true, "../../sdk/lib/internal", "../lib"], |
| 294 ["isolate", "isolate", true, "../../sdk/lib/isolate", "../lib"], | 307 ["isolate", "isolate", true, "../../sdk/lib/isolate", "../lib"], |
| 295 ["math", "math", true, "../../sdk/lib/math", "../lib"], | 308 ["math", "math", true, "../../sdk/lib/math", "../lib"], |
| 296 ["mirrors", "mirrors", true, "../../sdk/lib/mirrors", "../lib"], | 309 ["mirrors", "mirrors", true, "../../sdk/lib/mirrors", "../lib"], |
| 297 ["profiler", "profiler", false, "../../sdk/lib/profiler"], | 310 ["profiler", "profiler", false, "../../sdk/lib/profiler"], |
| 298 ["typed_data", "typed_data", false, "../lib"], | 311 ["typed_data", "typed_data", false, "../lib"], |
| 299 ["_vmservice", "vmservice", true, "../../sdk/lib/vmservice", "../lib"], | 312 ["_vmservice", "vmservice", true, "../../sdk/lib/vmservice", "../lib"], |
| 300 ] | 313 ] |
| 301 } | 314 } |
| 315 | |
| 316 | |
| 317 template("concatenate_patch") { | |
| 318 assert(defined(invoker.libname), "Need a name in $target_name") | |
| 319 assert(defined(invoker.dir), "Need a dir in $target_name") | |
| 320 assert(defined(invoker.output), "Need an output in $target_name") | |
| 321 | |
| 322 process_library_source(target_name) { | |
| 323 output = invoker.output | |
| 324 path = "../${invoker.dir}" | |
| 325 filename = invoker.libname | |
| 326 script = "../tools/concatenate_patches.py" | |
| 327 args = [ "--output", rebase_path(output, root_build_dir)] | |
| 328 inputs = [] | |
| 329 } | |
| 330 } | |
| 331 | |
| 332 | |
| 333 template("generate_patched_sdk") { | |
| 334 concatenation_target_names = [] | |
| 335 concatenation_files = [] | |
| 336 | |
| 337 # Concatenate vm library patches. | |
| 338 foreach(library, invoker.libraries) { | |
|
zra
2016/10/25 07:06:35
assert that invoker.libraries is defined.
Vyacheslav Egorov (Google)
2016/10/26 10:45:17
Done.
| |
| 339 name = library[1] | |
| 340 | |
| 341 target_output = "$target_gen_dir/patches/${name}_patch.dart" | |
| 342 concatenate_patch("concatenate_${name}_patch") { | |
| 343 libname = name | |
| 344 dir = library[0] | |
| 345 output = target_output | |
| 346 } | |
| 347 concatenation_target_names += [ ":concatenate_${name}_patch" ] | |
| 348 concatenation_files += [ target_output ] | |
| 349 } | |
| 350 | |
| 351 # Build the patched sdk out of the concatenated patches and the special | |
| 352 # "runtime/bin/{builtin,nativewrappers}.dart" libraries". | |
| 353 action(target_name) { | |
| 354 deps = concatenation_target_names | |
| 355 | |
| 356 patches_dir = "$target_gen_dir/patches" | |
| 357 patched_sdk_dir = "$target_gen_dir/patched_sdk" | |
| 358 | |
| 359 script = "../../tools/patch_sdk.py" | |
| 360 | |
| 361 # We list all files which make up the sdk (modulo patches) and get them back | |
| 362 # as a GN list object. | |
| 363 shared_sdk_sources = exec_script( | |
| 364 "../../tools/list_dart_files.py", ["../../sdk/lib"], "list lines") | |
| 365 | |
| 366 # We list the `patch_sdk.dart` tool here because the [script] (which is | |
| 367 # implicitly an input) will call it. | |
| 368 inputs = [ "../../tools/patch_sdk.dart" ] | |
| 369 # These three are not patches, they will not be in [concatenation_files] but | |
|
zra
2016/10/25 07:06:35
six? Maybe just "The scripts below"
Vyacheslav Egorov (Google)
2016/10/26 10:45:17
Done.
| |
| 370 # the `patch_sdk.dart` script will copy them into the patched sdk. | |
| 371 inputs += [ | |
| 372 "../lib/typed_data.dart", | |
| 373 "../bin/builtin.dart", | |
| 374 "../bin/nativewrappers.dart", | |
| 375 "../bin/vmservice/vmservice_io.dart", | |
| 376 "../bin/vmservice/loader.dart", | |
| 377 "../bin/vmservice/server.dart", | |
| 378 ] | |
| 379 # Add all the normal sdk sources. | |
| 380 inputs += shared_sdk_sources | |
| 381 # Add all the concatenated patch files. | |
| 382 inputs += concatenation_files | |
| 383 | |
| 384 outputs = [ | |
| 385 # Instead of listing all outputs we list a single well-known one. | |
| 386 "${patched_sdk_dir}/lib/core/core.dart", | |
| 387 ] | |
| 388 | |
| 389 args = [ | |
| 390 "vm", | |
| 391 rebase_path("../../sdk"), | |
| 392 rebase_path(patches_dir, root_build_dir), | |
| 393 rebase_path(patched_sdk_dir, root_build_dir), | |
| 394 ] | |
| 395 } | |
| 396 } | |
| 397 | |
| 398 | |
| 399 generate_patched_sdk("patched_sdk") { | |
| 400 libraries = [ | |
| 401 ["lib", "async"], | |
| 402 ["lib", "collection"], | |
| 403 ["lib", "convert"], | |
| 404 ["lib", "core"], | |
| 405 ["lib", "developer"], | |
| 406 ["lib", "internal"], | |
| 407 ["lib", "isolate"], | |
| 408 ["lib", "math"], | |
| 409 ["lib", "mirrors"], | |
| 410 ["lib", "profiler"], | |
| 411 ["lib", "vmservice"], | |
| 412 ["bin", "io"], | |
| 413 ] | |
| 414 } | |
| OLD | NEW |