OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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/buildflag_header.gni") | 5 import("//build/buildflag_header.gni") |
6 import("//build/config/android/config.gni") | 6 import("//build/config/android/config.gni") |
7 import("//build/config/android/rules.gni") | 7 import("//build/config/android/rules.gni") |
8 import("//build/util/process_version.gni") | 8 import("//build/util/process_version.gni") |
9 import("//build/util/version.gni") | 9 import("//build/util/version.gni") |
10 import("//testing/test.gni") | 10 import("//testing/test.gni") |
| 11 import("//third_party/netty4/netty4.gni") |
11 import("//third_party/protobuf/proto_library.gni") | 12 import("//third_party/protobuf/proto_library.gni") |
12 import("//url/features.gni") | 13 import("//url/features.gni") |
13 | 14 |
14 assert(!is_component_build, "Cronet requires static library build.") | 15 assert(!is_component_build, "Cronet requires static library build.") |
15 | 16 |
16 declare_args() { | 17 declare_args() { |
17 cronet_enable_data_reduction_proxy_support = false | 18 cronet_enable_data_reduction_proxy_support = false |
18 } | 19 } |
19 | 20 |
20 generate_jni("cronet_jni_headers") { | 21 generate_jni("cronet_jni_headers") { |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 "//net:test_support", | 784 "//net:test_support", |
784 "//testing/gtest", | 785 "//testing/gtest", |
785 ] | 786 ] |
786 | 787 |
787 if (is_android) { | 788 if (is_android) { |
788 shard_timeout = 180 | 789 shard_timeout = 180 |
789 } | 790 } |
790 } | 791 } |
791 | 792 |
792 _package_dir = "$root_out_dir/cronet" | 793 _package_dir = "$root_out_dir/cronet" |
| 794 _test_package_dir = "$root_out_dir/cronet/test" |
793 _extract_cronet_jars_dir = "$target_gen_dir/cronet_jar_extract" | 795 _extract_cronet_jars_dir = "$target_gen_dir/cronet_jar_extract" |
| 796 _extract_cronet_test_jars_dir = "$target_gen_dir/cronet_test_jar_extract" |
794 | 797 |
795 action("extract_cronet_jars") { | 798 action("extract_cronet_jars") { |
796 # extract_from_jars.py deletes the target directory before extracting. | 799 # extract_from_jars.py deletes the target directory before extracting. |
797 script = "//components/cronet/tools/extract_from_jars.py" | 800 script = "//components/cronet/tools/extract_from_jars.py" |
798 depfile = "$target_gen_dir/$target_name.d" | 801 depfile = "$target_gen_dir/$target_name.d" |
799 | 802 |
800 sources = [ | 803 sources = [ |
801 "$root_out_dir/lib.java/base/base_java.jar", | 804 "$root_out_dir/lib.java/base/base_java.jar", |
802 "$root_out_dir/lib.java/components/cronet/android/cronet_impl_native_java.ja
r", | 805 "$root_out_dir/lib.java/components/cronet/android/cronet_impl_native_java.ja
r", |
803 "$root_out_dir/lib.java/net/android/net_java.jar", | 806 "$root_out_dir/lib.java/net/android/net_java.jar", |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 rebase_path(_extract_cronet_jars_dir, root_build_dir), | 845 rebase_path(_extract_cronet_jars_dir, root_build_dir), |
843 "--jar-path", | 846 "--jar-path", |
844 rebase_path(_output_jar, root_build_dir), | 847 rebase_path(_output_jar, root_build_dir), |
845 ] | 848 ] |
846 | 849 |
847 deps = [ | 850 deps = [ |
848 ":extract_cronet_jars", | 851 ":extract_cronet_jars", |
849 ] | 852 ] |
850 } | 853 } |
851 | 854 |
| 855 action("extract_cronet_test_jars") { |
| 856 # extract_from_jars.py deletes the target directory before extracting. |
| 857 script = "//components/cronet/tools/extract_from_jars.py" |
| 858 depfile = "$target_gen_dir/$target_name.d" |
| 859 testonly = true |
| 860 |
| 861 sources = [ |
| 862 "$root_out_dir/lib.java/base/base_java.jar", |
| 863 "$root_out_dir/lib.java/base/base_java_test_support.jar", |
| 864 "$root_out_dir/lib.java/components/cronet/android/cronet_javatests.jar", |
| 865 "$root_out_dir/lib.java/components/cronet/android/cronet_test_apk_java.jar", |
| 866 "$root_out_dir/lib.java/net/android/net_java.jar", |
| 867 "$root_out_dir/lib.java/net/android/net_java_test_support.jar", |
| 868 "$root_out_dir/lib.java/third_party/netty-tcnative/netty-tcnative_java.jar", |
| 869 "$root_out_dir/lib.java/url/url_java.jar", |
| 870 NETTY4_JAR_FILE, |
| 871 ] |
| 872 |
| 873 _stamp_file = "$target_gen_dir/$target_name.stamp" |
| 874 outputs = [ |
| 875 _stamp_file, |
| 876 ] |
| 877 |
| 878 _rebased_sources = rebase_path(sources, root_build_dir) |
| 879 |
| 880 args = [ |
| 881 "--classes-dir", |
| 882 rebase_path(_extract_cronet_test_jars_dir, root_build_dir), |
| 883 "--jars=${_rebased_sources}", |
| 884 "--depfile", |
| 885 rebase_path(depfile, root_build_dir), |
| 886 "--stamp", |
| 887 rebase_path(_stamp_file, root_build_dir), |
| 888 ] |
| 889 |
| 890 deps = [ |
| 891 ":cronet_javatests", |
| 892 ":cronet_test_apk_java", |
| 893 "//base:base_java", |
| 894 "//base:base_java_test_support", |
| 895 "//net/android:net_java", |
| 896 "//net/android:net_java_test_support", |
| 897 "//third_party/netty-tcnative:netty-tcnative_java", |
| 898 "//third_party/netty4:netty_all_java", |
| 899 "//url:url_java", |
| 900 ] |
| 901 } |
| 902 |
| 903 action("repackage_extracted_test_jars") { |
| 904 _output_jar = "$_test_package_dir/cronet_tests_java.jar" |
| 905 testonly = true |
| 906 |
| 907 script = "//build/android/gyp/jar.py" |
| 908 outputs = [ |
| 909 _output_jar, |
| 910 ] |
| 911 |
| 912 args = [ |
| 913 "--classes-dir", |
| 914 rebase_path(_extract_cronet_test_jars_dir, root_build_dir), |
| 915 "--jar-path", |
| 916 rebase_path(_output_jar, root_build_dir), |
| 917 ] |
| 918 |
| 919 deps = [ |
| 920 ":extract_cronet_test_jars", |
| 921 ] |
| 922 } |
| 923 |
852 template("jar_src") { | 924 template("jar_src") { |
853 action(target_name) { | 925 action(target_name) { |
854 _rebased_src_search_dirs = | 926 _rebased_src_search_dirs = |
855 rebase_path(invoker.src_search_dirs, root_build_dir) | 927 rebase_path(invoker.src_search_dirs, root_build_dir) |
856 | 928 |
857 script = "//components/cronet/tools/jar_src.py" | 929 script = "//components/cronet/tools/jar_src.py" |
858 depfile = "$target_gen_dir/$target_name.d" | 930 depfile = "$target_gen_dir/$target_name.d" |
859 outputs = [ | 931 outputs = [ |
860 invoker.jar_path, | 932 invoker.jar_path, |
861 ] | 933 ] |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 "$root_out_dir/lib.unstripped/libcronet.so", | 1149 "$root_out_dir/lib.unstripped/libcronet.so", |
1078 ] | 1150 ] |
1079 outputs = [ | 1151 outputs = [ |
1080 "$_package_dir/symbols/${android_app_abi}/libcronet.so", | 1152 "$_package_dir/symbols/${android_app_abi}/libcronet.so", |
1081 ] | 1153 ] |
1082 deps = [ | 1154 deps = [ |
1083 ":cronet", | 1155 ":cronet", |
1084 ] | 1156 ] |
1085 } | 1157 } |
1086 | 1158 |
| 1159 copy("cronet_package_copy_native_test_lib") { |
| 1160 testonly = true |
| 1161 sources = [ |
| 1162 "$root_out_dir/libcronet_tests.so", |
| 1163 "$root_out_dir/libnetty-tcnative.so", |
| 1164 ] |
| 1165 outputs = [ |
| 1166 "$_test_package_dir/libs/${android_app_abi}/{{source_file_part}}", |
| 1167 ] |
| 1168 deps = [ |
| 1169 ":cronet_tests", |
| 1170 "//third_party/netty-tcnative:netty-tcnative-so", |
| 1171 ] |
| 1172 } |
| 1173 |
| 1174 copy("cronet_package_copy_native_test_lib_unstripped") { |
| 1175 testonly = true |
| 1176 sources = [ |
| 1177 "$root_out_dir/lib.unstripped/libcronet_tests.so", |
| 1178 "$root_out_dir/lib.unstripped/libnetty-tcnative.so", |
| 1179 ] |
| 1180 outputs = [ |
| 1181 "$_test_package_dir/symbols/${android_app_abi}/{{source_file_part}}", |
| 1182 ] |
| 1183 deps = [ |
| 1184 ":cronet_tests", |
| 1185 "//third_party/netty-tcnative:netty-tcnative-so", |
| 1186 ] |
| 1187 } |
| 1188 |
| 1189 copy("cronet_package_copy_test_assets") { |
| 1190 testonly = true |
| 1191 sources = [ |
| 1192 "test/assets", |
| 1193 ] |
| 1194 outputs = [ |
| 1195 "$_test_package_dir/assets", |
| 1196 ] |
| 1197 } |
| 1198 |
| 1199 copy("cronet_package_copy_test_support_apks") { |
| 1200 testonly = true |
| 1201 sources = [ |
| 1202 # Provides EmbeddedTestServer. |
| 1203 "$root_out_dir/apks/ChromiumNetTestSupport.apk", |
| 1204 ] |
| 1205 outputs = [ |
| 1206 "$_test_package_dir/apks/${android_app_abi}/{{source_file_part}}", |
| 1207 ] |
| 1208 deps = [ |
| 1209 "//net/android:net_test_support_apk", |
| 1210 ] |
| 1211 } |
| 1212 |
| 1213 copy("cronet_package_copy_test_files") { |
| 1214 testonly = true |
| 1215 sources = [ |
| 1216 "//net/data/ssl/certificates/quic_test.example.com.crt", |
| 1217 "//net/data/ssl/certificates/quic_test.example.com.key", |
| 1218 "//net/data/ssl/certificates/quic_test.example.com.key.pkcs8", |
| 1219 "//net/data/ssl/certificates/quic_test.example.com.key.sct", |
| 1220 ] |
| 1221 outputs = [ |
| 1222 "$_test_package_dir/assets/test_files/net/data/ssl/certificates/{{source_fil
e_part}}", |
| 1223 ] |
| 1224 deps = [ |
| 1225 # Not really dependent, but builds can fail if these two targets attempt |
| 1226 # to create the "assets" subdirectory simultaneously. |
| 1227 ":cronet_package_copy_test_assets", |
| 1228 ] |
| 1229 } |
| 1230 |
1087 # Enforce that ARM Neon is not used when building for ARMv7 | 1231 # Enforce that ARM Neon is not used when building for ARMv7 |
1088 if (target_cpu == "arm" && arm_version == 7 && !arm_use_neon) { | 1232 if (target_cpu == "arm" && arm_version == 7 && !arm_use_neon) { |
1089 action("enforce_no_neon") { | 1233 action("enforce_no_neon") { |
1090 script = "//components/cronet/tools/check_no_neon.py" | 1234 script = "//components/cronet/tools/check_no_neon.py" |
1091 outputs = [ | 1235 outputs = [ |
1092 "$target_gen_dir/$target_name.stamp", | 1236 "$target_gen_dir/$target_name.stamp", |
1093 ] | 1237 ] |
1094 args = [ | 1238 args = [ |
1095 rebase_path("${android_tool_prefix}objdump", root_build_dir), | 1239 rebase_path("${android_tool_prefix}objdump", root_build_dir), |
1096 | 1240 |
1097 # libcronet.so may contain ARM Neon instructions from BoringSSL, but these | 1241 # libcronet.so may contain ARM Neon instructions from BoringSSL, but these |
1098 # are only used after checking whether the CPU supports NEON at runtime, | 1242 # are only used after checking whether the CPU supports NEON at runtime, |
1099 # so instead check base/ as it represents a large swath of code that only | 1243 # so instead check base/ as it represents a large swath of code that only |
1100 # contains Neon instructions when Neon is enabled by default. | 1244 # contains Neon instructions when Neon is enabled by default. |
1101 rebase_path("$root_out_dir/obj/base/base/*.o", root_build_dir), | 1245 rebase_path("$root_out_dir/obj/base/base/*.o", root_build_dir), |
1102 "--stamp", | 1246 "--stamp", |
1103 rebase_path(outputs[0], root_build_dir), | 1247 rebase_path(outputs[0], root_build_dir), |
1104 ] | 1248 ] |
1105 deps = [ | 1249 deps = [ |
1106 "//base:base", | 1250 "//base:base", |
1107 ] | 1251 ] |
1108 } | 1252 } |
1109 } | 1253 } |
1110 | 1254 |
1111 group("cronet_package") { | 1255 group("cronet_package") { |
| 1256 # Marked as testonly as it contains test-only targets too. |
| 1257 testonly = true |
| 1258 |
1112 # Enforce building with ICU alternatives, crbug.com/611621. | 1259 # Enforce building with ICU alternatives, crbug.com/611621. |
1113 # Enforce that arm_use_neon==false when building for ARMv7 by | 1260 # Enforce that arm_use_neon==false when building for ARMv7 by |
1114 # not including any deps in cronet_package target otherwise. | 1261 # not including any deps in cronet_package target otherwise. |
1115 if (use_platform_icu_alternatives && | 1262 if (use_platform_icu_alternatives && |
1116 (!(target_cpu == "arm" && arm_version == 7) || !arm_use_neon)) { | 1263 (!(target_cpu == "arm" && arm_version == 7) || !arm_use_neon)) { |
1117 deps = [ | 1264 deps = [ |
1118 ":cronet_package_copy", | 1265 ":cronet_package_copy", |
1119 ":cronet_package_copy_native_lib", | 1266 ":cronet_package_copy_native_lib", |
1120 ":cronet_package_copy_native_lib_unstripped", | 1267 ":cronet_package_copy_native_lib_unstripped", |
| 1268 ":cronet_test_package", |
1121 ":generate_javadoc", | 1269 ":generate_javadoc", |
1122 ":generate_licenses", | 1270 ":generate_licenses", |
1123 ":jar_cronet_api_source", | 1271 ":jar_cronet_api_source", |
1124 ":jar_cronet_impl_common_java_source", | 1272 ":jar_cronet_impl_common_java_source", |
1125 ":jar_cronet_impl_native_java_source", | 1273 ":jar_cronet_impl_native_java_source", |
1126 ":jar_cronet_impl_platform_java_source", | 1274 ":jar_cronet_impl_platform_java_source", |
1127 ":jar_cronet_sample_source", | 1275 ":jar_cronet_sample_source", |
1128 ":repackage_extracted_jars", | 1276 ":repackage_extracted_jars", |
1129 ] | 1277 ] |
1130 if (current_cpu == "arm" && arm_version == 7) { | 1278 if (current_cpu == "arm" && arm_version == 7) { |
1131 deps += [ ":enforce_no_neon" ] | 1279 deps += [ ":enforce_no_neon" ] |
1132 } | 1280 } |
1133 } | 1281 } |
1134 } | 1282 } |
| 1283 |
| 1284 group("cronet_test_package") { |
| 1285 testonly = true |
| 1286 |
| 1287 # Don't build for MIPS where tests aren't run. |
| 1288 if (current_cpu != "mipsel" && current_cpu != "mips64el") { |
| 1289 deps = [ |
| 1290 ":cronet_package_copy_native_test_lib", |
| 1291 ":cronet_package_copy_native_test_lib_unstripped", |
| 1292 ":cronet_package_copy_test_assets", |
| 1293 ":cronet_package_copy_test_files", |
| 1294 ":cronet_package_copy_test_support_apks", |
| 1295 ":repackage_extracted_test_jars", |
| 1296 ] |
| 1297 } |
| 1298 } |
OLD | NEW |