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