OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import("//build/toolchain/toolchain.gni") | 5 import("//build/toolchain/toolchain.gni") |
| 6 import("//mojo/public/mojo_constants.gni") |
6 | 7 |
7 if (is_android) { | 8 if (is_android) { |
8 import("//build/config/android/rules.gni") | 9 import("//build/config/android/rules.gni") |
9 import("//build/config/zip.gni") | 10 import("//build/config/zip.gni") |
10 } | 11 } |
11 | 12 |
12 # Generate a binary Mojo application in a self-named directory. | 13 # Generate a binary Mojo application in a self-named directory. |
13 # Application resources are copied to a "resources" directory alongside the app. | 14 # Application resources are copied to a "resources" directory alongside the app. |
14 # The parameters of this template are those of a shared library. | 15 # The parameters of this template are those of a shared library. |
15 template("mojo_native_application") { | 16 template("mojo_native_application") { |
16 base_target_name = target_name | 17 base_target_name = target_name |
17 if (defined(invoker.output_name)) { | 18 if (defined(invoker.output_name)) { |
18 base_target_name = invoker.output_name | 19 base_target_name = invoker.output_name |
19 } | 20 } |
20 | 21 |
21 final_target_name = target_name | 22 final_target_name = target_name |
22 | 23 |
23 mojo_deps = [] | 24 mojo_deps = [] |
24 if (defined(invoker.deps)) { | 25 if (defined(invoker.deps)) { |
25 mojo_deps += invoker.deps | 26 mojo_deps += invoker.deps |
26 } | 27 } |
27 | 28 |
28 mojo_data_deps = [] | 29 mojo_data_deps = [] |
29 | 30 |
30 if (defined(invoker.resources)) { | 31 if (defined(invoker.resources)) { |
31 copy_step_name = "${base_target_name}__copy_resources" | 32 copy_step_name = "${base_target_name}__copy_resources" |
32 copy(copy_step_name) { | 33 copy(copy_step_name) { |
33 sources = invoker.resources | 34 sources = invoker.resources |
34 outputs = [ | 35 outputs = [ |
35 "${root_out_dir}/${base_target_name}/resources/{{source_file_part}}", | 36 "${root_out_dir}/${mojo_application_subdir}/${base_target_name}/resource
s/{{source_file_part}}", |
36 ] | 37 ] |
37 if (defined(invoker.testonly)) { | 38 if (defined(invoker.testonly)) { |
38 testonly = invoker.testonly | 39 testonly = invoker.testonly |
39 } | 40 } |
40 deps = mojo_deps | 41 deps = mojo_deps |
41 } | 42 } |
42 mojo_data_deps += [ ":$copy_step_name" ] | 43 mojo_data_deps += [ ":$copy_step_name" ] |
43 } | 44 } |
44 | 45 |
45 output = base_target_name + ".mojo" | 46 output = base_target_name + ".mojo" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 "visibility", | 135 "visibility", |
135 ]) | 136 ]) |
136 deps = [ | 137 deps = [ |
137 ":${library_target_name}", | 138 ":${library_target_name}", |
138 ] | 139 ] |
139 | 140 |
140 sources = [ | 141 sources = [ |
141 "${root_shlib_dir}/${library_name}", | 142 "${root_shlib_dir}/${library_name}", |
142 ] | 143 ] |
143 outputs = [ | 144 outputs = [ |
144 "${root_out_dir}/${base_target_name}/${output}", | 145 "${root_out_dir}/${mojo_application_subdir}/${base_target_name}/${output}"
, |
145 ] | 146 ] |
146 } | 147 } |
147 | 148 |
148 if (is_android) { | 149 if (is_android) { |
149 android_assets("${final_target_name}_assets") { | 150 android_assets("${final_target_name}_assets") { |
150 forward_variables_from(invoker, [ "testonly" ]) | 151 forward_variables_from(invoker, [ "testonly" ]) |
151 deps = [ | 152 deps = [ |
152 ":${library_target_name}", | 153 ":${library_target_name}", |
153 ] | 154 ] |
154 if (defined(invoker.deps)) { | 155 if (defined(invoker.deps)) { |
(...skipping 30 matching lines...) Expand all Loading... |
185 if (defined(invoker.output_name)) { | 186 if (defined(invoker.output_name)) { |
186 base_target_name = invoker.output_name | 187 base_target_name = invoker.output_name |
187 } | 188 } |
188 | 189 |
189 mojo_data_deps = [] | 190 mojo_data_deps = [] |
190 if (defined(invoker.resources)) { | 191 if (defined(invoker.resources)) { |
191 copy_step_name = "${base_target_name}__copy_resources" | 192 copy_step_name = "${base_target_name}__copy_resources" |
192 copy(copy_step_name) { | 193 copy(copy_step_name) { |
193 sources = invoker.resources | 194 sources = invoker.resources |
194 outputs = [ | 195 outputs = [ |
195 "${root_out_dir}/${base_target_name}/resources/{{source_file_part}}", | 196 "${root_out_dir}/${mojo_application_subdir}/${base_target_name}/resour
ces/{{source_file_part}}", |
196 ] | 197 ] |
197 if (defined(invoker.testonly)) { | 198 if (defined(invoker.testonly)) { |
198 testonly = invoker.testonly | 199 testonly = invoker.testonly |
199 } | 200 } |
200 if (defined(invoker.deps)) { | 201 if (defined(invoker.deps)) { |
201 deps = invoker.deps | 202 deps = invoker.deps |
202 } | 203 } |
203 } | 204 } |
204 mojo_data_deps += [ ":$copy_step_name" ] | 205 mojo_data_deps += [ ":$copy_step_name" ] |
205 } | 206 } |
206 | 207 |
207 zip_action_name = "${target_name}_zip" | 208 zip_action_name = "${target_name}_zip" |
208 zip_action_output = "$target_gen_dir/${target_name}.zip" | 209 zip_action_output = "$target_gen_dir/${target_name}.zip" |
209 prepend_action_name = target_name | 210 prepend_action_name = target_name |
210 zip(zip_action_name) { | 211 zip(zip_action_name) { |
211 visibility = [ ":$prepend_action_name" ] | 212 visibility = [ ":$prepend_action_name" ] |
212 inputs = [ | 213 inputs = [ |
213 invoker.input_so, | 214 invoker.input_so, |
214 invoker.input_dex_jar, | 215 invoker.input_dex_jar, |
215 ] | 216 ] |
216 output = zip_action_output | 217 output = zip_action_output |
217 forward_variables_from(invoker, | 218 forward_variables_from(invoker, |
218 [ | 219 [ |
219 "deps", | 220 "deps", |
220 "public_deps", | 221 "public_deps", |
221 "data_deps", | 222 "data_deps", |
222 ]) | 223 ]) |
223 } | 224 } |
224 | 225 |
225 _mojo_output = | 226 _mojo_output = "${root_out_dir}/${mojo_application_subdir}/${base_target_nam
e}/${base_target_name}.mojo" |
226 "${root_out_dir}/${base_target_name}/${base_target_name}.mojo" | |
227 | 227 |
228 action(target_name) { | 228 action(target_name) { |
229 script = "//mojo/public/tools/prepend.py" | 229 script = "//mojo/public/tools/prepend.py" |
230 | 230 |
231 input = zip_action_output | 231 input = zip_action_output |
232 inputs = [ | 232 inputs = [ |
233 input, | 233 input, |
234 ] | 234 ] |
235 | 235 |
236 outputs = [ | 236 outputs = [ |
(...skipping 24 matching lines...) Expand all Loading... |
261 renaming_destinations = [ "${base_target_name}/${base_target_name}.mojo" ] | 261 renaming_destinations = [ "${base_target_name}/${base_target_name}.mojo" ] |
262 if (defined(invoker.resources)) { | 262 if (defined(invoker.resources)) { |
263 renaming_sources += invoker.resources | 263 renaming_sources += invoker.resources |
264 renaming_destinations += process_file_template( | 264 renaming_destinations += process_file_template( |
265 invoker.resources, | 265 invoker.resources, |
266 [ "$base_target_name/resources/{{source_file_part}}" ]) | 266 [ "$base_target_name/resources/{{source_file_part}}" ]) |
267 } | 267 } |
268 } | 268 } |
269 } | 269 } |
270 } | 270 } |
OLD | NEW |