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/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
6 import("//build/config/zip.gni") | 6 import("//build/config/zip.gni") |
7 import("//third_party/ijar/ijar.gni") | 7 import("//third_party/ijar/ijar.gni") |
8 | 8 |
9 assert(is_android) | 9 assert(is_android) |
10 | 10 |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 } | 472 } |
473 | 473 |
474 # Creates an unsigned .apk. | 474 # Creates an unsigned .apk. |
475 # | 475 # |
476 # Variables | 476 # Variables |
477 # deps: Specifies the dependencies of this target. | 477 # deps: Specifies the dependencies of this target. |
478 # dex_path: Path to classes.dex file to include (optional). | 478 # dex_path: Path to classes.dex file to include (optional). |
479 # resource_packaged_apk_path: Path to .ap_ to use. | 479 # resource_packaged_apk_path: Path to .ap_ to use. |
480 # output_apk_path: Output path for the generated .apk. | 480 # output_apk_path: Output path for the generated .apk. |
481 # native_libs_dir: Directory containing native libraries. | 481 # native_libs_dir: Directory containing native libraries. |
| 482 # create_placeholder_lib: Whether to add a dummy lib to the apk. |
482 template("package_apk") { | 483 template("package_apk") { |
483 action(target_name) { | 484 action(target_name) { |
484 forward_variables_from(invoker, | 485 forward_variables_from(invoker, |
485 [ | 486 [ |
486 "deps", | 487 "deps", |
487 "public_deps", | 488 "public_deps", |
488 "testonly", | 489 "testonly", |
489 ]) | 490 ]) |
| 491 _create_placeholder_lib = defined(invoker.create_placeholder_lib) && |
| 492 invoker.create_placeholder_lib |
| 493 |
490 script = "//build/android/gyp/apkbuilder.py" | 494 script = "//build/android/gyp/apkbuilder.py" |
491 depfile = "$target_gen_dir/$target_name.d" | 495 depfile = "$target_gen_dir/$target_name.d" |
492 data_deps = [ | 496 data_deps = [ |
493 "//tools/android/md5sum", | 497 "//tools/android/md5sum", |
494 ] # Used when deploying APKs | 498 ] # Used when deploying APKs |
495 | 499 |
496 inputs = [ | 500 inputs = [ |
497 invoker.resource_packaged_apk_path, | 501 invoker.resource_packaged_apk_path, |
498 ] | 502 ] |
499 if (defined(invoker.dex_path)) { | 503 if (defined(invoker.dex_path)) { |
(...skipping 12 matching lines...) Expand all Loading... |
512 args = [ | 516 args = [ |
513 "--depfile", | 517 "--depfile", |
514 rebase_path(depfile, root_build_dir), | 518 rebase_path(depfile, root_build_dir), |
515 "--resource-apk=$_rebased_resource_packaged_apk_path", | 519 "--resource-apk=$_rebased_resource_packaged_apk_path", |
516 "--output-apk=$_rebased_packaged_apk_path", | 520 "--output-apk=$_rebased_packaged_apk_path", |
517 ] | 521 ] |
518 if (defined(invoker.dex_path)) { | 522 if (defined(invoker.dex_path)) { |
519 _rebased_dex_path = rebase_path(invoker.dex_path, root_build_dir) | 523 _rebased_dex_path = rebase_path(invoker.dex_path, root_build_dir) |
520 args += [ "--dex-file=$_rebased_dex_path" ] | 524 args += [ "--dex-file=$_rebased_dex_path" ] |
521 } | 525 } |
| 526 if (defined(invoker.native_libs_dir) || _create_placeholder_lib) { |
| 527 args += [ "--android-abi=$android_app_abi" ] |
| 528 } |
522 if (defined(invoker.native_libs_dir)) { | 529 if (defined(invoker.native_libs_dir)) { |
523 _rebased_native_libs_dir = | 530 _rebased_native_libs_dir = |
524 rebase_path(invoker.native_libs_dir, root_build_dir) | 531 rebase_path(invoker.native_libs_dir, root_build_dir) |
525 args += [ | 532 args += [ "--native-libs-dir=$_rebased_native_libs_dir/$android_app_abi" ] |
526 "--native-libs-dir=$_rebased_native_libs_dir/$android_app_abi", | 533 } |
527 "--android-abi=$android_app_abi", | 534 if (_create_placeholder_lib) { |
528 ] | 535 args += [ "--create-placeholder-lib" ] |
529 } | 536 } |
530 } | 537 } |
531 } | 538 } |
532 | 539 |
533 # Signs & zipaligns an apk. | 540 # Signs & zipaligns an apk. |
534 # | 541 # |
535 # Variables | 542 # Variables |
536 # input_apk_path: Path of the .apk to be finalized. | 543 # input_apk_path: Path of the .apk to be finalized. |
537 # output_apk_path: Output path for the generated .apk. | 544 # output_apk_path: Output path for the generated .apk. |
538 # keystore_path: Path to keystore to use for signing. | 545 # keystore_path: Path to keystore to use for signing. |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 deps = _incremental_deps + [ | 813 deps = _incremental_deps + [ |
807 ":${_incremental_package_resources_target_name}", | 814 ":${_incremental_package_resources_target_name}", |
808 _dex_target, | 815 _dex_target, |
809 ] | 816 ] |
810 | 817 |
811 if (defined(_dex_path)) { | 818 if (defined(_dex_path)) { |
812 dex_path = | 819 dex_path = |
813 get_label_info(_dex_target, "target_gen_dir") + "/bootstrap.dex" | 820 get_label_info(_dex_target, "target_gen_dir") + "/bootstrap.dex" |
814 } | 821 } |
815 | 822 |
816 # TODO(agrieve): Add a placeholder .so for http://crbug.com/384638 | 823 # http://crbug.com/384638 |
| 824 if (defined(invoker.native_libs_dir)) { |
| 825 create_placeholder_lib = true |
| 826 } |
| 827 |
817 output_apk_path = _incremental_packaged_apk_path | 828 output_apk_path = _incremental_packaged_apk_path |
818 resource_packaged_apk_path = _incremental_resource_packaged_apk_path | 829 resource_packaged_apk_path = _incremental_resource_packaged_apk_path |
819 } | 830 } |
820 | 831 |
821 _finalize_apk_rule_name = "${target_name}__finalize" | 832 _finalize_apk_rule_name = "${target_name}__finalize" |
822 finalize_apk(_finalize_apk_rule_name) { | 833 finalize_apk(_finalize_apk_rule_name) { |
823 input_apk_path = _packaged_apk_path | 834 input_apk_path = _packaged_apk_path |
824 output_apk_path = _final_apk_path | 835 output_apk_path = _final_apk_path |
825 keystore_path = _keystore_path | 836 keystore_path = _keystore_path |
826 keystore_name = _keystore_name | 837 keystore_name = _keystore_name |
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1646 ] | 1657 ] |
1647 args = [ | 1658 args = [ |
1648 "--depfile", | 1659 "--depfile", |
1649 rebase_path(depfile, root_build_dir), | 1660 rebase_path(depfile, root_build_dir), |
1650 "--script-output-path", | 1661 "--script-output-path", |
1651 rebase_path(generated_script, root_build_dir), | 1662 rebase_path(generated_script, root_build_dir), |
1652 ] | 1663 ] |
1653 args += test_runner_args | 1664 args += test_runner_args |
1654 } | 1665 } |
1655 } | 1666 } |
OLD | NEW |