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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 } | 53 } |
54 | 54 |
55 | 55 |
56 vm_sources_list = exec_script("../../tools/gypi_to_gn.py", | 56 vm_sources_list = exec_script("../../tools/gypi_to_gn.py", |
57 [rebase_path("vm_sources.gypi")], | 57 [rebase_path("vm_sources.gypi")], |
58 "scope", | 58 "scope", |
59 ["vm_sources.gypi"]) | 59 ["vm_sources.gypi"]) |
60 | 60 |
61 | 61 |
62 static_library("libdart_vm") { | 62 static_library("libdart_vm") { |
63 deps = [":patched_sdk"] | |
zra
2016/10/21 21:34:43
Why is this dependency here, but not on the analog
zra
2016/10/21 21:34:43
Also, we tend to put 'deps' below 'configs'.
Vyacheslav Egorov (Google)
2016/10/24 13:35:10
Done.
| |
63 configs += ["..:dart_config", | 64 configs += ["..:dart_config", |
64 "..:dart_maybe_product_config", | 65 "..:dart_maybe_product_config", |
65 "..:dart_maybe_precompiled_runtime_config"] | 66 "..:dart_maybe_precompiled_runtime_config"] |
66 public_configs = [":libdart_vm_config"] | 67 public_configs = [":libdart_vm_config"] |
67 set_sources_assignment_filter(["*_test.cc", "*_test.h"]) | 68 set_sources_assignment_filter(["*_test.cc", "*_test.h"]) |
68 sources = vm_sources_list.sources | 69 sources = vm_sources_list.sources |
69 include_dirs = [ | 70 include_dirs = [ |
70 "..", | 71 "..", |
71 ] | 72 ] |
72 } | 73 } |
(...skipping 20 matching lines...) Expand all Loading... | |
93 public_configs = [":libdart_vm_config"] | 94 public_configs = [":libdart_vm_config"] |
94 set_sources_assignment_filter(["*_test.cc", "*_test.h"]) | 95 set_sources_assignment_filter(["*_test.cc", "*_test.h"]) |
95 sources = vm_sources_list.sources | 96 sources = vm_sources_list.sources |
96 include_dirs = [ | 97 include_dirs = [ |
97 "..", | 98 "..", |
98 ] | 99 ] |
99 } | 100 } |
100 | 101 |
101 | 102 |
102 static_library("libdart_vm_nosnapshot") { | 103 static_library("libdart_vm_nosnapshot") { |
104 deps = [":patched_sdk"] | |
103 configs += ["..:dart_config", | 105 configs += ["..:dart_config", |
104 "..:dart_maybe_product_config", | 106 "..:dart_maybe_product_config", |
105 "..:dart_maybe_precompiled_runtime_config", | 107 "..:dart_maybe_precompiled_runtime_config", |
106 "..:dart_no_snapshot_config",] | 108 "..:dart_no_snapshot_config",] |
107 public_configs = [":libdart_vm_config"] | 109 public_configs = [":libdart_vm_config"] |
108 set_sources_assignment_filter(["*_test.cc", "*_test.h"]) | 110 set_sources_assignment_filter(["*_test.cc", "*_test.h"]) |
109 sources = vm_sources_list.sources | 111 sources = vm_sources_list.sources |
110 include_dirs = [ | 112 include_dirs = [ |
111 "..", | 113 "..", |
112 ] | 114 ] |
113 } | 115 } |
114 | 116 |
115 | 117 |
116 static_library("libdart_vm_nosnapshot_precompiled_runtime") { | 118 static_library("libdart_vm_nosnapshot_precompiled_runtime") { |
117 configs += ["..:dart_config", | 119 configs += ["..:dart_config", |
118 "..:dart_maybe_product_config", | 120 "..:dart_maybe_product_config", |
119 "..:dart_precompiled_runtime_config", | 121 "..:dart_precompiled_runtime_config", |
120 "..:dart_no_snapshot_config",] | 122 "..:dart_no_snapshot_config",] |
121 public_configs = [":libdart_vm_config"] | 123 public_configs = [":libdart_vm_config"] |
122 set_sources_assignment_filter(["*_test.cc", "*_test.h"]) | 124 set_sources_assignment_filter(["*_test.cc", "*_test.h"]) |
123 sources = vm_sources_list.sources | 125 sources = vm_sources_list.sources |
124 include_dirs = [ | 126 include_dirs = [ |
125 "..", | 127 "..", |
126 ] | 128 ] |
127 } | 129 } |
128 | 130 |
129 | 131 |
130 static_library("libdart_vm_nosnapshot_with_precompiler") { | 132 static_library("libdart_vm_nosnapshot_with_precompiler") { |
133 deps = [":patched_sdk"] | |
131 configs += ["..:dart_config", | 134 configs += ["..:dart_config", |
132 "..:dart_maybe_product_config", | 135 "..:dart_maybe_product_config", |
133 "..:dart_precompiler_config", | 136 "..:dart_precompiler_config", |
134 "..:dart_no_snapshot_config",] | 137 "..:dart_no_snapshot_config",] |
135 public_configs = [":libdart_vm_config"] | 138 public_configs = [":libdart_vm_config"] |
136 set_sources_assignment_filter(["*_test.cc", "*_test.h"]) | 139 set_sources_assignment_filter(["*_test.cc", "*_test.h"]) |
137 sources = vm_sources_list.sources | 140 sources = vm_sources_list.sources |
138 include_dirs = [ | 141 include_dirs = [ |
139 "..", | 142 "..", |
140 ] | 143 ] |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
292 ["developer", "developer", true, "../../sdk/lib/developer", "../lib"], | 295 ["developer", "developer", true, "../../sdk/lib/developer", "../lib"], |
293 ["_internal", "internal", true, "../../sdk/lib/internal", "../lib"], | 296 ["_internal", "internal", true, "../../sdk/lib/internal", "../lib"], |
294 ["isolate", "isolate", true, "../../sdk/lib/isolate", "../lib"], | 297 ["isolate", "isolate", true, "../../sdk/lib/isolate", "../lib"], |
295 ["math", "math", true, "../../sdk/lib/math", "../lib"], | 298 ["math", "math", true, "../../sdk/lib/math", "../lib"], |
296 ["mirrors", "mirrors", true, "../../sdk/lib/mirrors", "../lib"], | 299 ["mirrors", "mirrors", true, "../../sdk/lib/mirrors", "../lib"], |
297 ["profiler", "profiler", false, "../../sdk/lib/profiler"], | 300 ["profiler", "profiler", false, "../../sdk/lib/profiler"], |
298 ["typed_data", "typed_data", false, "../lib"], | 301 ["typed_data", "typed_data", false, "../lib"], |
299 ["_vmservice", "vmservice", true, "../../sdk/lib/vmservice", "../lib"], | 302 ["_vmservice", "vmservice", true, "../../sdk/lib/vmservice", "../lib"], |
300 ] | 303 ] |
301 } | 304 } |
305 | |
306 group("patched_sdk") { | |
307 template("concatenate_patch") { | |
zra
2016/10/21 21:34:43
Optional: templates can use each other. Are there
Vyacheslav Egorov (Google)
2016/10/24 13:35:10
I have rewritten this code.
| |
308 assert(defined(invoker.libname), "Need a name in $target_name") | |
309 assert(defined(invoker.dir), "Need a dir in $target_name") | |
310 assert(defined(invoker.output), "Need a output in $target_name") | |
zra
2016/10/21 21:34:43
an
Vyacheslav Egorov (Google)
2016/10/24 13:35:10
Done.
| |
311 | |
312 action(target_name) { | |
313 visibility = [ ":*" ] | |
314 output = invoker.output | |
315 dir = invoker.dir | |
316 libname = invoker.libname | |
317 sources_gypi = "../${dir}/${libname}_sources.gypi" | |
318 | |
319 lib_sources_gypi = | |
320 exec_script("../../tools/gypi_to_gn.py", | |
321 [rebase_path(sources_gypi)], | |
322 "scope", | |
323 [sources_gypi]) | |
324 lib_sources = | |
325 rebase_path(lib_sources_gypi.sources, ".", "../${dir}") | |
326 | |
327 script = "../tools/concatenate_patches.py" | |
328 | |
329 inputs = [ script, sources_gypi ] | |
330 inputs += lib_sources | |
331 | |
332 outputs = [ output ] | |
333 | |
334 args = [ "--output", rebase_path(output, root_build_dir)] | |
335 args += rebase_path(lib_sources, root_build_dir) | |
336 } | |
337 } | |
338 | |
339 vm_libraries = [ "async", "collection", "convert", "core", "developer", | |
zra
2016/10/21 21:34:43
I would re-structure this as a template that takes
Vyacheslav Egorov (Google)
2016/10/24 13:35:10
Done.
| |
340 "internal", "isolate", "math", "mirrors", "profiler", | |
341 "vmservice" ] | |
342 concatenation_target_names = [] | |
343 concatenation_files = [] | |
344 | |
345 # Concatenate vm library patches. | |
zra
2016/10/21 21:34:43
Then you can de-dup the invocation of concatenate_
Vyacheslav Egorov (Google)
2016/10/24 13:35:10
Done.
| |
346 foreach(name, vm_libraries) { | |
347 target_name = "concatenate_${name}_patch" | |
348 target_output = "$target_gen_dir/patches/${name}_patch.dart" | |
349 concatenate_patch(target_name) { | |
350 libname = name | |
351 output = target_output | |
352 dir = "lib" | |
353 } | |
354 concatenation_target_names += [ ":${target_name}" ] | |
355 concatenation_files += [ target_output ] | |
356 } | |
357 | |
358 # Concatenate io library patches. | |
359 name = "io" | |
360 target_name = "concatenate_${name}_patch" | |
361 target_output = "$target_gen_dir/patches/${name}_patch.dart" | |
362 concatenate_patch(target_name) { | |
363 libname = name | |
364 output = target_output | |
365 dir = "bin" | |
366 } | |
367 concatenation_target_names += [ ":concatenate_io_patch" ] | |
368 concatenation_files += [ target_output ] | |
369 | |
370 # Build the patched sdk out of the concatenated patches and the special | |
371 # "runtime/bin/{builtin,nativewrappers}.dart" libraries". | |
372 action("generate_patched_sdk") { | |
373 deps = concatenation_target_names | |
374 | |
375 patches_dir = "$target_gen_dir/patches" | |
376 patched_sdk_dir = "$target_gen_dir/patched_sdk" | |
377 | |
378 script = "../../tools/patch_sdk.py" | |
379 | |
380 # We list all files which make up the sdk (modulo patches) and get them back | |
381 # as a GN list object. | |
382 shared_sdk_sources = exec_script( | |
383 "../../tools/list_files.py", ["dart\$", "../../sdk/lib"], "list lines") | |
zra
2016/10/21 21:34:43
If you only want .dart files, then tools/list_dart
Vyacheslav Egorov (Google)
2016/10/24 13:35:10
Done.
| |
384 | |
385 # We list the `patch_sdk.dart` tool here because the [script] (which is | |
386 # implicitly an input) will call it. | |
387 inputs = [ "../../tools/patch_sdk.dart" ] | |
388 # These three are not patches, they will not be in [concatenation_files] but | |
389 # the `patch_sdk.dart` script will copy them into the patched sdk. | |
390 inputs += [ | |
391 "../lib/typed_data.dart", | |
392 "../bin/builtin.dart", | |
393 "../bin/nativewrappers.dart", | |
394 "../bin/vmservice/vmservice_io.dart", | |
395 "../bin/vmservice/loader.dart", | |
396 "../bin/vmservice/server.dart", | |
397 ] | |
398 # Add all the normal sdk sources. | |
399 inputs += shared_sdk_sources | |
400 # Add all the concatenated patch files. | |
401 inputs += concatenation_files | |
402 | |
403 outputs = [ | |
404 # Instead of listing all outputs we list a single well-known one. | |
405 "${patched_sdk_dir}/lib/core/core.dart", | |
406 ] | |
407 | |
408 args = [ | |
409 "vm", | |
410 rebase_path("../../sdk"), | |
411 rebase_path(patches_dir, root_build_dir), | |
412 rebase_path(patched_sdk_dir, root_build_dir), | |
413 ] | |
414 } | |
415 } | |
OLD | NEW |