OLD | NEW |
| (Empty) |
1 # Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | |
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. | |
4 | |
5 _dart_root = rebase_path("..") | |
6 | |
7 if (defined(is_win) && is_win) { | |
8 dart_executable_suffix = ".exe" | |
9 } else { | |
10 dart_executable_suffix = "" | |
11 } | |
12 | |
13 template("invoke_dart") { | |
14 assert(defined(invoker.outputs), "invoke_dart must specify outputs") | |
15 extra_deps = [] | |
16 if (defined(invoker.deps)) { | |
17 extra_deps += invoker.deps | |
18 } | |
19 | |
20 extra_inputs = [] | |
21 if (defined(invoker.inputs)) { | |
22 extra_inputs += invoker.inputs | |
23 } | |
24 | |
25 extra_args = [] | |
26 if (defined(invoker.args)) { | |
27 extra_args += invoker.args | |
28 } | |
29 | |
30 action(target_name) { | |
31 relative_dart_root = rebase_path(_dart_root, ".") | |
32 deps = | |
33 extra_deps + [ "$relative_dart_root/runtime/bin:dart($host_toolchain)" ] | |
34 | |
35 dart_out_dir = | |
36 get_label_info("$relative_dart_root/runtime/bin:dart($host_toolchain)", | |
37 "root_out_dir") | |
38 dart = rebase_path("$dart_out_dir/dart$dart_executable_suffix") | |
39 | |
40 inputs = [ dart ] + extra_inputs | |
41 | |
42 outputs = invoker.outputs | |
43 | |
44 script = "$_dart_root/tools/dart_for_gn.py" | |
45 args = [ dart ] + extra_args | |
46 } | |
47 } | |
48 | |
49 template("application_snapshot") { | |
50 assert(defined(invoker.main_dart), "Must specify 'main_dart'") | |
51 assert(defined(invoker.training_args), "Must specify 'training_args'") | |
52 main_dart = invoker.main_dart | |
53 training_args = invoker.training_args | |
54 name = target_name | |
55 if (defined(invoker.name)) { | |
56 name = invoker.name | |
57 } | |
58 extra_deps = [] | |
59 if (defined(invoker.deps)) { | |
60 extra_deps += invoker.deps | |
61 } | |
62 extra_inputs = [] | |
63 if (defined(invoker.inputs)) { | |
64 extra_inputs += invoker.inputs | |
65 } | |
66 invoke_dart(target_name) { | |
67 deps = extra_deps + [ "$_dart_root/pkg:pkg_files_stamp" ] | |
68 | |
69 inputs = extra_inputs + [ | |
70 "$_dart_root/sdk/lib/_internal/sdk_library_metadata/lib/libraries
.dart", | |
71 "$root_gen_dir/pkg_files.stamp", | |
72 ] | |
73 | |
74 output = "$root_gen_dir/$name.dart.snapshot" | |
75 outputs = [ | |
76 output, | |
77 ] | |
78 | |
79 dot_packages = rebase_path("$_dart_root/.packages") | |
80 abs_output = rebase_path(output) | |
81 main_file = rebase_path(main_dart) | |
82 | |
83 args = [ | |
84 "--packages=$dot_packages", | |
85 "--snapshot=$abs_output", | |
86 "--snapshot-kind=app-jit", | |
87 main_file, | |
88 ] + training_args | |
89 } | |
90 } | |
OLD | NEW |