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