Chromium Code Reviews| 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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 619 | 619 |
| 620 if (defined(invoker.srcjar_deps)) { | 620 if (defined(invoker.srcjar_deps)) { |
| 621 srcjar_deps = invoker.srcjar_deps | 621 srcjar_deps = invoker.srcjar_deps |
| 622 } | 622 } |
| 623 if (defined(invoker.srcjars)) { | 623 if (defined(invoker.srcjars)) { |
| 624 srcjars = invoker.srcjars | 624 srcjars = invoker.srcjars |
| 625 } | 625 } |
| 626 } | 626 } |
| 627 } | 627 } |
| 628 | 628 |
| 629 template("java_library") { | |
| 630 if (defined(invoker.testonly)) { testonly = invoker.testonly } | |
| 631 | |
| 632 assert(defined(invoker.java_files) || defined(invoker.DEPRECATED_java_in_dir) | |
| 633 || defined(invoker.srcjars)) | |
| 634 | |
| 635 _srcjar_deps = [] | |
| 636 if (defined(invoker.srcjar_deps)) { | |
| 637 _srcjar_deps = invoker.srcjar_deps | |
| 638 } | |
| 639 | |
| 640 _srcjars = [] | |
| 641 if (defined(invoker.srcjars)) { | |
| 642 _srcjars = invoker.srcjars | |
| 643 } | |
| 644 | |
| 645 _java_files = [] | |
| 646 if (defined(invoker.java_files)) { | |
| 647 _java_files = invoker.java_files | |
| 648 } else if (defined(invoker.DEPRECATED_java_in_dir)) { | |
| 649 _src_dir = invoker.DEPRECATED_java_in_dir + "/src" | |
| 650 _src_dir_exists = exec_script("//build/dir_exists.py", | |
| 651 [ rebase_path(_src_dir, root_build_dir) ], | |
| 652 "string") | |
| 653 assert(_src_dir_exists == "False", | |
| 654 "In GN, java_in_dir should be the fully specified java directory " + | |
| 655 "(i.e. including the trailing \"/src\")") | |
| 656 | |
| 657 _java_files_build_rel = exec_script( | |
| 658 "//build/android/gyp/find.py", | |
| 659 [ | |
| 660 "--pattern", | |
| 661 "*.java", | |
| 662 rebase_path(invoker.DEPRECATED_java_in_dir, root_build_dir) | |
| 663 ], | |
| 664 "list lines" | |
| 665 ) | |
| 666 _java_files = rebase_path(_java_files_build_rel, ".", root_build_dir) | |
| 667 } | |
| 668 assert(_java_files != [] || _srcjar_deps != [] || _srcjars != []) | |
| 669 | |
| 670 # TODO(cjhopman): Write a proper build config so that java library | |
| 671 # dependencies work correctly. | |
| 672 _build_config = "$target_gen_dir/$target_name.build_config" | |
| 673 write_file( | |
| 674 _build_config, | |
| 675 "{ \"javac\": { \"classpath\": [], \"srcjars\": [] } }") | |
| 676 | |
| 677 _jar_path = "$root_build_dir/lib.java/$target_name.jar" | |
| 678 if (defined(invoker.jar_path)) { | |
| 679 _jar_path = invoker.jar_path | |
| 680 } | |
| 681 | |
| 682 compile_java(target_name) { | |
| 683 build_config = _build_config | |
| 684 jar_path = _jar_path | |
| 685 java_files = _java_files | |
| 686 srcjar_deps = _srcjar_deps | |
| 687 srcjars = _srcjars | |
| 688 } | |
| 689 } | |
| 690 | |
| 629 | 691 |
| 630 # Declare an Android library target for a prebuilt jar | 692 # Declare an Android library target for a prebuilt jar |
| 631 # | 693 # |
| 632 # This target creates an Android library containing java code and Android | 694 # This target creates an Android library containing java code and Android |
| 633 # resources. | 695 # resources. |
| 634 # | 696 # |
| 635 # Variables | 697 # Variables |
| 636 # deps: Specifies the dependencies of this target. Java targets in this list | 698 # deps: Specifies the dependencies of this target. Java targets in this list |
| 637 # will be added to the javac classpath. Android resources in dependencies | 699 # will be added to the javac classpath. Android resources in dependencies |
| 638 # will be used when building this library. | 700 # will be used when building this library. |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 761 } else if (defined(invoker.apk_name)) { | 823 } else if (defined(invoker.apk_name)) { |
| 762 _final_apk_path = "$root_build_dir/apks/" + invoker.apk_name + ".apk" | 824 _final_apk_path = "$root_build_dir/apks/" + invoker.apk_name + ".apk" |
| 763 } | 825 } |
| 764 _dist_jar_path_list = process_file_template( | 826 _dist_jar_path_list = process_file_template( |
| 765 [ _final_apk_path ], | 827 [ _final_apk_path ], |
| 766 "$root_build_dir/test.lib.java/{{source_name_part}}.jar" | 828 "$root_build_dir/test.lib.java/{{source_name_part}}.jar" |
| 767 ) | 829 ) |
| 768 _dist_jar_path = _dist_jar_path_list[0] | 830 _dist_jar_path = _dist_jar_path_list[0] |
| 769 | 831 |
| 770 _native_libs = [] | 832 _native_libs = [] |
| 771 if (defined(invoker.native_libs)) { | |
| 772 _use_chromium_linker = false | |
| 773 if (defined(invoker.use_chromium_linker)) { | |
| 774 _use_chromium_linker = invoker.use_chromium_linker | |
| 775 } | |
| 776 | 833 |
| 777 # TODO(GYP) add "|| profiling_full_stack_frames | 834 _use_chromium_linker = false |
| 778 # Only enable the chromium linker on regular builds, since the | 835 if (defined(invoker.use_chromium_linker)) { |
| 779 # component build crashes on Android 4.4. See b/11379966 | 836 _use_chromium_linker = invoker.use_chromium_linker |
| 780 if (is_component_build || cpu_arch == "arm64" || cpu_arch == "x64") { | 837 } |
| 781 _use_chromium_linker = false | 838 assert(_use_chromium_linker || true) |
|
rmcilroy
2014/10/21 10:55:45
I'm not sure what this is testing?
cjhopman
2014/10/21 17:28:52
Eh, this just marks _use_chromium_linker as "used"
| |
| 782 } | |
| 783 | 839 |
| 784 _native_libs = invoker.native_libs | 840 _load_library_from_apk = false |
| 785 _native_libs_dir = base_path + "/libs" | 841 if (defined(invoker.load_library_from_apk)) { |
| 786 | 842 _load_library_from_apk = invoker.load_library_from_apk |
| 787 if (_use_chromium_linker) { | |
| 788 _native_libs += [ | |
| 789 "$root_build_dir/lib.stripped/libchromium_android_linker.so" | |
| 790 ] | |
| 791 } | |
| 792 } | 843 } |
| 793 | 844 |
| 794 _keystore_path = android_default_keystore_path | 845 _keystore_path = android_default_keystore_path |
| 795 _keystore_name = android_default_keystore_name | 846 _keystore_name = android_default_keystore_name |
| 796 _keystore_password = android_default_keystore_password | 847 _keystore_password = android_default_keystore_password |
| 797 | 848 |
| 798 if (defined(invoker.keystore_path)) { | 849 if (defined(invoker.keystore_path)) { |
| 799 _keystore_path = invoker.keystore_path | 850 _keystore_path = invoker.keystore_path |
| 800 _keystore_name = invoker.keystore_name | 851 _keystore_name = invoker.keystore_name |
| 801 _keystore_password = invoker.keystore_password | 852 _keystore_password = invoker.keystore_password |
| 802 } | 853 } |
| 803 | 854 |
| 804 _srcjar_deps = [] | 855 _srcjar_deps = [] |
| 805 if (defined(invoker.srcjar_deps)) { | 856 if (defined(invoker.srcjar_deps)) { |
| 806 _srcjar_deps += invoker.srcjar_deps | 857 _srcjar_deps += invoker.srcjar_deps |
| 807 } | 858 } |
| 808 | 859 |
| 860 if (defined(invoker.native_libs)) { | |
| 861 # TODO(GYP) add "|| profiling_full_stack_frames | |
| 862 # Only enable the chromium linker on regular builds, since the | |
| 863 # component build crashes on Android 4.4. See b/11379966 | |
| 864 if (is_component_build || cpu_arch == "arm64" || cpu_arch == "x64") { | |
|
rmcilroy
2014/10/21 10:55:45
I realize you only moved this, but we still want _
cjhopman
2014/10/21 17:28:52
Done. It is not enabled in upstream targets for ar
rmcilroy
2014/10/21 21:21:03
You are right, I was thinking of downstream. Than
cjhopman
2014/10/22 21:44:07
In gyp we could do something similar... it would l
| |
| 865 _use_chromium_linker = false | |
| 866 } | |
| 867 | |
| 868 _native_libs = invoker.native_libs | |
| 869 _native_libs_dir = base_path + "/libs" | |
| 870 | |
| 871 if (_use_chromium_linker) { | |
| 872 _native_libs += [ | |
| 873 "$root_build_dir/lib.stripped/libchromium_android_linker.so" | |
| 874 ] | |
| 875 } | |
| 876 } | |
| 877 | |
| 809 _rebased_build_config = rebase_path(build_config, root_build_dir) | 878 _rebased_build_config = rebase_path(build_config, root_build_dir) |
| 810 | 879 |
| 811 write_build_config("${_template_name}__build_config") { | 880 write_build_config("${_template_name}__build_config") { |
| 812 type = "android_apk" | 881 type = "android_apk" |
| 813 dex_path = final_dex_path | 882 dex_path = final_dex_path |
| 814 resources_zip = resources_zip_path | 883 resources_zip = resources_zip_path |
| 815 | 884 |
| 816 if (defined(invoker.deps)) { | 885 if (defined(invoker.deps)) { |
| 817 deps = invoker.deps | 886 deps = invoker.deps |
| 818 } | 887 } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 831 generate_constant_ids = true | 900 generate_constant_ids = true |
| 832 } | 901 } |
| 833 _srcjar_deps += [":${_template_name}__process_resources"] | 902 _srcjar_deps += [":${_template_name}__process_resources"] |
| 834 | 903 |
| 835 if (_native_libs != []) { | 904 if (_native_libs != []) { |
| 836 _enable_chromium_linker_tests = false | 905 _enable_chromium_linker_tests = false |
| 837 if (defined(invoker.enable_chromium_linker_tests)) { | 906 if (defined(invoker.enable_chromium_linker_tests)) { |
| 838 _enable_chromium_linker_tests = invoker.enable_chromium_linker_tests | 907 _enable_chromium_linker_tests = invoker.enable_chromium_linker_tests |
| 839 } | 908 } |
| 840 | 909 |
| 841 _load_library_from_apk = false | |
| 842 _native_lib_version_name = "" | 910 _native_lib_version_name = "" |
| 843 | 911 |
| 844 java_cpp_template("${_template_name}__native_libraries_java") { | 912 java_cpp_template("${_template_name}__native_libraries_java") { |
| 845 package_name = "org/chromium/base/library_loader" | 913 package_name = "org/chromium/base/library_loader" |
| 846 sources = [ | 914 sources = [ |
| 847 "//base/android/java/templates/NativeLibraries.template", | 915 "//base/android/java/templates/NativeLibraries.template", |
| 848 ] | 916 ] |
| 849 inputs = [ | 917 inputs = [ |
| 850 build_config, | 918 build_config, |
| 851 ] | 919 ] |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 935 } | 1003 } |
| 936 } | 1004 } |
| 937 } | 1005 } |
| 938 | 1006 |
| 939 final_deps += [":${_template_name}__create"] | 1007 final_deps += [":${_template_name}__create"] |
| 940 create_apk("${_template_name}__create") { | 1008 create_apk("${_template_name}__create") { |
| 941 apk_path = _final_apk_path | 1009 apk_path = _final_apk_path |
| 942 android_manifest = invoker.android_manifest | 1010 android_manifest = invoker.android_manifest |
| 943 resources_zip = all_resources_zip_path | 1011 resources_zip = all_resources_zip_path |
| 944 dex_path = final_dex_path | 1012 dex_path = final_dex_path |
| 1013 load_library_from_apk = _load_library_from_apk | |
| 945 | 1014 |
| 946 if (defined(invoker.asset_location)) { | 1015 if (defined(invoker.asset_location)) { |
| 947 asset_location = invoker.asset_location | 1016 asset_location = invoker.asset_location |
| 948 } | 1017 } |
| 949 | 1018 |
| 950 keystore_name = _keystore_name | 1019 keystore_name = _keystore_name |
| 951 keystore_path = _keystore_path | 1020 keystore_path = _keystore_path |
| 952 keystore_password = _keystore_password | 1021 keystore_password = _keystore_password |
| 953 | 1022 |
| 954 if (_native_libs != []) { | 1023 if (_native_libs != []) { |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1225 } | 1294 } |
| 1226 | 1295 |
| 1227 # TODO(GYP): implement this. | 1296 # TODO(GYP): implement this. |
| 1228 template("uiautomator_test") { | 1297 template("uiautomator_test") { |
| 1229 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 1298 if (defined(invoker.testonly)) { testonly = invoker.testonly } |
| 1230 assert(target_name != "") | 1299 assert(target_name != "") |
| 1231 assert(invoker.deps != [] || true) | 1300 assert(invoker.deps != [] || true) |
| 1232 group(target_name) { | 1301 group(target_name) { |
| 1233 } | 1302 } |
| 1234 } | 1303 } |
| OLD | NEW |