Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1467)

Side by Side Diff: mojo/public/dart/rules.gni

Issue 1063233004: Teach dart_package to understand the packages/ subdirectory (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Remove dart-packages Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 # Rules to generate python packaged applications for Dart 5 # Rules to generate python packaged applications for Dart
6 6
7 import("../mojo_sdk.gni") 7 import("//build/module_args/mojo.gni")
8 8
9 template("dart_package") { 9 template("dart_package") {
10 package_target_name = "$target_name" 10 package_target_name = "$target_name"
11 package_output = "$target_out_dir/$target_name.dartzip" 11 package_output = "$target_out_dir/$target_name.dartzip"
12 12
13 if (defined(invoker.uses_pub) && invoker.uses_pub) {
14 # Pull in any dependencies specified via pubspec.yaml and repackage them in
15 # a dartzip file.
16 action("${package_target_name}_pub_get") {
17 target_dir = get_label_info(":$target_name", "dir")
18 script = rebase_path("mojo/public/tools/gn/zip.py", ".", mojo_sdk_root)
19
20 # Run pub get and get a list of the pulled-in files as inputs.
21 pub_get_script =
22 rebase_path("mojo/public/tools/dart_pub_get.py", ".", mojo_sdk_root)
23 rebase_dart_sdk_root = rebase_path(mojo_dart_sdk_root, root_build_dir)
24 rebase_target_dir = rebase_path(target_dir, root_build_dir)
25 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
26 [
27 rebase_dart_sdk_root,
28 rebase_target_dir,
29 ],
30 "list lines",
31 [ target_dir + "/pubspec.lock" ])
32
33 # Zip up all the pulled-in files relative to their location in the
34 # packages dir.
35 output = "$target_out_dir/$target_name.dartzip"
36 outputs = [
37 output,
38 ]
39 rebase_base_dir = rebase_target_dir + "/packages"
40 rebase_inputs = rebase_path(inputs, root_build_dir)
41 rebase_output = rebase_path(output, root_build_dir)
42 args = [
43 "--base-dir=$rebase_base_dir",
44 "--inputs=$rebase_inputs",
45 "--output=$rebase_output",
46 ]
47 }
48 }
49
13 action("${package_target_name}_package") { 50 action("${package_target_name}_package") {
14 script = rebase_path("mojo/public/tools/gn/zip.py", ".", mojo_root) 51 script = rebase_path("mojo/public/tools/gn/zip.py", ".", mojo_sdk_root)
15 52
16 inputs = invoker.sources 53 inputs = invoker.sources
17 54
18 deps = [] 55 deps = []
19 zip_inputs = [] 56 zip_inputs = []
20 57
58 if (defined(invoker.uses_pub) && invoker.uses_pub) {
59 deps += [ ":${package_target_name}_pub_get" ]
60 }
61
21 if (defined(invoker.deps)) { 62 if (defined(invoker.deps)) {
22 deps += invoker.deps 63 deps += invoker.deps
23 foreach(d, invoker.deps) { 64 foreach(d, deps) {
24 dep_name = get_label_info(d, "name") 65 dep_name = get_label_info(d, "name")
25 dep_target_out_dir = get_label_info(d, "target_out_dir") 66 dep_target_out_dir = get_label_info(d, "target_out_dir")
26 zip_inputs += [ "$dep_target_out_dir/$dep_name.dartzip" ] 67 zip_inputs += [ "$dep_target_out_dir/$dep_name.dartzip" ]
27 } 68 }
28 } 69 }
29 70
30 if (defined(invoker.datadeps)) { 71 if (defined(invoker.datadeps)) {
31 datadeps = invoker.datadeps 72 datadeps = invoker.datadeps
32 } 73 }
33 74
(...skipping 13 matching lines...) Expand all
47 rebase_output = rebase_path(output, root_build_dir) 88 rebase_output = rebase_path(output, root_build_dir)
48 args = [ 89 args = [
49 "--base-dir=$rebase_base_dir", 90 "--base-dir=$rebase_base_dir",
50 "--inputs=$rebase_inputs", 91 "--inputs=$rebase_inputs",
51 "--zip-inputs=$rebase_zip_inputs", 92 "--zip-inputs=$rebase_zip_inputs",
52 "--output=$rebase_output", 93 "--output=$rebase_output",
53 ] 94 ]
54 } 95 }
55 96
56 action(target_name) { 97 action(target_name) {
57 script = rebase_path("mojo/public/tools/dart_analyze.py", ".", mojo_root) 98 script =
99 rebase_path("mojo/public/tools/dart_analyze.py", ".", mojo_sdk_root)
58 100
59 sources = [ 101 sources = [
60 package_output, 102 package_output,
61 ] 103 ]
62 104
63 args = [ 105 args = [
64 rebase_path(package_output), 106 rebase_path(package_output),
65 rebase_path("$target_gen_dir/${package_target_name}_analyze.stamp"), 107 rebase_path("$target_gen_dir/${package_target_name}_analyze.stamp"),
66 "--no-hints", 108 "--no-hints",
67 ] 109 ]
(...skipping 28 matching lines...) Expand all
96 mojo_output = "$root_out_dir/" + invoker.output_name + ".mojo" 138 mojo_output = "$root_out_dir/" + invoker.output_name + ".mojo"
97 } else { 139 } else {
98 mojo_output = "$root_out_dir/" + target_name + ".mojo" 140 mojo_output = "$root_out_dir/" + target_name + ".mojo"
99 } 141 }
100 142
101 dart_package(package_name) { 143 dart_package(package_name) {
102 sources = invoker.sources 144 sources = invoker.sources
103 if (defined(invoker.deps)) { 145 if (defined(invoker.deps)) {
104 deps = invoker.deps 146 deps = invoker.deps
105 } 147 }
148 if (defined(invoker.uses_pub)) {
149 uses_pub = invoker.uses_pub
150 }
106 if (defined(invoker.mojom_deps)) { 151 if (defined(invoker.mojom_deps)) {
107 mojom_deps = invoker.mojom_deps 152 mojom_deps = invoker.mojom_deps
108 } 153 }
109 if (defined(invoker.datadeps)) { 154 if (defined(invoker.datadeps)) {
110 datadeps = invoker.datadeps 155 datadeps = invoker.datadeps
111 } 156 }
112 } 157 }
113 158
114 action(target_name) { 159 action(target_name) {
115 script = rebase_path("mojo/public/tools/prepend.py", ".", mojo_root) 160 script = rebase_path("mojo/public/tools/prepend.py", ".", mojo_sdk_root)
116 161
117 input = package_output 162 input = package_output
118 inputs = [ 163 inputs = [
119 input, 164 input,
120 ] 165 ]
121 166
122 output = mojo_output 167 output = mojo_output
123 outputs = [ 168 outputs = [
124 output, 169 output,
125 ] 170 ]
(...skipping 18 matching lines...) Expand all
144 189
145 rebase_input = rebase_path(input, root_build_dir) 190 rebase_input = rebase_path(input, root_build_dir)
146 rebase_output = rebase_path(output, root_build_dir) 191 rebase_output = rebase_path(output, root_build_dir)
147 args = [ 192 args = [
148 "--input=$rebase_input", 193 "--input=$rebase_input",
149 "--output=$rebase_output", 194 "--output=$rebase_output",
150 "--line=$line", 195 "--line=$line",
151 ] 196 ]
152 } 197 }
153 } 198 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698