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

Side by Side Diff: mojo/public/mojo_application.gni

Issue 1225393003: Refactor mojo_android_application (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « examples/device_name/BUILD.gn ('k') | services/android/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 args = [ 304 args = [
305 "--input=$rebase_input", 305 "--input=$rebase_input",
306 "--output=$rebase_output", 306 "--output=$rebase_output",
307 "--line=#!mojo mojo:nacl_content_handler", 307 "--line=#!mojo mojo:nacl_content_handler",
308 ] 308 ]
309 } 309 }
310 } 310 }
311 } 311 }
312 312
313 if (is_android) { 313 if (is_android) {
314 import("//build/config/android/rules.gni")
315
314 # Declares an Android Mojo application consisting of an .so file and a 316 # Declares an Android Mojo application consisting of an .so file and a
315 # corresponding .dex.jar file. 317 # corresponding .dex.jar file.
316 # 318 #
317 # Variables: 319 # Variables:
318 # input_so: the .so file to bundle 320 # sources (optional): The c++ sources.
319 # input_dex_jar: the .dex.jar file to bundle 321 # deps (optional): The c++ dependencies.
320 # deps / public_deps / data_deps (optional): 322 # java_sources (optional): The java sources.
321 # Dependencies. The targets that generate the .so/jar inputs should be 323 # java_deps (optional): The java dependencies.
322 # listed in either deps or public_deps. 324 # jni_package (optional): The c++ package for the generated jni headers.
323 # output_name (optional): override for the output file name 325 # output_name (optional): override for the output file name
326 # public_deps / data_deps (optional): Dependencies.
324 template("mojo_android_application") { 327 template("mojo_android_application") {
325 assert(defined(invoker.input_so)) 328 shared_library_name = "__${target_name}_lib"
326 assert(defined(invoker.input_dex_jar)) 329 library_basename = "lib${shared_library_name}.so"
330 if (defined(invoker.jni_package)) {
331 assert(defined(invoker.java_sources))
332 generate_jni_name = "__${target_name}_jni"
333 }
334 if (defined(invoker.java_sources)) {
335 java_library_name = "__${target_name}_java"
336 }
337 android_standalone_library_name = "__${target_name}_java_lib"
338 dex_output_path = "${target_gen_dir}/${target_name}.dex.jar"
339 zip_action_name = "__${target_name}_zip"
340 zip_action_output = "${target_gen_dir}/${target_name}.zip"
341 copy_symbols_target = "__${target_name}_copy_symbols"
342 final_target_name = target_name
327 343
328 zip_action_name = "${target_name}_zip" 344 if (defined(invoker.jni_package)) {
329 zip_action_output = "$target_gen_dir/${target_name}.zip" 345 generate_jni(generate_jni_name) {
330 prepend_action_name = target_name 346 visibility = [ ":${shared_library_name}" ]
347
348 sources = invoker.java_sources
349 jni_package = invoker.jni_package
350 }
351 }
352
353 shared_library(shared_library_name) {
354 visibility = [
355 ":${copy_symbols_target}",
356 ":${zip_action_name}",
357 ]
358
359 if (defined(invoker.sources)) {
360 sources = invoker.sources
361 }
362
363 deps = []
364 if (defined(invoker.jni_package)) {
365 deps += [ ":${generate_jni_name}" ]
366 }
367 if (defined(invoker.deps)) {
368 deps += invoker.deps
369 }
370 }
371
372 copy(copy_symbols_target) {
373 visibility = [ ":${final_target_name}" ]
374 deps = [
375 ":${shared_library_name}",
376 ]
377
378 sources = [
379 "${root_out_dir}/${library_basename}",
380 ]
381 outputs = [
382 "${root_out_dir}/symbols/${library_basename}",
383 ]
384 }
385
386 if (defined(invoker.java_sources)) {
387 android_library(java_library_name) {
388 visibility = [ ":*" ]
389
390 java_files = invoker.java_sources
391
392 if (defined(invoker.java_deps)) {
393 deps = invoker.java_deps
394 }
395 }
396 }
397
398 android_standalone_library(android_standalone_library_name) {
399 deps = []
400
401 if (defined(invoker.java_sources)) {
402 deps += [ ":${java_library_name}" ]
403 }
404
405 if (defined(invoker.java_deps)) {
406 deps += invoker.java_deps
407 }
408
409 dex_path = dex_output_path
410 }
411
331 action(zip_action_name) { 412 action(zip_action_name) {
332 visibility = [ ":$prepend_action_name" ] 413 visibility = [ ":${final_target_name}" ]
333 script = "//build/android/gn/zip.py" 414 script = "//build/android/gn/zip.py"
334 415
335 inputs = [ 416 inputs = [
336 invoker.input_so, 417 "${root_out_dir}/lib.stripped/${library_basename}",
337 invoker.input_dex_jar, 418 dex_output_path,
338 ] 419 ]
339 420
340 output = zip_action_output 421 output = zip_action_output
341 outputs = [ 422 outputs = [
342 output, 423 output,
343 ] 424 ]
344 425
345 rebase_inputs = rebase_path(inputs, root_build_dir) 426 rebase_inputs = rebase_path(inputs, root_build_dir)
346 rebase_output = rebase_path(output, root_build_dir) 427 rebase_output = rebase_path(output, root_build_dir)
347 args = [ 428 args = [
348 "--inputs=$rebase_inputs", 429 "--inputs=${rebase_inputs}",
349 "--output=$rebase_output", 430 "--output=${rebase_output}",
350 ] 431 ]
351 432
352 if (defined(invoker.deps)) { 433 if (defined(invoker.deps)) {
353 deps = invoker.deps 434 deps = invoker.deps
354 } 435 }
355 if (defined(invoker.public_deps)) { 436 if (defined(invoker.public_deps)) {
356 public_deps = invoker.public_deps 437 public_deps = invoker.public_deps
357 } 438 }
358 if (defined(invoker.data_deps)) { 439 if (defined(invoker.data_deps)) {
359 data_deps = invoker.data_deps 440 data_deps = invoker.data_deps
360 } 441 }
361 } 442 }
362 443
363 if (defined(invoker.output_name)) { 444 if (defined(invoker.output_name)) {
364 mojo_output = "$root_out_dir/" + invoker.output_name + ".mojo" 445 mojo_output = "${root_out_dir}/" + invoker.output_name + ".mojo"
365 } else { 446 } else {
366 mojo_output = "$root_out_dir/" + target_name + ".mojo" 447 mojo_output = "${root_out_dir}/" + target_name + ".mojo"
367 } 448 }
368 449
369 action(target_name) { 450 action(final_target_name) {
370 script = rebase_path("mojo/public/tools/prepend.py", ".", mojo_root) 451 script = rebase_path("mojo/public/tools/prepend.py", ".", mojo_root)
371 452
372 input = zip_action_output 453 input = zip_action_output
373 inputs = [ 454 inputs = [
374 input, 455 input,
375 ] 456 ]
376 457
377 output = mojo_output 458 output = mojo_output
378 outputs = [ 459 outputs = [
379 output, 460 output,
380 ] 461 ]
381 462
382 rebase_input = rebase_path(input, root_build_dir) 463 rebase_input = rebase_path(input, root_build_dir)
383 rebase_output = rebase_path(output, root_build_dir) 464 rebase_output = rebase_path(output, root_build_dir)
384 args = [ 465 args = [
385 "--input=$rebase_input", 466 "--input=${rebase_input}",
386 "--output=$rebase_output", 467 "--output=${rebase_output}",
387 "--line=#!mojo mojo:android_handler", 468 "--line=#!mojo mojo:android_handler",
388 ] 469 ]
389 470
471 deps = [
472 ":${copy_symbols_target}",
473 ]
474
390 public_deps = [ 475 public_deps = [
391 ":$zip_action_name", 476 ":${zip_action_name}",
392 ] 477 ]
393 } 478 }
394 } 479 }
395 } 480 }
OLDNEW
« no previous file with comments | « examples/device_name/BUILD.gn ('k') | services/android/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698