Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: components/cronet/android/BUILD.gn

Issue 2551803003: [Cronet] Add cronet_test_package build target (Closed)
Patch Set: make subdirectory of cronet/ Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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")
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 "//net:test_support", 783 "//net:test_support",
784 "//testing/gtest", 784 "//testing/gtest",
785 ] 785 ]
786 786
787 if (is_android) { 787 if (is_android) {
788 shard_timeout = 180 788 shard_timeout = 180
789 } 789 }
790 } 790 }
791 791
792 _package_dir = "$root_out_dir/cronet" 792 _package_dir = "$root_out_dir/cronet"
793 _test_package_dir = "$root_out_dir/cronet/test"
793 _extract_cronet_jars_dir = "$target_gen_dir/cronet_jar_extract" 794 _extract_cronet_jars_dir = "$target_gen_dir/cronet_jar_extract"
795 _extract_cronet_test_jars_dir = "$target_gen_dir/cronet_test_jar_extract"
794 796
795 action("extract_cronet_jars") { 797 action("extract_cronet_jars") {
796 # extract_from_jars.py deletes the target directory before extracting. 798 # extract_from_jars.py deletes the target directory before extracting.
797 script = "//components/cronet/tools/extract_from_jars.py" 799 script = "//components/cronet/tools/extract_from_jars.py"
798 depfile = "$target_gen_dir/$target_name.d" 800 depfile = "$target_gen_dir/$target_name.d"
799 801
800 sources = [ 802 sources = [
801 "$root_out_dir/lib.java/base/base_java.jar", 803 "$root_out_dir/lib.java/base/base_java.jar",
802 "$root_out_dir/lib.java/components/cronet/android/cronet_impl_native_java.ja r", 804 "$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", 805 "$root_out_dir/lib.java/net/android/net_java.jar",
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 rebase_path(_extract_cronet_jars_dir, root_build_dir), 844 rebase_path(_extract_cronet_jars_dir, root_build_dir),
843 "--jar-path", 845 "--jar-path",
844 rebase_path(_output_jar, root_build_dir), 846 rebase_path(_output_jar, root_build_dir),
845 ] 847 ]
846 848
847 deps = [ 849 deps = [
848 ":extract_cronet_jars", 850 ":extract_cronet_jars",
849 ] 851 ]
850 } 852 }
851 853
854 action("extract_cronet_test_jars") {
855 # extract_from_jars.py deletes the target directory before extracting.
856 script = "//components/cronet/tools/extract_from_jars.py"
857 depfile = "$target_gen_dir/$target_name.d"
858 testonly = true
859
860 sources = [
861 "$root_out_dir/lib.java/base/base_java.jar",
862 "$root_out_dir/lib.java/base/base_java_test_support.jar",
863 "$root_out_dir/lib.java/components/cronet/android/cronet_javatests.jar",
864 "$root_out_dir/lib.java/components/cronet/android/cronet_test_apk_java.jar",
865 "$root_out_dir/lib.java/net/android/net_java.jar",
866 "$root_out_dir/lib.java/net/android/net_java_test_support.jar",
867 "$root_out_dir/lib.java/third_party/netty-tcnative/netty-tcnative_java.jar",
868 "$root_out_dir/lib.java/url/url_java.jar",
869 "//third_party/netty4/src/jar/all-in-one/netty-all-4.1.0.CR1-20160111.120759 -50.jar",
mef 2016/12/14 23:04:51 This seems very fragile. I wonder whether there i
pauljensen 2016/12/15 04:08:34 Ya, I agree it's fragile. I showed it to Andrei l
mef 2016/12/15 18:06:34 Yeah, per our offline conversation, adding somethi
jbudorick 2016/12/15 18:19:34 We've used .build_config files for stuff like this
pauljensen 2016/12/15 19:12:52 I tried that and just got: ninja: error: '../../co
870 ]
871
872 _stamp_file = "$target_gen_dir/$target_name.stamp"
873 outputs = [
874 _stamp_file,
875 ]
876
877 _rebased_sources = rebase_path(sources, root_build_dir)
878
879 args = [
880 "--classes-dir",
881 rebase_path(_extract_cronet_test_jars_dir, root_build_dir),
882 "--jars=${_rebased_sources}",
883 "--depfile",
884 rebase_path(depfile, root_build_dir),
885 "--stamp",
886 rebase_path(_stamp_file, root_build_dir),
887 ]
888
889 deps = [
890 ":cronet_javatests",
891 ":cronet_test_apk_java",
892 "//base:base_java",
893 "//base:base_java_test_support",
894 "//net/android:net_java",
895 "//net/android:net_java_test_support",
896 "//third_party/netty-tcnative:netty-tcnative_java",
897 "//third_party/netty4:netty_all_java",
898 "//url:url_java",
899 ]
900 }
901
902 action("repackage_extracted_test_jars") {
903 _output_jar = "$_test_package_dir/cronet_tests_java.jar"
904 testonly = true
905
906 script = "//build/android/gyp/jar.py"
907 outputs = [
908 _output_jar,
909 ]
910
911 args = [
912 "--classes-dir",
913 rebase_path(_extract_cronet_test_jars_dir, root_build_dir),
914 "--jar-path",
915 rebase_path(_output_jar, root_build_dir),
916 ]
917
918 deps = [
919 ":extract_cronet_test_jars",
920 ]
921 }
922
852 template("jar_src") { 923 template("jar_src") {
853 action(target_name) { 924 action(target_name) {
854 _rebased_src_search_dirs = 925 _rebased_src_search_dirs =
855 rebase_path(invoker.src_search_dirs, root_build_dir) 926 rebase_path(invoker.src_search_dirs, root_build_dir)
856 927
857 script = "//components/cronet/tools/jar_src.py" 928 script = "//components/cronet/tools/jar_src.py"
858 depfile = "$target_gen_dir/$target_name.d" 929 depfile = "$target_gen_dir/$target_name.d"
859 outputs = [ 930 outputs = [
860 invoker.jar_path, 931 invoker.jar_path,
861 ] 932 ]
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 "$root_out_dir/lib.unstripped/libcronet.so", 1148 "$root_out_dir/lib.unstripped/libcronet.so",
1078 ] 1149 ]
1079 outputs = [ 1150 outputs = [
1080 "$_package_dir/symbols/${android_app_abi}/libcronet.so", 1151 "$_package_dir/symbols/${android_app_abi}/libcronet.so",
1081 ] 1152 ]
1082 deps = [ 1153 deps = [
1083 ":cronet", 1154 ":cronet",
1084 ] 1155 ]
1085 } 1156 }
1086 1157
1158 copy("cronet_package_copy_native_test_lib") {
mef 2016/12/14 23:04:51 I wonder whether we need stripped native test lib
pauljensen 2016/12/15 04:08:35 libcronet_tests.so unstripped is more than 100 MB
mef 2016/12/15 18:06:34 Acknowledged.
jbudorick 2016/12/15 18:19:34 This is something we're currently wrestling with f
1159 testonly = true
1160 sources = [
1161 "$root_out_dir/libcronet_tests.so",
1162 "$root_out_dir/libnetty-tcnative.so",
1163 ]
1164 outputs = [
1165 "$_test_package_dir/libs/${android_app_abi}/{{source_file_part}}",
1166 ]
1167 deps = [
1168 ":cronet_tests",
1169 "//third_party/netty-tcnative:netty-tcnative-so",
1170 ]
1171 }
1172
1173 copy("cronet_package_copy_native_test_lib_unstripped") {
1174 testonly = true
1175 sources = [
1176 "$root_out_dir/lib.unstripped/libcronet_tests.so",
mef 2016/12/14 23:04:51 based on the comment above, would we ever need to
pauljensen 2016/12/15 04:08:35 The crash handler could probably symbolicate if we
mef 2016/12/15 18:06:34 Acknowledged.
1177 "$root_out_dir/lib.unstripped/libnetty-tcnative.so",
1178 ]
1179 outputs = [
1180 "$_test_package_dir/symbols/${android_app_abi}/{{source_file_part}}",
1181 ]
1182 deps = [
1183 ":cronet_tests",
1184 "//third_party/netty-tcnative:netty-tcnative-so",
1185 ]
1186 }
1187
1188 copy("cronet_package_copy_test_assets") {
1189 testonly = true
1190 sources = [
1191 "test/assets",
1192 ]
1193 outputs = [
1194 "$_test_package_dir/assets",
1195 ]
1196 }
1197
1198 copy("cronet_package_copy_test_support_apks") {
1199 testonly = true
1200 sources = [
1201 "$root_out_dir/apks/ChromiumNetTestSupport.apk",
mef 2016/12/14 23:04:51 Interesting. Maybe add comment that this provides
pauljensen 2016/12/15 04:08:35 Done.
1202 ]
1203 outputs = [
1204 "$_test_package_dir/apks/${android_app_abi}/{{source_file_part}}",
mef 2016/12/14 23:04:51 kudos for including abi into output path.
pauljensen 2016/12/15 04:08:34 Acknowledged.
1205 ]
1206 deps = [
1207 "//net/android:net_test_support_apk",
1208 ]
1209 }
1210
1211 copy("cronet_package_copy_test_files") {
1212 testonly = true
1213 sources = [
1214 "//net/data/ssl/certificates/quic_test.example.com.crt",
1215 "//net/data/ssl/certificates/quic_test.example.com.key",
1216 "//net/data/ssl/certificates/quic_test.example.com.key.pkcs8",
1217 "//net/data/ssl/certificates/quic_test.example.com.key.sct",
1218 ]
1219 outputs = [
1220 "$_test_package_dir/assets/test_files/net/data/ssl/certificates/{{source_fil e_part}}",
1221 ]
1222 deps = [
1223 # Not really dependent, but builds can fail if these two targets attempt
1224 # to create the "assets" subdirectory simultaneously.
1225 ":cronet_package_copy_test_assets",
1226 ]
1227 }
1228
1087 # Enforce that ARM Neon is not used when building for ARMv7 1229 # Enforce that ARM Neon is not used when building for ARMv7
1088 if (target_cpu == "arm" && arm_version == 7 && !arm_use_neon) { 1230 if (target_cpu == "arm" && arm_version == 7 && !arm_use_neon) {
1089 action("enforce_no_neon") { 1231 action("enforce_no_neon") {
1090 script = "//components/cronet/tools/check_no_neon.py" 1232 script = "//components/cronet/tools/check_no_neon.py"
1091 outputs = [ 1233 outputs = [
1092 "$target_gen_dir/$target_name.stamp", 1234 "$target_gen_dir/$target_name.stamp",
1093 ] 1235 ]
1094 args = [ 1236 args = [
1095 rebase_path("${android_tool_prefix}objdump", root_build_dir), 1237 rebase_path("${android_tool_prefix}objdump", root_build_dir),
1096 1238
1097 # libcronet.so may contain ARM Neon instructions from BoringSSL, but these 1239 # libcronet.so may contain ARM Neon instructions from BoringSSL, but these
1098 # are only used after checking whether the CPU supports NEON at runtime, 1240 # 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 1241 # so instead check base/ as it represents a large swath of code that only
1100 # contains Neon instructions when Neon is enabled by default. 1242 # contains Neon instructions when Neon is enabled by default.
1101 rebase_path("$root_out_dir/obj/base/base/*.o", root_build_dir), 1243 rebase_path("$root_out_dir/obj/base/base/*.o", root_build_dir),
1102 "--stamp", 1244 "--stamp",
1103 rebase_path(outputs[0], root_build_dir), 1245 rebase_path(outputs[0], root_build_dir),
1104 ] 1246 ]
1105 deps = [ 1247 deps = [
1106 "//base:base", 1248 "//base:base",
1107 ] 1249 ]
1108 } 1250 }
1109 } 1251 }
1110 1252
1111 group("cronet_package") { 1253 group("cronet_package") {
1254 # Marked as testonly as it contains test-only targets too.
1255 testonly = true
1256
1112 # Enforce that arm_use_neon==false when building for ARMv7 by 1257 # Enforce that arm_use_neon==false when building for ARMv7 by
1113 # not including any deps in cronet_package target otherwise. 1258 # not including any deps in cronet_package target otherwise.
1114 if (!(target_cpu == "arm" && arm_version == 7) || !arm_use_neon) { 1259 if (!(target_cpu == "arm" && arm_version == 7) || !arm_use_neon) {
1115 deps = [ 1260 deps = [
1116 ":cronet_package_copy", 1261 ":cronet_package_copy",
1117 ":cronet_package_copy_native_lib", 1262 ":cronet_package_copy_native_lib",
1118 ":cronet_package_copy_native_lib_unstripped", 1263 ":cronet_package_copy_native_lib_unstripped",
1264 ":cronet_test_package",
1119 ":generate_javadoc", 1265 ":generate_javadoc",
1120 ":generate_licenses", 1266 ":generate_licenses",
1121 ":jar_cronet_api_source", 1267 ":jar_cronet_api_source",
1122 ":jar_cronet_impl_common_java_source", 1268 ":jar_cronet_impl_common_java_source",
1123 ":jar_cronet_impl_native_java_source", 1269 ":jar_cronet_impl_native_java_source",
1124 ":jar_cronet_impl_platform_java_source", 1270 ":jar_cronet_impl_platform_java_source",
1125 ":jar_cronet_sample_source", 1271 ":jar_cronet_sample_source",
1126 ":repackage_extracted_jars", 1272 ":repackage_extracted_jars",
1127 ] 1273 ]
1128 if (current_cpu == "arm" && arm_version == 7) { 1274 if (current_cpu == "arm" && arm_version == 7) {
1129 deps += [ ":enforce_no_neon" ] 1275 deps += [ ":enforce_no_neon" ]
1130 } 1276 }
1131 } 1277 }
1132 } 1278 }
1279
1280 group("cronet_test_package") {
1281 testonly = true
1282
1283 # Enforce that arm_use_neon==false when building for ARMv7 by
1284 # not including any deps in cronet_package target otherwise.
1285 if (!(target_cpu == "arm" && arm_version == 7) || !arm_use_neon) {
mef 2016/12/14 23:04:51 Do we really need to enforce it here? What exactl
pauljensen 2016/12/15 04:08:34 No, removed.
1286 deps = [
1287 ":cronet_package_copy_native_test_lib",
1288 ":cronet_package_copy_native_test_lib_unstripped",
1289 ":cronet_package_copy_test_assets",
1290 ":cronet_package_copy_test_files",
1291 ":cronet_package_copy_test_support_apks",
1292 ":repackage_extracted_test_jars",
1293 ]
1294 }
1295 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698