Chromium Code Reviews| Index: mojo/public/dart/rules.gni |
| diff --git a/mojo/public/dart/rules.gni b/mojo/public/dart/rules.gni |
| index 036c0733ec77ec9cb49b1b6116220cb093c5f011..94b50efa93d71202ef9430dd413bac468c7a0971 100644 |
| --- a/mojo/public/dart/rules.gni |
| +++ b/mojo/public/dart/rules.gni |
| @@ -4,23 +4,64 @@ |
| # Rules to generate python packaged applications for Dart |
| -import("../mojo_sdk.gni") |
| +import("//build/module_args/mojo.gni") |
| template("dart_package") { |
| package_target_name = "$target_name" |
| package_output = "$target_out_dir/$target_name.dartzip" |
| + if (defined(invoker.uses_pub) && invoker.uses_pub) { |
| + # Pull in any dependencies specified via pubspec.yaml and repackage them in |
| + # a dartzip file. |
| + action("${package_target_name}_pub_get") { |
| + target_dir = get_label_info(":$target_name", "dir") |
| + script = rebase_path("mojo/public/tools/gn/zip.py", ".", mojo_sdk_root) |
| + |
| + # Run pub get and get a list of the pulled-in files as inputs. |
| + pub_get_script = |
| + rebase_path("mojo/public/tools/dart_pub_get.py", ".", mojo_sdk_root) |
| + rebase_dart_sdk_root = rebase_path(mojo_dart_sdk_root, root_build_dir) |
| + rebase_target_dir = rebase_path(target_dir, root_build_dir) |
| + inputs = exec_script(pub_get_script, |
|
tonyg
2015/04/08 13:52:38
Curious about a couple of things:
1. Does pub get
blundell
2015/04/09 11:53:41
The inputs to the inner script are (1) the script
|
| + [ |
| + rebase_dart_sdk_root, |
| + rebase_target_dir, |
| + ], |
| + "list lines", |
| + [ target_dir + "/pubspec.lock" ]) |
| + |
| + # Zip up all the pulled-in files relative to their location in the |
| + # packages dir. |
| + output = "$target_out_dir/$target_name.dartzip" |
| + outputs = [ |
| + output, |
| + ] |
| + rebase_base_dir = rebase_target_dir + "/packages" |
| + rebase_inputs = rebase_path(inputs, root_build_dir) |
| + rebase_output = rebase_path(output, root_build_dir) |
| + args = [ |
| + "--base-dir=$rebase_base_dir", |
| + "--inputs=$rebase_inputs", |
| + "--output=$rebase_output", |
| + ] |
| + } |
| + } |
| + |
| action("${package_target_name}_package") { |
| - script = rebase_path("mojo/public/tools/gn/zip.py", ".", mojo_root) |
| + script = rebase_path("mojo/public/tools/gn/zip.py", ".", mojo_sdk_root) |
| inputs = invoker.sources |
| deps = [] |
| zip_inputs = [] |
| + if (defined(invoker.uses_pub) && invoker.uses_pub) { |
| + deps += [ ":${package_target_name}_pub_get" ] |
| + } |
| + |
| if (defined(invoker.deps)) { |
| deps += invoker.deps |
| - foreach(d, invoker.deps) { |
| + foreach(d, deps) { |
| dep_name = get_label_info(d, "name") |
| dep_target_out_dir = get_label_info(d, "target_out_dir") |
| zip_inputs += [ "$dep_target_out_dir/$dep_name.dartzip" ] |
| @@ -54,7 +95,8 @@ template("dart_package") { |
| } |
| action(target_name) { |
| - script = rebase_path("mojo/public/tools/dart_analyze.py", ".", mojo_root) |
| + script = |
| + rebase_path("mojo/public/tools/dart_analyze.py", ".", mojo_sdk_root) |
| sources = [ |
| package_output, |
| @@ -103,6 +145,9 @@ template("dart_packaged_application") { |
| if (defined(invoker.deps)) { |
| deps = invoker.deps |
| } |
| + if (defined(invoker.uses_pub)) { |
| + uses_pub = invoker.uses_pub |
| + } |
| if (defined(invoker.mojom_deps)) { |
| mojom_deps = invoker.mojom_deps |
| } |
| @@ -112,7 +157,7 @@ template("dart_packaged_application") { |
| } |
| action(target_name) { |
| - script = rebase_path("mojo/public/tools/prepend.py", ".", mojo_root) |
| + script = rebase_path("mojo/public/tools/prepend.py", ".", mojo_sdk_root) |
| input = package_output |
| inputs = [ |