| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 # This file has rules for making Dart packages and Dart-based Mojo applications. | 5 # This file has rules for making Dart packages and Dart-based Mojo applications. |
| 6 # | 6 # |
| 7 # Entrypoint rules are: | 7 # Entrypoint rules are: |
| 8 # - dart_pkg | 8 # - dart_pkg |
| 9 # - dartzip_package | 9 # - dartzip_package |
| 10 # - dartzip_packaged_application | 10 # - dartzip_packaged_application |
| 11 | 11 |
| 12 import("../mojo.gni") |
| 12 import("//build/module_args/mojo.gni") | 13 import("//build/module_args/mojo.gni") |
| 13 import("//build/module_args/dart.gni") | 14 import("//build/module_args/dart.gni") |
| 14 | 15 |
| 15 template("dartx") { | 16 template("dartx") { |
| 16 bundle_prefix = target_name | 17 bundle_prefix = target_name |
| 17 bundle = "$target_gen_dir/${bundle_prefix}.dartx" | 18 bundle = "$target_gen_dir/${bundle_prefix}.dartx" |
| 18 snapshot = "$target_gen_dir/${bundle_prefix}_snapshot.bin" | 19 snapshot = "$target_gen_dir/${bundle_prefix}_snapshot.bin" |
| 19 dart_snapshotter = "$root_out_dir/dart_snapshotter" | 20 |
| 20 if (current_toolchain != host_toolchain) { | 21 if (mojo_use_prebuilt_dart_snapshotter) { |
| 21 toolchain_name = get_label_info(host_toolchain, "name") | 22 dart_snapshotter_path = |
| 22 dart_snapshotter = "$root_out_dir/$toolchain_name/dart_snapshotter" | 23 rebase_path("mojo/public/tools:copy_dart_snapshotter", ".", mojo_root) |
| 24 dart_snapshotter_rule = "$dart_snapshotter_path($host_toolchain)" |
| 25 } else { |
| 26 dart_snapshotter_rule = dart_snapshotter_bin |
| 23 } | 27 } |
| 28 dart_snapshotter_dir = |
| 29 get_label_info("$dart_snapshotter_rule", "root_out_dir") |
| 30 dart_snapshotter = "$dart_snapshotter_dir/dart_snapshotter" |
| 24 | 31 |
| 25 action("gen_${bundle_prefix}_snapshot") { | 32 action("gen_${bundle_prefix}_snapshot") { |
| 26 main_dart = invoker.main_dart | 33 main_dart = invoker.main_dart |
| 27 | 34 |
| 28 inputs = [ | 35 inputs = [ |
| 29 dart_snapshotter, | 36 dart_snapshotter, |
| 30 main_dart, | 37 main_dart, |
| 31 ] | 38 ] |
| 32 outputs = [ | 39 outputs = [ |
| 33 snapshot, | 40 snapshot, |
| 34 ] | 41 ] |
| 35 | 42 |
| 36 if (defined(invoker.sources)) { | 43 if (defined(invoker.sources)) { |
| 37 inputs += invoker.sources | 44 inputs += invoker.sources |
| 38 } | 45 } |
| 39 | 46 |
| 40 script = | 47 script = |
| 41 rebase_path("mojo/public/tools/dart_snapshotter.py", ".", mojo_sdk_root) | 48 rebase_path("mojo/public/tools/dart_snapshotter.py", ".", mojo_sdk_root) |
| 42 | 49 |
| 43 args = [ | 50 args = [ |
| 44 rebase_path(dart_snapshotter), | 51 rebase_path(dart_snapshotter), |
| 45 rebase_path(main_dart), | 52 rebase_path(main_dart), |
| 46 "--package-root", | 53 "--package-root", |
| 47 rebase_path("$root_gen_dir/dart-pkg/packages"), | 54 rebase_path("$root_gen_dir/dart-pkg/packages"), |
| 48 "--snapshot", | 55 "--snapshot", |
| 49 rebase_path(snapshot), | 56 rebase_path(snapshot), |
| 50 ] | 57 ] |
| 51 | 58 |
| 52 deps = [ | 59 deps = [ |
| 53 dart_snapshotter_bin, | 60 dart_snapshotter_rule, |
| 54 ] | 61 ] |
| 55 if (defined(invoker.deps)) { | 62 if (defined(invoker.deps)) { |
| 56 deps += invoker.deps | 63 deps += invoker.deps |
| 57 } | 64 } |
| 58 } | 65 } |
| 59 | 66 |
| 60 action("gen_${bundle_prefix}_bundle") { | 67 action("gen_${bundle_prefix}_bundle") { |
| 61 sources = [ | 68 sources = [ |
| 62 rebase_path("mojo/public/tools/dartx.py", ".", mojo_sdk_root), | 69 rebase_path("mojo/public/tools/dartx.py", ".", mojo_sdk_root), |
| 63 snapshot, | 70 snapshot, |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 | 605 |
| 599 rebase_input = rebase_path(input, root_build_dir) | 606 rebase_input = rebase_path(input, root_build_dir) |
| 600 rebase_output = rebase_path(output, root_build_dir) | 607 rebase_output = rebase_path(output, root_build_dir) |
| 601 args = [ | 608 args = [ |
| 602 "--input=$rebase_input", | 609 "--input=$rebase_input", |
| 603 "--output=$rebase_output", | 610 "--output=$rebase_output", |
| 604 "--line=$line", | 611 "--line=$line", |
| 605 ] | 612 ] |
| 606 } | 613 } |
| 607 } | 614 } |
| OLD | NEW |