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