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/android/internal_rules.gni") | 6 import("//build/config/android/internal_rules.gni") |
7 import("//tools/grit/grit_rule.gni") | 7 import("//tools/grit/grit_rule.gni") |
8 | 8 |
9 assert(is_android) | 9 assert(is_android) |
10 | 10 |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 resource_srcjar_path = "$base_path.resources.srcjar" | 613 resource_srcjar_path = "$base_path.resources.srcjar" |
614 jar_path = "$base_path.jar" | 614 jar_path = "$base_path.jar" |
615 final_dex_path = "$gen_dir/classes.dex" | 615 final_dex_path = "$gen_dir/classes.dex" |
616 _template_name = target_name | 616 _template_name = target_name |
617 _final_apk_path = "" | 617 _final_apk_path = "" |
618 if (defined(invoker.final_apk_path)) { | 618 if (defined(invoker.final_apk_path)) { |
619 _final_apk_path = invoker.final_apk_path | 619 _final_apk_path = invoker.final_apk_path |
620 } else if (defined(invoker.apk_name)) { | 620 } else if (defined(invoker.apk_name)) { |
621 _final_apk_path = "$root_build_dir/apks/" + invoker.apk_name + ".apk" | 621 _final_apk_path = "$root_build_dir/apks/" + invoker.apk_name + ".apk" |
622 } | 622 } |
| 623 _dist_jar_path_list = process_file_template( |
| 624 [ _final_apk_path ], |
| 625 "$root_build_dir/test.lib.java/{{source_name_part}}.jar" |
| 626 ) |
| 627 _dist_jar_path = _dist_jar_path_list[0] |
623 | 628 |
624 _native_libs = [] | 629 _native_libs = [] |
625 if (defined(invoker.native_libs)) { | 630 if (defined(invoker.native_libs)) { |
626 _native_libs = invoker.native_libs | 631 _native_libs = invoker.native_libs |
627 _native_libs_dir = base_path + "/libs" | 632 _native_libs_dir = base_path + "/libs" |
628 } | 633 } |
629 | 634 |
| 635 _has_java = ( |
| 636 defined(invoker.java_files) |
| 637 || defined(invoker.DEPRECATED_java_in_dir) |
| 638 || _native_libs != [] |
| 639 ) |
| 640 |
630 _keystore_path = android_default_keystore_path | 641 _keystore_path = android_default_keystore_path |
631 _keystore_name = android_default_keystore_name | 642 _keystore_name = android_default_keystore_name |
632 _keystore_password = android_default_keystore_password | 643 _keystore_password = android_default_keystore_password |
633 | 644 |
634 if (defined(invoker.keystore_path)) { | 645 if (defined(invoker.keystore_path)) { |
635 _keystore_path = invoker.keystore_path | 646 _keystore_path = invoker.keystore_path |
636 _keystore_name = invoker.keystore_name | 647 _keystore_name = invoker.keystore_name |
637 _keystore_password = invoker.keystore_password | 648 _keystore_password = invoker.keystore_password |
638 } | 649 } |
639 | 650 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 if (_load_library_from_apk) { | 711 if (_load_library_from_apk) { |
701 defines += ["ENABLE_CHROMIUM_LINKER_LIBRARY_IN_ZIP_FILE"] | 712 defines += ["ENABLE_CHROMIUM_LINKER_LIBRARY_IN_ZIP_FILE"] |
702 } | 713 } |
703 if (_enable_chromium_linker_tests) { | 714 if (_enable_chromium_linker_tests) { |
704 defines += ["ENABLE_CHROMIUM_LINKER_TESTS"] | 715 defines += ["ENABLE_CHROMIUM_LINKER_TESTS"] |
705 } | 716 } |
706 } | 717 } |
707 _srcjar_deps += [ ":${_template_name}__native_libraries_java" ] | 718 _srcjar_deps += [ ":${_template_name}__native_libraries_java" ] |
708 } | 719 } |
709 | 720 |
710 final_deps += [":${_template_name}__java"] | 721 if (_has_java) { |
711 android_java_library("${_template_name}__java") { | 722 final_deps += [ ":${_template_name}__java" ] |
712 android_manifest = invoker.android_manifest | 723 android_java_library("${_template_name}__java") { |
713 if (defined(invoker.java_files)) { | 724 android_manifest = invoker.android_manifest |
714 java_files = invoker.java_files | 725 if (defined(invoker.java_files)) { |
715 } else { | 726 java_files = invoker.java_files |
716 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir | 727 } else if (defined(invoker.DEPRECATED_java_in_dir)) { |
| 728 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir |
| 729 } else { |
| 730 assert(_srcjar_deps != []) |
| 731 java_files = [] |
| 732 } |
| 733 srcjar_deps = _srcjar_deps |
| 734 dex_path = base_path + ".dex.jar" |
717 } | 735 } |
718 srcjar_deps = _srcjar_deps | 736 } else { |
719 dex_path = base_path + ".dex.jar" | 737 assert(_srcjar_deps == []) |
| 738 } |
| 739 |
| 740 if (_dist_jar_path != "") { |
| 741 # TODO(cjhopman): This is only ever needed to calculate the list of tests to |
| 742 # run. See build/android/pylib/instrumentation/test_jar.py. We should be |
| 743 # able to just do that calculation at build time instead. |
| 744 action("${_template_name}__create_dist_jar") { |
| 745 script = "//build/android/gyp/create_dist_jar.py" |
| 746 depfile = "$target_gen_dir/$target_name.d" |
| 747 inputs = [ build_config ] |
| 748 outputs = [ |
| 749 depfile, |
| 750 _dist_jar_path, |
| 751 ] |
| 752 args = [ |
| 753 "--depfile", rebase_path(depfile, root_build_dir), |
| 754 "--output", rebase_path(_dist_jar_path, root_build_dir), |
| 755 "--inputs=@FileArg($_rebased_build_config:dist_jar:dependency_jars)", |
| 756 ] |
| 757 if (_has_java) { |
| 758 inputs += [ jar_path ] |
| 759 _rebased_jar_path = rebase_path([ jar_path ], root_build_dir) |
| 760 args += [ |
| 761 "--inputs=$_rebased_jar_path", |
| 762 ] |
| 763 } |
| 764 } |
720 } | 765 } |
721 | 766 |
722 final_deps += [":${_template_name}__final_dex"] | 767 final_deps += [":${_template_name}__final_dex"] |
723 dex("${_template_name}__final_dex") { | 768 dex("${_template_name}__final_dex") { |
724 sources = [jar_path] | 769 sources = [] |
725 inputs = [build_config] | 770 if (_has_java) { |
| 771 deps = [ ":${_template_name}__java" ] |
| 772 sources += [ jar_path ] |
| 773 } |
| 774 inputs = [ build_config ] |
726 output = final_dex_path | 775 output = final_dex_path |
727 dex_arg_key = "${_rebased_build_config}:apk_dex:dependency_dex_files" | 776 dex_arg_key = "${_rebased_build_config}:apk_dex:dependency_dex_files" |
728 args = ["--inputs=@FileArg($dex_arg_key)"] | 777 args = [ "--inputs=@FileArg($dex_arg_key)" ] |
729 } | 778 } |
730 | 779 |
731 if (_native_libs != []) { | 780 if (_native_libs != []) { |
732 copy_ex("${_template_name}__prepare_native") { | 781 copy_ex("${_template_name}__prepare_native") { |
733 clear_dir = true | 782 clear_dir = true |
734 inputs = [ | 783 inputs = [ |
735 build_config | 784 build_config |
736 ] | 785 ] |
737 dest = "$_native_libs_dir/$android_app_abi" | 786 dest = "$_native_libs_dir/$android_app_abi" |
738 args = [ | 787 args = [ |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 "//build/android/gyp/find.py", | 937 "//build/android/gyp/find.py", |
889 rebase_path([invoker.import_include], root_build_dir), | 938 rebase_path([invoker.import_include], root_build_dir), |
890 "list lines" | 939 "list lines" |
891 ) | 940 ) |
892 _java_files = rebase_path(_java_files_build_rel, ".", root_build_dir) | 941 _java_files = rebase_path(_java_files_build_rel, ".", root_build_dir) |
893 inputs += _java_files | 942 inputs += _java_files |
894 } | 943 } |
895 args += rebase_path(sources, root_build_dir) | 944 args += rebase_path(sources, root_build_dir) |
896 } | 945 } |
897 } | 946 } |
OLD | NEW |