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/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 import("//build/toolchain/toolchain.gni") | 8 import("//build/toolchain/toolchain.gni") |
9 | 9 |
10 # Invokes lipo on multiple arch-specific binaries to create a fat binary. | 10 # Invokes lipo on multiple arch-specific binaries to create a fat binary. |
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 # (Debug, Release, ...). In addition, the symbols visibility is configured to | 1263 # (Debug, Release, ...). In addition, the symbols visibility is configured to |
1264 # private by default. To simplify testing with those constraints, our tests are | 1264 # private by default. To simplify testing with those constraints, our tests are |
1265 # compiled in the TEST_HOST target instead of the .xctest bundle. | 1265 # compiled in the TEST_HOST target instead of the .xctest bundle. |
1266 template("ios_xctest_test") { | 1266 template("ios_xctest_test") { |
1267 _target_name = target_name | 1267 _target_name = target_name |
1268 _output_name = target_name | 1268 _output_name = target_name |
1269 if (defined(invoker.output_name)) { | 1269 if (defined(invoker.output_name)) { |
1270 _output_name = invoker.output_name | 1270 _output_name = invoker.output_name |
1271 } | 1271 } |
1272 | 1272 |
1273 _xctest_target = _target_name | 1273 # TODO(crbug.com/662404): Remove when downstream have been changed to use |
1274 _xctest_output = _output_name | 1274 # the new name for the xctest app bundles. |
| 1275 _use_new_naming_convention = false |
| 1276 if (defined(invoker.use_new_naming_convention)) { |
| 1277 _use_new_naming_convention = invoker.use_new_naming_convention |
| 1278 } |
1275 | 1279 |
1276 _host_target = _target_name + "_host" | 1280 if (_use_new_naming_convention) { |
1277 _host_output = _output_name + "_host" | 1281 _xctest_target = _target_name + "_module" |
| 1282 _xctest_output = _output_name + "_module" |
| 1283 |
| 1284 _host_target = _target_name |
| 1285 _host_output = _output_name |
| 1286 } else { |
| 1287 _xctest_target = _target_name |
| 1288 _xctest_output = _output_name |
| 1289 |
| 1290 _host_target = _target_name + "_host" |
| 1291 _host_output = _output_name + "_host" |
| 1292 } |
1278 | 1293 |
1279 _xctest_arch_loadable_module_target = _xctest_target + "_arch_loadable_module" | 1294 _xctest_arch_loadable_module_target = _xctest_target + "_arch_loadable_module" |
1280 _xctest_lipo_loadable_module_target = _xctest_target + "_loadable_module" | 1295 _xctest_lipo_loadable_module_target = _xctest_target + "_loadable_module" |
1281 | 1296 |
1282 loadable_module(_xctest_arch_loadable_module_target) { | 1297 loadable_module(_xctest_arch_loadable_module_target) { |
1283 visibility = [ ":$_xctest_lipo_loadable_module_target($default_toolchain)" ] | 1298 visibility = [ ":$_xctest_lipo_loadable_module_target($default_toolchain)" ] |
1284 if (current_toolchain != default_toolchain) { | 1299 if (current_toolchain != default_toolchain) { |
1285 visibility += [ ":$_target_name" ] | 1300 visibility += [ ":$_xctest_target" ] |
1286 } | 1301 } |
1287 | 1302 |
1288 sources = [ | 1303 sources = [ |
1289 "//build/config/ios/xctest_shell.mm", | 1304 "//build/config/ios/xctest_shell.mm", |
1290 ] | 1305 ] |
1291 configs += [ "//build/config/ios:xctest_config" ] | 1306 configs += [ "//build/config/ios:xctest_config" ] |
1292 | 1307 |
1293 output_dir = "$target_out_dir/$current_cpu" | 1308 output_dir = "$target_out_dir/$current_cpu" |
1294 output_name = _xctest_output | 1309 output_name = _xctest_output |
1295 output_prefix_override = true | 1310 output_prefix_override = true |
1296 output_extension = "" | 1311 output_extension = "" |
1297 } | 1312 } |
1298 | 1313 |
1299 if (current_toolchain != default_toolchain) { | 1314 if (current_toolchain != default_toolchain) { |
1300 # For fat builds, only the default toolchain will generate a test bundle. | 1315 # For fat builds, only the default toolchain will generate a test bundle. |
1301 # For the other toolchains, the template is only used for building the | 1316 # For the other toolchains, the template is only used for building the |
1302 # arch-specific binary, thus the default target is just a group(). | 1317 # arch-specific binary, thus the default target is just a group(). |
1303 group(_target_name) { | 1318 group(_xctest_target) { |
1304 forward_variables_from(invoker, | 1319 forward_variables_from(invoker, |
1305 [ | 1320 [ |
1306 "visibility", | 1321 "visibility", |
1307 "testonly", | 1322 "testonly", |
1308 ]) | 1323 ]) |
1309 public_deps = [ | 1324 public_deps = [ |
1310 ":$_xctest_arch_loadable_module_target", | 1325 ":$_xctest_arch_loadable_module_target", |
1311 ] | 1326 ] |
1312 } | 1327 } |
1313 } else { | 1328 } else { |
1314 _xctest_info_plist_target = _xctest_target + "_info_plist" | 1329 _xctest_info_plist_target = _xctest_target + "_info_plist" |
1315 _xctest_info_plist_bundle = _xctest_target + "_info_plist_bundle" | 1330 _xctest_info_plist_bundle = _xctest_target + "_info_plist_bundle" |
1316 ios_info_plist(_xctest_info_plist_target) { | 1331 ios_info_plist(_xctest_info_plist_target) { |
1317 visibility = [ ":$_xctest_info_plist_bundle" ] | 1332 visibility = [ ":$_xctest_info_plist_bundle" ] |
1318 info_plist = "//build/config/ios/Module-Info.plist" | 1333 info_plist = "//build/config/ios/Module-Info.plist" |
1319 executable_name = _output_name | 1334 extra_substitutions = [ "MODULE_NAME=$_xctest_output" ] |
| 1335 executable_name = _host_output |
1320 } | 1336 } |
1321 | 1337 |
1322 bundle_data(_xctest_info_plist_bundle) { | 1338 bundle_data(_xctest_info_plist_bundle) { |
1323 visibility = [ ":$_xctest_target" ] | 1339 visibility = [ ":$_xctest_target" ] |
1324 public_deps = [ | 1340 public_deps = [ |
1325 ":$_xctest_info_plist_target", | 1341 ":$_xctest_info_plist_target", |
1326 ] | 1342 ] |
1327 sources = get_target_outputs(":$_xctest_info_plist_target") | 1343 sources = get_target_outputs(":$_xctest_info_plist_target") |
1328 outputs = [ | 1344 outputs = [ |
1329 "{{bundle_root_dir}}/Info.plist", | 1345 "{{bundle_root_dir}}/Info.plist", |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1412 "-rpath", | 1428 "-rpath", |
1413 "-Xlinker", | 1429 "-Xlinker", |
1414 "@loader_path/Frameworks", | 1430 "@loader_path/Frameworks", |
1415 ] | 1431 ] |
1416 } | 1432 } |
1417 } | 1433 } |
1418 | 1434 |
1419 set_defaults("ios_xctest_test") { | 1435 set_defaults("ios_xctest_test") { |
1420 configs = default_executable_configs | 1436 configs = default_executable_configs |
1421 } | 1437 } |
OLD | NEW |