| 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 # The entrypoint is the dart_pkg rule. | 6 # The entrypoint is the dart_pkg rule. |
| 7 | 7 |
| 8 import("../mojo.gni") | 8 import("../mojo.gni") |
| 9 import("//build/module_args/mojo.gni") | 9 import("//build/module_args/mojo.gni") |
| 10 import("//build/module_args/dart.gni") | 10 import("//build/module_args/dart.gni") |
| 11 | 11 |
| 12 template("dartx") { | 12 template("dartx") { |
| 13 bundle_prefix = target_name | 13 bundle_prefix = target_name |
| 14 bundle = "$target_gen_dir/${bundle_prefix}.dartx" | 14 bundle = "$target_gen_dir/${bundle_prefix}.dartx" |
| 15 snapshot = "$target_gen_dir/${bundle_prefix}_snapshot.bin" | 15 snapshot = "$target_gen_dir/${bundle_prefix}_snapshot.bin" |
| 16 depfile_path = "${snapshot}.d" |
| 16 | 17 |
| 17 if (mojo_use_prebuilt_dart_snapshotter) { | 18 if (mojo_use_prebuilt_dart_snapshotter) { |
| 18 dart_snapshotter_path = | 19 dart_snapshotter_path = |
| 19 rebase_path("mojo/public/tools:copy_dart_snapshotter", ".", mojo_root) | 20 rebase_path("mojo/public/tools:copy_dart_snapshotter", ".", mojo_root) |
| 20 dart_snapshotter_rule = "$dart_snapshotter_path($host_toolchain)" | 21 dart_snapshotter_rule = "$dart_snapshotter_path($host_toolchain)" |
| 21 } else { | 22 } else { |
| 22 dart_snapshotter_rule = dart_snapshotter_bin | 23 dart_snapshotter_rule = dart_snapshotter_bin |
| 23 } | 24 } |
| 24 dart_snapshotter_dir = | 25 dart_snapshotter_dir = |
| 25 get_label_info("$dart_snapshotter_rule", "root_out_dir") | 26 get_label_info("$dart_snapshotter_rule", "root_out_dir") |
| 26 dart_snapshotter = "$dart_snapshotter_dir/dart_snapshotter" | 27 dart_snapshotter = "$dart_snapshotter_dir/dart_snapshotter" |
| 27 | 28 |
| 28 action("gen_${bundle_prefix}_snapshot") { | 29 action("gen_${bundle_prefix}_snapshot") { |
| 29 main_dart = invoker.main_dart | 30 main_dart = invoker.main_dart |
| 30 | 31 |
| 32 depfile = depfile_path |
| 33 |
| 31 inputs = [ | 34 inputs = [ |
| 32 dart_snapshotter, | 35 dart_snapshotter, |
| 33 ] | 36 ] |
| 34 outputs = [ | 37 outputs = [ |
| 35 snapshot, | 38 snapshot, |
| 36 ] | 39 ] |
| 37 | 40 |
| 38 if (defined(invoker.sources)) { | 41 if (defined(invoker.sources)) { |
| 39 sources = invoker.sources | 42 sources = invoker.sources |
| 40 } | 43 } |
| 41 | 44 |
| 42 script = | 45 script = |
| 43 rebase_path("mojo/public/tools/dart_snapshotter.py", ".", mojo_sdk_root) | 46 rebase_path("mojo/public/tools/dart_snapshotter.py", ".", mojo_sdk_root) |
| 44 | 47 |
| 45 depfile = "$target_gen_dir/${bundle_prefix}_snapshot.bin.d" | |
| 46 | |
| 47 args = [ | 48 args = [ |
| 48 rebase_path(dart_snapshotter), | 49 rebase_path(dart_snapshotter), |
| 49 rebase_path(main_dart), | 50 rebase_path(main_dart), |
| 50 "--package-root", | 51 "--package-root", |
| 51 rebase_path("$root_gen_dir/dart-pkg/packages"), | 52 rebase_path("$root_gen_dir/dart-pkg/packages"), |
| 52 "--snapshot", | 53 "--snapshot", |
| 53 rebase_path(snapshot), | 54 rebase_path(snapshot), |
| 54 "--depfile", | 55 "--depfile", |
| 55 rebase_path(depfile), | 56 rebase_path(depfile_path), |
| 56 "--build-output", | 57 "--build-output", |
| 57 "${bundle_prefix}_snapshot.bin", | 58 rebase_path(snapshot, root_build_dir), # Relative to build directory |
| 58 ] | 59 ] |
| 59 | 60 |
| 60 deps = [ | 61 deps = [ |
| 61 dart_snapshotter_rule, | 62 dart_snapshotter_rule, |
| 62 ] | 63 ] |
| 63 if (defined(invoker.deps)) { | 64 if (defined(invoker.deps)) { |
| 64 deps += invoker.deps | 65 deps += invoker.deps |
| 65 } | 66 } |
| 66 } | 67 } |
| 67 | 68 |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 group(target_name) { | 449 group(target_name) { |
| 449 deps = [] | 450 deps = [] |
| 450 foreach(package_dir, packages) { | 451 foreach(package_dir, packages) { |
| 451 deps += [ ":$package_dir" ] | 452 deps += [ ":$package_dir" ] |
| 452 } | 453 } |
| 453 if (defined(invoker.deps)) { | 454 if (defined(invoker.deps)) { |
| 454 deps += invoker.deps | 455 deps += invoker.deps |
| 455 } | 456 } |
| 456 } | 457 } |
| 457 } | 458 } |
| OLD | NEW |