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

Side by Side Diff: build/config/ios/rules.gni

Issue 2173493002: Convert ios_web_shell_test to GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@eg-tests-deps
Patch Set: Sync //ios/web/shell/test:earl_grey_test_support with gyp. Created 4 years, 5 months 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 | « build/config/ios/codesign.py ('k') | build/config/ios/xctest_shell.mm » ('j') | 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/config/ios/ios_sdk.gni") 5 import("//build/config/ios/ios_sdk.gni")
6 import("//build/config/mac/base_rules.gni") 6 import("//build/config/mac/base_rules.gni")
7 import("//build/config/mac/symbols.gni") 7 import("//build/config/mac/symbols.gni")
8 8
9 # Generates Info.plist files for Mac apps and frameworks. 9 # Generates Info.plist files for Mac apps and frameworks.
10 # 10 #
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 153
154 if (_is_fat_build && !_is_fat_build_main_target) { 154 if (_is_fat_build && !_is_fat_build_main_target) {
155 # For the non-default toolchain of a fat-build, the template expands to a 155 # For the non-default toolchain of a fat-build, the template expands to a
156 # single "executable" target that creates "$root_out_dir/$_output_name". 156 # single "executable" target that creates "$root_out_dir/$_output_name".
157 executable(_target_name) { 157 executable(_target_name) {
158 forward_variables_from(invoker, 158 forward_variables_from(invoker,
159 "*", 159 "*",
160 [ 160 [
161 "bundle_deps", 161 "bundle_deps",
162 "bundle_extension", 162 "bundle_extension",
163 "extra_system_frameworks",
163 "entitlements_path", 164 "entitlements_path",
164 "extra_substitutions", 165 "extra_substitutions",
165 "info_plist", 166 "info_plist",
166 "info_plist_target", 167 "info_plist_target",
167 "output_name", 168 "output_name",
168 "product_type", 169 "product_type",
169 ]) 170 ])
170 171
171 if (defined(visibility)) { 172 if (defined(visibility)) {
172 visibility += [ ":*($default_toolchain)" ] 173 visibility += [ ":*($default_toolchain)" ]
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 233
233 _arch_executable_path = "$target_out_dir/$current_cpu/$_output_name" 234 _arch_executable_path = "$target_out_dir/$current_cpu/$_output_name"
234 } 235 }
235 236
236 executable(_link_executable) { 237 executable(_link_executable) {
237 forward_variables_from(invoker, 238 forward_variables_from(invoker,
238 "*", 239 "*",
239 [ 240 [
240 "bundle_deps", 241 "bundle_deps",
241 "bundle_extension", 242 "bundle_extension",
243 "extra_system_frameworks",
242 "data_deps", 244 "data_deps",
243 "entitlements_path", 245 "entitlements_path",
244 "extra_substitutions", 246 "extra_substitutions",
245 "info_plist", 247 "info_plist",
246 "info_plist_target", 248 "info_plist_target",
247 "output_name", 249 "output_name",
248 "product_type", 250 "product_type",
249 "visibility", 251 "visibility",
250 ]) 252 ])
251 253
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 public_deps = [ 353 public_deps = [
352 ":$_link_executable", 354 ":$_link_executable",
353 ] 355 ]
354 } 356 }
355 sources = [ 357 sources = [
356 "$target_out_dir/$_output_name", 358 "$target_out_dir/$_output_name",
357 ] 359 ]
358 } 360 }
359 } 361 }
360 362
363 if (!ios_enable_code_signing && defined(invoker.extra_system_frameworks)) {
364 bundle_data(_target_name + "_extra_system_frameworks") {
365 visibility = [ ":$_target_name" ]
366 sources = invoker.extra_system_frameworks
367 outputs = [
368 "{{bundle_resources_dir}}/Frameworks/{{source_file_part}}",
369 ]
370 }
371 }
372
361 create_bundle(target_name) { 373 create_bundle(target_name) {
362 forward_variables_from(invoker, 374 forward_variables_from(invoker,
363 [ 375 [
364 "data_deps", 376 "data_deps",
365 "deps", 377 "deps",
366 "public_deps", 378 "public_deps",
367 "testonly", 379 "testonly",
368 "visibility", 380 "visibility",
369 ]) 381 ])
370 382
371 if (!defined(deps)) { 383 if (!defined(deps)) {
372 deps = [] 384 deps = []
373 } 385 }
374 deps += [ ":$_bundle_data_info_plist" ] 386 deps += [ ":$_bundle_data_info_plist" ]
375 if (ios_enable_code_signing) { 387 if (ios_enable_code_signing) {
376 if (_is_fat_build) { 388 if (_is_fat_build) {
377 deps += [ ":$_lipo_executable" ] 389 deps += [ ":$_lipo_executable" ]
378 } else { 390 } else {
379 deps += [ ":$_link_executable" ] 391 deps += [ ":$_link_executable" ]
380 } 392 }
381 } else { 393 } else {
382 deps += [ ":$_bundle_data_executable" ] 394 deps += [ ":$_bundle_data_executable" ]
395 if (defined(invoker.extra_system_frameworks)) {
396 deps += [ ":${_target_name}_extra_system_frameworks" ]
397 }
383 } 398 }
384 if (defined(invoker.bundle_deps)) { 399 if (defined(invoker.bundle_deps)) {
385 deps += invoker.bundle_deps 400 deps += invoker.bundle_deps
386 } 401 }
387 402
388 if (use_ios_simulator) { 403 if (use_ios_simulator) {
389 if (!defined(data_deps)) { 404 if (!defined(data_deps)) {
390 data_deps = [] 405 data_deps = []
391 } 406 }
392 data_deps += [ "//testing/iossim" ] 407 data_deps += [ "//testing/iossim" ]
(...skipping 25 matching lines...) Expand all
418 code_signing_script = "//build/config/ios/codesign.py" 433 code_signing_script = "//build/config/ios/codesign.py"
419 code_signing_sources = [ 434 code_signing_sources = [
420 _entitlements_path, 435 _entitlements_path,
421 "$target_out_dir/$_output_name", 436 "$target_out_dir/$_output_name",
422 ] 437 ]
423 code_signing_outputs = [ 438 code_signing_outputs = [
424 "$bundle_root_dir/$_output_name", 439 "$bundle_root_dir/$_output_name",
425 "$bundle_root_dir/_CodeSignature/CodeResources", 440 "$bundle_root_dir/_CodeSignature/CodeResources",
426 "$bundle_root_dir/embedded.mobileprovision", 441 "$bundle_root_dir/embedded.mobileprovision",
427 ] 442 ]
443 if (defined(invoker.extra_system_frameworks)) {
444 foreach(_framework, invoker.extra_system_frameworks) {
445 code_signing_outputs += [ "$bundle_root_dir/Frameworks/" +
446 get_path_info(_framework, "name") ]
447 }
448 }
428 code_signing_args = [ 449 code_signing_args = [
429 "-i=" + ios_code_signing_identity, 450 "-i=" + ios_code_signing_identity,
430 "-b=" + rebase_path("$target_out_dir/$_output_name", root_build_dir), 451 "-b=" + rebase_path("$target_out_dir/$_output_name", root_build_dir),
431 "-e=" + rebase_path(_entitlements_path, root_build_dir), 452 "-e=" + rebase_path(_entitlements_path, root_build_dir),
432 rebase_path(bundle_root_dir, root_build_dir), 453 rebase_path(bundle_root_dir, root_build_dir),
433 ] 454 ]
455 if (defined(invoker.extra_system_frameworks)) {
456 # All framework in extra_system_frameworks are expected to be
457 # system framework and the path to be already system absolute
458 # so do not use rebase_path here.
459 foreach(_framework, invoker.extra_system_frameworks) {
460 code_signing_args += [ "-F=" + _framework ]
461 }
462 }
434 } 463 }
435 } 464 }
436 } 465 }
437 466
438 # TODO(crbug.com/395883): ensure those variables are marked as used to 467 # TODO(crbug.com/395883): ensure those variables are marked as used to
439 # avoid errors while running "gn gen". 468 # avoid errors while running "gn gen".
440 if (defined(invoker.entitlements_path)) { 469 if (defined(invoker.entitlements_path)) {
441 assert(invoker.entitlements_path != "", 470 assert(invoker.entitlements_path != "",
442 "mark invoker.entitlements_path as used") 471 "mark invoker.entitlements_path as used")
443 } 472 }
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 798
770 group(_framework_headers_target) { 799 group(_framework_headers_target) {
771 deps = [ 800 deps = [
772 ":$_compile_headers_map_target", 801 ":$_compile_headers_map_target",
773 ":$_copy_public_headers_target", 802 ":$_copy_public_headers_target",
774 ":$_create_module_map_target", 803 ":$_create_module_map_target",
775 ] 804 ]
776 } 805 }
777 806
778 config(_framework_public_config) { 807 config(_framework_public_config) {
779 visibility = [ ":$_framework_public_config" ]
780 common_flags = [ "-F" + rebase_path("$root_out_dir/.", root_build_dir) ]
781 cflags_objc = common_flags
782 cflags_objcc = common_flags
783
784 # The link settings are inherited from the framework_bundle config. 808 # The link settings are inherited from the framework_bundle config.
809 cflags = [
810 "-F",
811 rebase_path("$root_out_dir/.", root_build_dir),
812 ]
785 } 813 }
786 } 814 }
787 } 815 }
788 816
789 if (!_is_fat_build || _is_fat_build_main_target) { 817 if (!_is_fat_build || _is_fat_build_main_target) {
790 _info_plist_target = _target_name + "_info_plist" 818 _info_plist_target = _target_name + "_info_plist"
791 _info_plist_bundle = _target_name + "_info_plist_bundle" 819 _info_plist_bundle = _target_name + "_info_plist_bundle"
792 ios_info_plist(_info_plist_target) { 820 ios_info_plist(_info_plist_target) {
793 visibility = [ ":$_info_plist_bundle" ] 821 visibility = [ ":$_info_plist_bundle" ]
794 executable_name = _output_name 822 executable_name = _output_name
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 outputs = [ 931 outputs = [
904 "{{bundle_resources_dir}}/Frameworks/$_output_name.framework", 932 "{{bundle_resources_dir}}/Frameworks/$_output_name.framework",
905 ] 933 ]
906 } 934 }
907 } 935 }
908 } 936 }
909 937
910 set_defaults("ios_framework_bundle") { 938 set_defaults("ios_framework_bundle") {
911 configs = default_shared_library_configs 939 configs = default_shared_library_configs
912 } 940 }
941
942 # For Chrome on iOS we want to run XCTests for all our build configurations
943 # (Debug, Release, ...). In addition, the symbols visibility is configured to
944 # private by default. To simplify testing with those constraints, our tests are
945 # compiled in the TEST_HOST target instead of the .xctest bundle.
946 template("ios_xctest_test") {
947 _target_name = target_name
948 _output_name = target_name
949 if (defined(invoker.output_name)) {
950 _output_name = invoker.output_name
951 }
952
953 _is_fat_build = additional_toolchains != []
954 if (_is_fat_build) {
955 _is_fat_build_main_target = current_toolchain == default_toolchain
956 }
957
958 _xctest_target = _target_name
959 _xctest_output = _output_name
960
961 _host_target = _target_name + "_host"
962 _host_output = _output_name + "_host"
963
964 if (_is_fat_build && !_is_fat_build_main_target) {
965 loadable_module(_xctest_target) {
966 visibility = [ ":${_xctest_target}_loadable_module($default_toolchain)" ]
967 sources = [
968 "//build/config/ios/xctest_shell.mm",
969 ]
970 configs += [ "//build/config/ios:xctest_config" ]
971
972 output_name = _xctest_output
973 output_extension = ""
974 }
975 } else {
976 _xctest_info_plist_target = _xctest_target + "_info_plist"
977 _xctest_info_plist_bundle = _xctest_target + "_info_plist_bundle"
978 ios_info_plist(_xctest_info_plist_target) {
979 visibility = [ ":$_xctest_info_plist_bundle" ]
980 info_plist = "//build/config/ios/Module-Info.plist"
981 executable_name = _output_name
982 }
983
984 bundle_data(_xctest_info_plist_bundle) {
985 visibility = [ ":$_xctest_target" ]
986 public_deps = [
987 ":$_xctest_info_plist_target",
988 ]
989 sources = get_target_outputs(":$_xctest_info_plist_target")
990 outputs = [
991 "{{bundle_root_dir}}/Info.plist",
992 ]
993 }
994
995 _xctest_loadable_module_target = _xctest_target + "_loadable_module"
996 _xctest_loadable_module_path = "$target_out_dir/$_xctest_output"
997
998 if (!ios_enable_code_signing) {
999 _xctest_loadable_module_bundle =
1000 _xctest_target + "_loadable_module_bundle"
1001 _xctest_loadable_module_visibility =
1002 [ ":$_xctest_loadable_module_bundle" ]
1003 } else {
1004 _xctest_loadable_module_visibility = [ ":$_xctest_target" ]
1005 }
1006
1007 if (_is_fat_build) {
1008 _xctest_lipo_loadable_module_target = _xctest_loadable_module_target
1009 _xctest_lipo_loadable_module_visibility =
1010 _xctest_loadable_module_visibility
1011 _arch_xctest_loadable_module_path =
1012 "$target_out_dir/$current_cpu/$_xctest_output"
1013
1014 _xctest_loadable_module_visibility = []
1015 _xctest_loadable_module_visibility =
1016 [ ":$_xctest_lipo_loadable_module_target" ]
1017 _xctest_loadable_module_target = _xctest_target + "_arch_loadable_module"
1018 }
1019
1020 loadable_module(_xctest_loadable_module_target) {
1021 visibility = _xctest_loadable_module_visibility
1022 sources = [
1023 "//build/config/ios/xctest_shell.mm",
1024 ]
1025 configs += [ "//build/config/ios:xctest_config" ]
1026
1027 if (_is_fat_build) {
1028 output_name =
1029 rebase_path(_arch_xctest_loadable_module_path, root_out_dir)
1030 } else {
1031 output_name = rebase_path(_xctest_loadable_module_path, root_out_dir)
1032 }
1033
1034 output_prefix_override = true
1035 output_extension = ""
1036 }
1037
1038 if (_is_fat_build) {
1039 action(_xctest_lipo_loadable_module_target) {
1040 visibility = _xctest_lipo_loadable_module_visibility
1041 script = "//build/toolchain/mac/linker_driver.py"
1042 outputs = [
1043 _xctest_loadable_module_path,
1044 ]
1045 inputs = [
1046 _arch_xctest_loadable_module_path,
1047 ]
1048 deps = [
1049 ":$_xctest_loadable_module_target",
1050 ]
1051 foreach(_additional_toolchain, additional_toolchains) {
1052 _additional_toolchain_target = "$_target_name($_additional_toolchain)"
1053 deps += [ ":$_additional_toolchain_target" ]
1054 inputs += [ get_label_info(_additional_toolchain_target,
1055 "root_out_dir") + "/$_xctest_output" ]
1056 }
1057 args = [
1058 "xcrun",
1059 "lipo",
1060 "-create",
1061 "-output",
1062 rebase_path(outputs[0], root_build_dir),
1063 ] + rebase_path(inputs, root_build_dir)
1064
1065 if (enable_dsyms) {
1066 outputs += [ "$root_out_dir/$_xctest_output.dSYM/" ]
1067 args +=
1068 [ "-Wcrl,dsym," + rebase_path("$root_out_dir/.", root_build_dir) ]
1069 }
1070
1071 if (enable_stripping) {
1072 # Check whether //build/config/mac:strip_all has been removed from
1073 # the configs variable (as this is how stripping is disabled for a
1074 # single target).
1075 _strip_all_in_config = false
1076 if (defined(invoker.configs)) {
1077 foreach(_config, invoker.configs) {
1078 if (_config == "//build/config/mac:strip_all") {
1079 _strip_all_in_config = true
1080 }
1081 }
1082 }
1083
1084 if (_strip_all_in_config) {
1085 args += [ "-Wcrl,strip,-x,-S" ]
1086
1087 if (save_unstripped_output) {
1088 outputs += [ outputs[0] + ".unstripped" ]
1089 args += [ "-Wcrl,unstripped," +
1090 rebase_path(get_path_info(outputs[0], "dir"),
1091 root_build_dir) ]
1092 }
1093 }
1094 }
1095 }
1096 }
1097
1098 if (!ios_enable_code_signing) {
1099 bundle_data(_xctest_loadable_module_bundle) {
1100 visibility = [ ":$_xctest_target" ]
1101 if (_is_fat_build) {
1102 public_deps = [
1103 ":$_xctest_lipo_loadable_module_target",
1104 ]
1105 } else {
1106 public_deps = [
1107 ":$_xctest_loadable_module_target",
1108 ]
1109 }
1110 sources = [
1111 "$target_out_dir/$_xctest_output",
1112 ]
1113 outputs = [
1114 "{{bundle_root_dir}}/$_xctest_output",
1115 ]
1116 }
1117 }
1118
1119 _xctest_bundle = _xctest_target + "_bundle"
1120
1121 create_bundle(_xctest_target) {
1122 visibility = [ ":$_xctest_bundle" ]
1123 product_type = "com.apple.product-type.bundle.unit-test"
1124 deps = [
1125 ":$_xctest_info_plist_bundle",
1126 ]
1127 bundle_root_dir = "$root_out_dir/$_xctest_output.xctest"
1128
1129 if (!ios_enable_code_signing) {
1130 deps += [ ":$_xctest_loadable_module_bundle" ]
1131 } else {
1132 if (_is_fat_build) {
1133 deps += [ ":$_xctest_lipo_loadable_module_target" ]
1134 } else {
1135 deps += [ ":$_xctest_loadable_module_target" ]
1136 }
1137
1138 _entitlements_path = "$ios_sdk_path/Entitlements.plist"
1139 if (defined(invoker.entitlements_path)) {
1140 _entitlements_path = invoker.entitlements_path
1141 }
1142
1143 code_signing_script = "//build/config/ios/codesign.py"
1144 code_signing_sources = [
1145 _entitlements_path,
1146 "$target_out_dir/$_xctest_output",
1147 ]
1148 code_signing_outputs = [
1149 "$bundle_root_dir/$_xctest_output",
1150 "$bundle_root_dir/_CodeSignature/CodeResources",
1151 "$bundle_root_dir/embedded.mobileprovision",
1152 ]
1153 code_signing_args = [
1154 "-i=" + ios_code_signing_identity,
1155 "-b=" +
1156 rebase_path("$target_out_dir/$_xctest_output", root_build_dir),
1157 "-e=" + rebase_path(_entitlements_path, root_build_dir),
1158 rebase_path(bundle_root_dir, root_build_dir),
1159 ]
1160 }
1161 }
1162
1163 bundle_data(_xctest_bundle) {
1164 visibility = [ ":$_host_target" ]
1165 public_deps = [
1166 ":$_xctest_target",
1167 ]
1168 sources = [
1169 "$root_out_dir/$_xctest_output.xctest",
1170 ]
1171 outputs = [
1172 "{{bundle_plugins_dir}}/$_xctest_output.xctest",
1173 ]
1174 }
1175 }
1176
1177 ios_app_bundle(_host_target) {
1178 forward_variables_from(invoker, "*", [ "testonly" ])
1179
1180 testonly = true
1181 output_name = _host_output
1182 info_plist = "//build/config/ios/Host-Info.plist"
1183 configs += [ "//build/config/ios:xctest_config" ]
1184
1185 # Xcode needs those two framework installed in the application (and signed)
1186 # for the XCTest to run, so install them using extra_system_frameworks.
1187 _ios_platform_library = "$ios_sdk_platform_path/Developer/Library"
1188 extra_system_frameworks = [
1189 "$_ios_platform_library/Frameworks/XCTest.framework",
1190 "$_ios_platform_library/PrivateFrameworks/IDEBundleInjection.framework",
1191 ]
1192
1193 if (!_is_fat_build || _is_fat_build_main_target) {
1194 if (!defined(bundle_deps)) {
1195 bundle_deps = []
1196 }
1197 bundle_deps += [ ":$_xctest_bundle" ]
1198 }
1199
1200 if (!defined(ldflags)) {
1201 ldflags = []
1202 }
1203 ldflags += [
1204 "-Xlinker",
1205 "-rpath",
1206 "-Xlinker",
1207 "@executable_path/Frameworks",
1208 "-Xlinker",
1209 "-rpath",
1210 "-Xlinker",
1211 "@loader_path/Frameworks",
1212 ]
1213 }
1214 }
1215
1216 set_defaults("ios_xctest_test") {
1217 configs = default_executable_configs
1218 }
OLDNEW
« no previous file with comments | « build/config/ios/codesign.py ('k') | build/config/ios/xctest_shell.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698