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 # 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("../mojo_sdk.gni") |
8 | 8 |
9 template("dart_package") { | 9 template("dart_package") { |
10 action(target_name) { | 10 action(target_name) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 package_name = "${target_name}_package" | 56 package_name = "${target_name}_package" |
57 package_analyze_sources = "${target_name}_analyze" | 57 package_analyze_sources = "${target_name}_analyze" |
58 package_output = "$target_out_dir/$package_name.dartzip" | 58 package_output = "$target_out_dir/$package_name.dartzip" |
59 | 59 |
60 if (defined(invoker.output_name)) { | 60 if (defined(invoker.output_name)) { |
61 mojo_output = "$root_out_dir/" + invoker.output_name + ".mojo" | 61 mojo_output = "$root_out_dir/" + invoker.output_name + ".mojo" |
62 } else { | 62 } else { |
63 mojo_output = "$root_out_dir/" + target_name + ".mojo" | 63 mojo_output = "$root_out_dir/" + target_name + ".mojo" |
64 } | 64 } |
65 | 65 |
66 action_foreach(package_analyze_sources) { | 66 action(package_analyze_sources) { |
67 sources = invoker.sources | |
68 | |
69 script = rebase_path("mojo/public/tools/dart_analyze.py", ".", mojo_root) | 67 script = rebase_path("mojo/public/tools/dart_analyze.py", ".", mojo_root) |
70 | 68 |
| 69 sources = [ |
| 70 package_output, |
| 71 ] |
| 72 |
71 args = [ | 73 args = [ |
72 rebase_path(root_gen_dir), | 74 rebase_path(package_output), |
73 rebase_path("$target_gen_dir/{{source_name_part}}.stamp"), | 75 rebase_path("$target_gen_dir/${target_name}_analyze.stamp"), |
74 "{{source}}", | |
75 "--no-hints", | 76 "--no-hints", |
76 "--url-mapping=mojo:application,/" + | 77 "--url-mapping=mojo:application,/" + |
77 rebase_path("mojo/public/dart/application.dart", "/", mojo_root), | 78 rebase_path("mojo/public/dart/application.dart", "/", mojo_root), |
78 "--url-mapping=mojo:bindings,/" + | 79 "--url-mapping=mojo:bindings,/" + |
79 rebase_path("mojo/public/dart/bindings.dart", "/", mojo_root), | 80 rebase_path("mojo/public/dart/bindings.dart", "/", mojo_root), |
80 "--url-mapping=mojo:builtin,/" + | 81 "--url-mapping=mojo:builtin,/" + |
81 rebase_path("mojo/dart/embedder/builtin.dart", "/", mojo_root), | 82 rebase_path("mojo/dart/embedder/builtin.dart", "/", mojo_root), |
82 "--url-mapping=mojo:core,/" + | 83 "--url-mapping=mojo:core,/" + |
83 rebase_path("mojo/public/dart/core.dart", "/", mojo_root), | 84 rebase_path("mojo/public/dart/core.dart", "/", mojo_root), |
| 85 |
| 86 # The dart bindings refer to the autogenerated application interface in |
| 87 # their source code; since that code is then packaged into the image, we |
| 88 # need to manually resolve these package urls to the autogenerated code. |
| 89 "--url-mapping=package:mojo/public/interfaces/application/application.mojo
m.dart,/" + rebase_path( |
| 90 "mojo/public/interfaces/application/application.mojom.dart", |
| 91 "/", |
| 92 root_gen_dir + mojo_root), |
| 93 "--url-mapping=package:mojo/public/interfaces/application/service_provider
.mojom.dart,/" + rebase_path( |
| 94 "mojo/public/interfaces/application/service_provider.mojom.dart", |
| 95 "/", |
| 96 root_gen_dir + mojo_root), |
| 97 "--url-mapping=package:mojo/public/interfaces/application/shell.mojom.dart
,/" + rebase_path( |
| 98 "mojo/public/interfaces/application/shell.mojom.dart", |
| 99 "/", |
| 100 root_gen_dir + mojo_root), |
84 ] | 101 ] |
85 | 102 |
86 if (defined(invoker.deps)) { | 103 if (defined(invoker.deps)) { |
87 deps = invoker.deps | 104 deps = invoker.deps |
88 } | 105 } |
89 | 106 |
90 if (defined(invoker.datadeps)) { | 107 if (defined(invoker.datadeps)) { |
91 datadeps = invoker.datadeps | 108 datadeps = invoker.datadeps |
92 } | 109 } |
93 | 110 |
94 outputs = [ | 111 outputs = [ |
95 "$target_gen_dir/{{source_name_part}}.stamp", | 112 "$target_gen_dir/${target_name}_analyze.stamp", |
96 ] | 113 ] |
97 } | 114 } |
98 | 115 |
99 dart_package(package_name) { | 116 dart_package(package_name) { |
100 sources = invoker.sources | 117 sources = invoker.sources |
101 if (defined(invoker.deps)) { | 118 if (defined(invoker.deps)) { |
102 deps = invoker.deps | 119 deps = invoker.deps |
103 } | 120 } |
104 if (defined(invoker.mojom_deps)) { | 121 if (defined(invoker.mojom_deps)) { |
105 mojom_deps = invoker.mojom_deps | 122 mojom_deps = invoker.mojom_deps |
(...skipping 10 matching lines...) Expand all Loading... |
116 inputs = [ | 133 inputs = [ |
117 input, | 134 input, |
118 ] | 135 ] |
119 | 136 |
120 output = mojo_output | 137 output = mojo_output |
121 outputs = [ | 138 outputs = [ |
122 output, | 139 output, |
123 ] | 140 ] |
124 | 141 |
125 deps = [ | 142 deps = [ |
126 # TODO(erg): When dartanalyze runs at an acceptable speed, add | 143 ":$package_analyze_sources", |
127 # ":$package_analyze_sources" as a dependency here and remove the | |
128 # manual group("check") in the toplevel build file. | |
129 ":$package_name", | 144 ":$package_name", |
130 ] | 145 ] |
131 if (defined(invoker.deps)) { | 146 if (defined(invoker.deps)) { |
132 deps += invoker.deps | 147 deps += invoker.deps |
133 } | 148 } |
134 if (defined(invoker.mojom_deps)) { | 149 if (defined(invoker.mojom_deps)) { |
135 deps += invoker.mojom_deps | 150 deps += invoker.mojom_deps |
136 } | 151 } |
137 if (defined(invoker.datadeps)) { | 152 if (defined(invoker.datadeps)) { |
138 datadeps = invoker.datadeps | 153 datadeps = invoker.datadeps |
139 } | 154 } |
140 | 155 |
141 line = "#!mojo mojo:dart_content_handler" | 156 line = "#!mojo mojo:dart_content_handler" |
142 if (is_debug || (defined(invoker.strict) && invoker.strict == true)) { | 157 if (is_debug || (defined(invoker.strict) && invoker.strict == true)) { |
143 line = "#!mojo mojo:dart_content_handler?strict=true" | 158 line = "#!mojo mojo:dart_content_handler?strict=true" |
144 } | 159 } |
145 | 160 |
146 rebase_input = rebase_path(input, root_build_dir) | 161 rebase_input = rebase_path(input, root_build_dir) |
147 rebase_output = rebase_path(output, root_build_dir) | 162 rebase_output = rebase_path(output, root_build_dir) |
148 args = [ | 163 args = [ |
149 "--input=$rebase_input", | 164 "--input=$rebase_input", |
150 "--output=$rebase_output", | 165 "--output=$rebase_output", |
151 "--line=$line", | 166 "--line=$line", |
152 ] | 167 ] |
153 } | 168 } |
154 } | 169 } |
OLD | NEW |