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 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1261 # (Debug, Release, ...). In addition, the symbols visibility is configured to | 1261 # (Debug, Release, ...). In addition, the symbols visibility is configured to |
1262 # private by default. To simplify testing with those constraints, our tests are | 1262 # private by default. To simplify testing with those constraints, our tests are |
1263 # compiled in the TEST_HOST target instead of the .xctest bundle. | 1263 # compiled in the TEST_HOST target instead of the .xctest bundle. |
1264 template("ios_xctest_test") { | 1264 template("ios_xctest_test") { |
1265 _target_name = target_name | 1265 _target_name = target_name |
1266 _output_name = target_name | 1266 _output_name = target_name |
1267 if (defined(invoker.output_name)) { | 1267 if (defined(invoker.output_name)) { |
1268 _output_name = invoker.output_name | 1268 _output_name = invoker.output_name |
1269 } | 1269 } |
1270 | 1270 |
1271 _xctest_target = _target_name | 1271 _xctest_target = _target_name + "_module" |
1272 _xctest_output = _output_name | 1272 _xctest_output = _output_name + "_module" |
1273 | 1273 |
1274 _host_target = _target_name + "_host" | 1274 _host_target = _target_name |
1275 _host_output = _output_name + "_host" | 1275 _host_output = _output_name |
1276 | 1276 |
1277 _xctest_arch_loadable_module_target = _xctest_target + "_arch_loadable_module" | 1277 _xctest_arch_loadable_module_target = _xctest_target + "_arch_loadable_module" |
1278 _xctest_lipo_loadable_module_target = _xctest_target + "_loadable_module" | 1278 _xctest_lipo_loadable_module_target = _xctest_target + "_loadable_module" |
1279 | 1279 |
1280 loadable_module(_xctest_arch_loadable_module_target) { | 1280 loadable_module(_xctest_arch_loadable_module_target) { |
1281 visibility = [ ":$_xctest_lipo_loadable_module_target($default_toolchain)" ] | 1281 visibility = [ ":$_xctest_lipo_loadable_module_target($default_toolchain)" ] |
1282 if (current_toolchain != default_toolchain) { | 1282 if (current_toolchain != default_toolchain) { |
1283 visibility += [ ":$_target_name" ] | 1283 visibility += [ ":$_xctest_target" ] |
1284 } | 1284 } |
1285 | 1285 |
1286 sources = [ | 1286 sources = [ |
1287 "//build/config/ios/xctest_shell.mm", | 1287 "//build/config/ios/xctest_shell.mm", |
1288 ] | 1288 ] |
1289 configs += [ "//build/config/ios:xctest_config" ] | 1289 configs += [ "//build/config/ios:xctest_config" ] |
1290 | 1290 |
1291 output_dir = "$target_out_dir/$current_cpu" | 1291 output_dir = "$target_out_dir/$current_cpu" |
1292 output_name = _xctest_output | 1292 output_name = _xctest_output |
1293 output_prefix_override = true | 1293 output_prefix_override = true |
1294 output_extension = "" | 1294 output_extension = "" |
1295 } | 1295 } |
1296 | 1296 |
1297 if (current_toolchain != default_toolchain) { | 1297 if (current_toolchain != default_toolchain) { |
1298 # For fat builds, only the default toolchain will generate a test bundle. | 1298 # For fat builds, only the default toolchain will generate a test bundle. |
1299 # For the other toolchains, the template is only used for building the | 1299 # For the other toolchains, the template is only used for building the |
1300 # arch-specific binary, thus the default target is just a group(). | 1300 # arch-specific binary, thus the default target is just a group(). |
1301 group(_target_name) { | 1301 group(_xctest_target) { |
1302 forward_variables_from(invoker, | 1302 forward_variables_from(invoker, |
1303 [ | 1303 [ |
1304 "visibility", | 1304 "visibility", |
1305 "testonly", | 1305 "testonly", |
1306 ]) | 1306 ]) |
1307 public_deps = [ | 1307 public_deps = [ |
1308 ":$_xctest_arch_loadable_module_target", | 1308 ":$_xctest_arch_loadable_module_target", |
1309 ] | 1309 ] |
1310 } | 1310 } |
1311 } else { | 1311 } else { |
1312 _xctest_info_plist_target = _xctest_target + "_info_plist" | 1312 _xctest_info_plist_target = _xctest_target + "_info_plist" |
1313 _xctest_info_plist_bundle = _xctest_target + "_info_plist_bundle" | 1313 _xctest_info_plist_bundle = _xctest_target + "_info_plist_bundle" |
1314 ios_info_plist(_xctest_info_plist_target) { | 1314 ios_info_plist(_xctest_info_plist_target) { |
1315 visibility = [ ":$_xctest_info_plist_bundle" ] | 1315 visibility = [ ":$_xctest_info_plist_bundle" ] |
1316 info_plist = "//build/config/ios/Module-Info.plist" | 1316 info_plist = "//build/config/ios/Module-Info.plist" |
1317 executable_name = _output_name | 1317 extra_substitutions = [ "MODULE_NAME=$_xctest_output" ] |
1318 executable_name = _host_output | |
1318 } | 1319 } |
1319 | 1320 |
1320 bundle_data(_xctest_info_plist_bundle) { | 1321 bundle_data(_xctest_info_plist_bundle) { |
1321 visibility = [ ":$_xctest_target" ] | 1322 visibility = [ ":$_xctest_target" ] |
1322 public_deps = [ | 1323 public_deps = [ |
1323 ":$_xctest_info_plist_target", | 1324 ":$_xctest_info_plist_target", |
1324 ] | 1325 ] |
1325 sources = get_target_outputs(":$_xctest_info_plist_target") | 1326 sources = get_target_outputs(":$_xctest_info_plist_target") |
1326 outputs = [ | 1327 outputs = [ |
1327 "{{bundle_root_dir}}/Info.plist", | 1328 "{{bundle_root_dir}}/Info.plist", |
(...skipping 24 matching lines...) Expand all Loading... | |
1352 output_name = _xctest_output | 1353 output_name = _xctest_output |
1353 bundle_binary_target = ":$_xctest_lipo_loadable_module_target" | 1354 bundle_binary_target = ":$_xctest_lipo_loadable_module_target" |
1354 bundle_binary_output = _xctest_output | 1355 bundle_binary_output = _xctest_output |
1355 | 1356 |
1356 deps = [ | 1357 deps = [ |
1357 ":$_xctest_info_plist_bundle", | 1358 ":$_xctest_info_plist_bundle", |
1358 ] | 1359 ] |
1359 } | 1360 } |
1360 | 1361 |
1361 bundle_data(_xctest_bundle) { | 1362 bundle_data(_xctest_bundle) { |
1362 visibility = [ ":$_host_target" ] | 1363 visibility = [ |
1364 ":${_host_target}", | |
1365 ":${_host_target}_host", | |
baxley
2016/11/04 15:26:20
this will also go away as part of crbug.com/662404
sdefresne
2016/11/04 15:57:26
The answer would have been yes, but I tweaked the
| |
1366 ] | |
1363 public_deps = [ | 1367 public_deps = [ |
1364 ":$_xctest_target", | 1368 ":$_xctest_target", |
1365 ] | 1369 ] |
1366 sources = [ | 1370 sources = [ |
1367 "$root_out_dir/$_xctest_output.xctest", | 1371 "$root_out_dir/$_xctest_output.xctest", |
1368 ] | 1372 ] |
1369 outputs = [ | 1373 outputs = [ |
1370 "{{bundle_plugins_dir}}/$_xctest_output.xctest", | 1374 "{{bundle_plugins_dir}}/$_xctest_output.xctest", |
1371 ] | 1375 ] |
1372 } | 1376 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1405 "-Xlinker", | 1409 "-Xlinker", |
1406 "-rpath", | 1410 "-rpath", |
1407 "-Xlinker", | 1411 "-Xlinker", |
1408 "@executable_path/Frameworks", | 1412 "@executable_path/Frameworks", |
1409 "-Xlinker", | 1413 "-Xlinker", |
1410 "-rpath", | 1414 "-rpath", |
1411 "-Xlinker", | 1415 "-Xlinker", |
1412 "@loader_path/Frameworks", | 1416 "@loader_path/Frameworks", |
1413 ] | 1417 ] |
1414 } | 1418 } |
1419 | |
1420 # TODO(crbug.com/662404): Remove when downstream have been changed to use | |
1421 # the new name for the xctest app bundles. | |
1422 ios_app_bundle(_host_target + "_host") { | |
1423 forward_variables_from(invoker, "*", [ "testonly" ]) | |
1424 | |
1425 testonly = true | |
1426 output_name = _host_output + "_host" | |
1427 configs += [ "//build/config/ios:xctest_config" ] | |
1428 | |
1429 if (!defined(invoker.info_plist) && !defined(invoker.info_plist_target)) { | |
1430 info_plist = "//build/config/ios/Host-Info.plist" | |
1431 } | |
1432 | |
1433 # Xcode needs those two framework installed in the application (and signed) | |
1434 # for the XCTest to run, so install them using extra_system_frameworks. | |
1435 _ios_platform_library = "$ios_sdk_platform_path/Developer/Library" | |
1436 extra_system_frameworks = [ | |
1437 "$_ios_platform_library/Frameworks/XCTest.framework", | |
1438 "$_ios_platform_library/PrivateFrameworks/IDEBundleInjection.framework", | |
1439 ] | |
1440 | |
1441 if (current_toolchain == default_toolchain) { | |
1442 if (!defined(bundle_deps)) { | |
1443 bundle_deps = [] | |
1444 } | |
1445 bundle_deps += [ ":$_xctest_bundle" ] | |
1446 } | |
1447 | |
1448 if (!defined(ldflags)) { | |
1449 ldflags = [] | |
1450 } | |
1451 ldflags += [ | |
1452 "-Xlinker", | |
1453 "-rpath", | |
1454 "-Xlinker", | |
1455 "@executable_path/Frameworks", | |
1456 "-Xlinker", | |
1457 "-rpath", | |
1458 "-Xlinker", | |
1459 "@loader_path/Frameworks", | |
1460 ] | |
1461 } | |
1415 } | 1462 } |
1416 | 1463 |
1417 set_defaults("ios_xctest_test") { | 1464 set_defaults("ios_xctest_test") { |
1418 configs = default_executable_configs | 1465 configs = default_executable_configs |
1419 } | 1466 } |
OLD | NEW |