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/module_args/mojo.gni") | |
6 import("mojo.gni") | 5 import("mojo.gni") |
7 import("mojo_sdk.gni") | |
8 | 6 |
9 # Generate a binary mojo application.The parameters of this template are those | 7 # Generate a binary mojo application.The parameters of this template are those |
10 # of a shared library. | 8 # of a shared library. |
11 template("mojo_native_application") { | 9 template("mojo_native_application") { |
12 if (defined(invoker.output_name)) { | 10 if (defined(invoker.output_name)) { |
13 base_target_name = invoker.output_name | 11 base_target_name = invoker.output_name |
14 } else { | 12 } else { |
15 base_target_name = target_name | 13 base_target_name = target_name |
16 } | 14 } |
17 | 15 |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 } | 286 } |
289 } | 287 } |
290 | 288 |
291 if (is_android) { | 289 if (is_android) { |
292 # Declares an Android Mojo application consisting of an .so file and a | 290 # Declares an Android Mojo application consisting of an .so file and a |
293 # corresponding .dex.jar file. | 291 # corresponding .dex.jar file. |
294 # | 292 # |
295 # Variables: | 293 # Variables: |
296 # input_so: the .so file to bundle | 294 # input_so: the .so file to bundle |
297 # input_dex_jar: the .dex.jar file to bundle | 295 # input_dex_jar: the .dex.jar file to bundle |
| 296 # deps / public_deps / data_deps (optional): |
| 297 # Dependencies. The targets that generate the .so/jar inputs should be |
| 298 # listed in either deps or public_deps. |
298 # output_name (optional): override for the output file name | 299 # output_name (optional): override for the output file name |
299 template("mojo_android_application") { | 300 template("mojo_android_application") { |
300 assert(defined(invoker.input_so)) | 301 assert(defined(invoker.input_so)) |
301 assert(defined(invoker.input_dex_jar)) | 302 assert(defined(invoker.input_dex_jar)) |
302 | 303 |
303 zip_action_name = "${target_name}_zip" | 304 zip_action_name = "${target_name}_zip" |
304 zip_action_output = "$target_gen_dir/${target_name}.zip" | 305 zip_action_output = "$target_gen_dir/${target_name}.zip" |
| 306 prepend_action_name = target_name |
305 action(zip_action_name) { | 307 action(zip_action_name) { |
| 308 visibility = [ ":$prepend_action_name" ] |
306 script = "//build/android/gn/zip.py" | 309 script = "//build/android/gn/zip.py" |
307 | 310 |
308 inputs = [ | 311 inputs = [ |
309 invoker.input_so, | 312 invoker.input_so, |
310 invoker.input_dex_jar, | 313 invoker.input_dex_jar, |
311 ] | 314 ] |
312 | 315 |
313 output = zip_action_output | 316 output = zip_action_output |
314 outputs = [ | 317 outputs = [ |
315 output, | 318 output, |
316 ] | 319 ] |
317 | 320 |
318 rebase_inputs = rebase_path(inputs, root_build_dir) | 321 rebase_inputs = rebase_path(inputs, root_build_dir) |
319 rebase_output = rebase_path(output, root_build_dir) | 322 rebase_output = rebase_path(output, root_build_dir) |
320 args = [ | 323 args = [ |
321 "--inputs=$rebase_inputs", | 324 "--inputs=$rebase_inputs", |
322 "--output=$rebase_output", | 325 "--output=$rebase_output", |
323 ] | 326 ] |
| 327 |
| 328 if (defined(invoker.deps)) { |
| 329 deps = invoker.deps |
| 330 } |
| 331 if (defined(invoker.public_deps)) { |
| 332 public_deps = invoker.public_deps |
| 333 } |
| 334 if (defined(invoker.data_deps)) { |
| 335 data_deps = invoker.data_deps |
| 336 } |
324 } | 337 } |
325 | 338 |
326 if (defined(invoker.output_name)) { | 339 if (defined(invoker.output_name)) { |
327 mojo_output = "$root_out_dir/" + invoker.output_name + ".mojo" | 340 mojo_output = "$root_out_dir/" + invoker.output_name + ".mojo" |
328 } else { | 341 } else { |
329 mojo_output = "$root_out_dir/" + target_name + ".mojo" | 342 mojo_output = "$root_out_dir/" + target_name + ".mojo" |
330 } | 343 } |
331 | 344 |
332 action(target_name) { | 345 action(target_name) { |
333 script = rebase_path("mojo/public/tools/prepend.py", ".", mojo_root) | 346 script = rebase_path("mojo/public/tools/prepend.py", ".", mojo_root) |
334 | 347 |
335 input = zip_action_output | 348 input = zip_action_output |
336 inputs = [ | 349 inputs = [ |
337 input, | 350 input, |
338 ] | 351 ] |
339 | 352 |
340 output = mojo_output | 353 output = mojo_output |
341 outputs = [ | 354 outputs = [ |
342 output, | 355 output, |
343 ] | 356 ] |
344 | 357 |
345 rebase_input = rebase_path(input, root_build_dir) | 358 rebase_input = rebase_path(input, root_build_dir) |
346 rebase_output = rebase_path(output, root_build_dir) | 359 rebase_output = rebase_path(output, root_build_dir) |
347 args = [ | 360 args = [ |
348 "--input=$rebase_input", | 361 "--input=$rebase_input", |
349 "--output=$rebase_output", | 362 "--output=$rebase_output", |
350 "--line=#!mojo mojo:android_handler", | 363 "--line=#!mojo mojo:android_handler", |
351 ] | 364 ] |
| 365 |
| 366 public_deps = [ |
| 367 ":$zip_action_name", |
| 368 ] |
352 } | 369 } |
353 } | 370 } |
354 } | 371 } |
OLD | NEW |