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 import("//tools/relocation_packer/config.gni") | |
| 8 | 9 |
| 9 assert(is_android) | 10 assert(is_android) |
| 10 | 11 |
| 11 | |
| 12 # Declare a jni target | 12 # Declare a jni target |
| 13 # | 13 # |
| 14 # This target generates the native jni bindings for a set of .java files. | 14 # This target generates the native jni bindings for a set of .java files. |
| 15 # | 15 # |
| 16 # See base/android/jni_generator/jni_generator.py for more info about the | 16 # See base/android/jni_generator/jni_generator.py for more info about the |
| 17 # format of generating JNI bindings. | 17 # format of generating JNI bindings. |
| 18 # | 18 # |
| 19 # Variables | 19 # Variables |
| 20 # sources: list of .java files to generate jni for | 20 # sources: list of .java files to generate jni for |
| 21 # jni_package: subdirectory path for generated bindings | 21 # jni_package: subdirectory path for generated bindings |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 830 _dist_jar_path = _dist_jar_path_list[0] | 830 _dist_jar_path = _dist_jar_path_list[0] |
| 831 | 831 |
| 832 _native_libs = [] | 832 _native_libs = [] |
| 833 | 833 |
| 834 _use_chromium_linker = false | 834 _use_chromium_linker = false |
| 835 if (defined(invoker.use_chromium_linker)) { | 835 if (defined(invoker.use_chromium_linker)) { |
| 836 _use_chromium_linker = invoker.use_chromium_linker | 836 _use_chromium_linker = invoker.use_chromium_linker |
| 837 } | 837 } |
| 838 assert(_use_chromium_linker || true) | 838 assert(_use_chromium_linker || true) |
| 839 | 839 |
| 840 _enable_relocation_packing = false | |
| 841 if (defined(invoker.enable_relocation_packing)) { | |
| 842 _enable_relocation_packing = invoker.enable_relocation_packing | |
| 843 } | |
| 844 assert(_enable_relocation_packing || true) | |
|
simonb (inactive)
2014/10/20 13:06:09
Does this do anything? (Also for _use_chromium_li
| |
| 845 | |
| 846 if (_enable_relocation_packing) { | |
| 847 assert(_use_chromium_linker, "Relocation packing requires use of the" + | |
| 848 "Chromium linker.") | |
| 849 } | |
| 850 | |
| 840 _load_library_from_apk = false | 851 _load_library_from_apk = false |
| 841 if (defined(invoker.load_library_from_apk)) { | 852 if (defined(invoker.load_library_from_apk)) { |
| 842 _load_library_from_apk = invoker.load_library_from_apk | 853 _load_library_from_apk = invoker.load_library_from_apk |
| 843 } | 854 } |
| 844 | 855 |
| 845 _keystore_path = android_default_keystore_path | 856 _keystore_path = android_default_keystore_path |
| 846 _keystore_name = android_default_keystore_name | 857 _keystore_name = android_default_keystore_name |
| 847 _keystore_password = android_default_keystore_password | 858 _keystore_password = android_default_keystore_password |
| 848 | 859 |
| 849 if (defined(invoker.keystore_path)) { | 860 if (defined(invoker.keystore_path)) { |
| 850 _keystore_path = invoker.keystore_path | 861 _keystore_path = invoker.keystore_path |
| 851 _keystore_name = invoker.keystore_name | 862 _keystore_name = invoker.keystore_name |
| 852 _keystore_password = invoker.keystore_password | 863 _keystore_password = invoker.keystore_password |
| 853 } | 864 } |
| 854 | 865 |
| 855 _srcjar_deps = [] | 866 _srcjar_deps = [] |
| 856 if (defined(invoker.srcjar_deps)) { | 867 if (defined(invoker.srcjar_deps)) { |
| 857 _srcjar_deps += invoker.srcjar_deps | 868 _srcjar_deps += invoker.srcjar_deps |
| 858 } | 869 } |
| 859 | 870 |
| 860 if (defined(invoker.native_libs)) { | 871 if (defined(invoker.native_libs)) { |
| 861 # TODO(GYP) add "|| profiling_full_stack_frames | 872 # TODO(GYP) add "|| profiling_full_stack_frames |
| 862 # Only enable the chromium linker on regular builds, since the | 873 # Only enable the chromium linker on regular builds, since the |
| 863 # component build crashes on Android 4.4. See b/11379966 | 874 # component build crashes on Android 4.4. See b/11379966 |
| 864 if (is_component_build || cpu_arch == "arm64" || cpu_arch == "x64") { | 875 if (is_component_build || cpu_arch == "arm64" || cpu_arch == "x64") { |
| 865 _use_chromium_linker = false | 876 _use_chromium_linker = false |
| 866 } | 877 } |
| 867 | 878 |
| 879 if (!_use_chromium_linker || !relocation_packing_supported) { | |
| 880 _enable_relocation_packing = false | |
| 881 } | |
| 882 | |
| 868 _native_libs = invoker.native_libs | 883 _native_libs = invoker.native_libs |
| 869 _native_libs_dir = base_path + "/libs" | 884 _native_libs_dir = base_path + "/libs" |
| 870 | 885 |
| 871 if (_use_chromium_linker) { | 886 if (_use_chromium_linker) { |
| 872 _native_libs += [ | 887 _native_libs += [ |
| 873 "$root_build_dir/lib.stripped/libchromium_android_linker.so" | 888 "$root_build_dir/lib.stripped/libchromium_android_linker.so" |
| 874 ] | 889 ] |
| 875 } | 890 } |
| 876 } | 891 } |
| 877 | 892 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 979 dex("${_template_name}__final_dex") { | 994 dex("${_template_name}__final_dex") { |
| 980 deps = [ ":${_template_name}__java" ] | 995 deps = [ ":${_template_name}__java" ] |
| 981 sources = [ jar_path ] | 996 sources = [ jar_path ] |
| 982 inputs = [ build_config ] | 997 inputs = [ build_config ] |
| 983 output = final_dex_path | 998 output = final_dex_path |
| 984 dex_arg_key = "${_rebased_build_config}:apk_dex:dependency_dex_files" | 999 dex_arg_key = "${_rebased_build_config}:apk_dex:dependency_dex_files" |
| 985 args = [ "--inputs=@FileArg($dex_arg_key)" ] | 1000 args = [ "--inputs=@FileArg($dex_arg_key)" ] |
| 986 } | 1001 } |
| 987 | 1002 |
| 988 if (_native_libs != []) { | 1003 if (_native_libs != []) { |
| 989 copy_ex("${_template_name}__prepare_native") { | 1004 action("${_template_name}__prepare_native") { |
| 990 clear_dir = true | 1005 script = "//build/android/gyp/pack_arm_relocations.py" |
| 1006 packed_libraries_dir = "$_native_libs_dir/$android_app_abi" | |
| 1007 depfile = "$target_gen_dir/$target_name.d" | |
| 1008 outputs = [ | |
| 1009 depfile | |
| 1010 ] | |
| 991 inputs = [ | 1011 inputs = [ |
| 992 build_config | 1012 build_config |
| 993 ] | 1013 ] |
| 994 dest = "$_native_libs_dir/$android_app_abi" | 1014 deps = [] |
| 1015 skip_packing_list = [ | |
| 1016 "gdbserver", | |
| 1017 "libchromium_android_linker.so", | |
| 1018 ] | |
| 1019 | |
| 1020 enable_packing_arg = 0 | |
| 1021 if (_enable_relocation_packing) { | |
| 1022 enable_packing_arg = 1 | |
| 1023 deps += [ | |
| 1024 relocation_packer_target | |
| 1025 ] | |
| 1026 } | |
| 1027 | |
| 995 args = [ | 1028 args = [ |
| 996 "--files=@FileArg(${_rebased_build_config}:native:libraries)", | 1029 "--depfile", rebase_path(depfile, root_build_dir), |
| 1030 "--enable-packing=$enable_packing_arg", | |
| 1031 "--has-relocations-with-addends=$relocations_have_addends", | |
| 1032 "--exclude-packing-list=$skip_packing_list", | |
| 1033 "--android-pack-relocations", rebase_path(relocation_packer_exe, root_bu ild_dir), | |
| 1034 "--android-objcopy", rebase_path(android_objcopy, root_build_dir), | |
| 1035 "--stripped-libraries-dir", rebase_path(root_build_dir, root_build_dir), | |
| 1036 "--packed-libraries-dir", rebase_path(packed_libraries_dir, root_build_d ir), | |
| 1037 "--libraries=@FileArg(${_rebased_build_config}:native:libraries)", | |
| 1038 "--clear-dir" | |
| 997 ] | 1039 ] |
| 1040 | |
| 998 if (is_debug) { | 1041 if (is_debug) { |
| 999 rebased_gdbserver = rebase_path(android_gdbserver, root_build_dir) | 1042 rebased_gdbserver = rebase_path([ android_gdbserver ], root_build_dir) |
| 1043 inputs += [ android_gdbserver ] | |
| 1000 args += [ | 1044 args += [ |
| 1001 "--files=[\"$rebased_gdbserver\"]" | 1045 "--libraries=$rebased_gdbserver" |
| 1002 ] | 1046 ] |
| 1003 } | 1047 } |
| 1004 } | 1048 } |
| 1005 } | 1049 } |
| 1006 | 1050 |
| 1007 final_deps += [":${_template_name}__create"] | 1051 final_deps += [":${_template_name}__create"] |
| 1008 create_apk("${_template_name}__create") { | 1052 create_apk("${_template_name}__create") { |
| 1009 apk_path = _final_apk_path | 1053 apk_path = _final_apk_path |
| 1010 android_manifest = invoker.android_manifest | 1054 android_manifest = invoker.android_manifest |
| 1011 resources_zip = all_resources_zip_path | 1055 resources_zip = all_resources_zip_path |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1294 } | 1338 } |
| 1295 | 1339 |
| 1296 # TODO(GYP): implement this. | 1340 # TODO(GYP): implement this. |
| 1297 template("uiautomator_test") { | 1341 template("uiautomator_test") { |
| 1298 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 1342 if (defined(invoker.testonly)) { testonly = invoker.testonly } |
| 1299 assert(target_name != "") | 1343 assert(target_name != "") |
| 1300 assert(invoker.deps != [] || true) | 1344 assert(invoker.deps != [] || true) |
| 1301 group(target_name) { | 1345 group(target_name) { |
| 1302 } | 1346 } |
| 1303 } | 1347 } |
| OLD | NEW |