@@ -1262,234 +1262,12 @@ function get_host_specific_variable() {
1262
1262
}
1263
1263
1264
1264
function calculate_targets_for_host() {
1265
- local host=$1
1266
-
1267
- SWIFT_STDLIB_TARGETS=()
1268
- SWIFT_SDKS=()
1269
- SWIFT_BENCHMARK_TARGETS=()
1270
- SWIFT_RUN_BENCHMARK_TARGETS=()
1271
- SWIFT_TEST_TARGETS=()
1272
-
1273
- # Get the list of Target platforms for the Host
1274
- local stdlib_targets=($( get_stdlib_targets_for_host ${host} ) )
1275
-
1276
- for stdlib_deployment_target in " ${stdlib_targets[@]} " ; do
1277
- local swift_sdk=
1278
- local is_in_build_list=$( should_build_stdlib_target ${stdlib_deployment_target} ${host} )
1279
- local build_for_this_target=1
1280
- local test_this_target=1
1281
- local test_host_only=
1282
- local build_benchmark_this_target=
1283
- local build_external_benchmark_this_target=
1284
- local test_benchmark_this_target=
1285
-
1286
- case ${stdlib_deployment_target} in
1287
- linux-* )
1288
- swift_sdk=" LINUX"
1289
- build_for_this_target=$( not ${SKIP_BUILD_LINUX} )
1290
- test_this_target=$( not ${SKIP_TEST_LINUX} )
1291
- ;;
1292
- freebsd-* )
1293
- swift_sdk=" FREEBSD"
1294
- build_for_this_target=$( not ${SKIP_BUILD_FREEBSD} )
1295
- test_this_target=$( not ${SKIP_TEST_FREEBSD} )
1296
- ;;
1297
- cygwin-* )
1298
- swift_sdk=" CYGWIN"
1299
- build_for_this_target=$( not ${SKIP_BUILD_CYGWIN} )
1300
- test_this_target=$( not ${SKIP_TEST_CYGWIN} )
1301
- ;;
1302
- haiku-* )
1303
- swift_sdk=" HAIKU"
1304
- build_for_this_target=$( not ${SKIP_BUILD_HAIKU} )
1305
- test_this_target=$( not ${SKIP_TEST_HAIKU} )
1306
- ;;
1307
- macosx-* )
1308
- swift_sdk=" OSX"
1309
- build_for_this_target=$( not ${SKIP_BUILD_OSX} )
1310
- test_this_target=$( not ${SKIP_TEST_OSX} )
1311
- build_benchmark_this_target=$( not ${SKIP_BUILD_OSX} )
1312
- build_external_benchmark_this_target=$( not ${SKIP_BUILD_OSX} )
1313
- test_benchmark_this_target=$( not ${SKIP_BUILD_OSX} )
1314
- ;;
1315
- iphoneos-* )
1316
- swift_sdk=" IOS"
1317
- build_for_this_target=$( not ${SKIP_BUILD_IOS_DEVICE} )
1318
- if [[ ! " ${SKIP_TEST_IOS_HOST} " ]] ; then
1319
- test_host_only=1
1320
- else
1321
- test_this_target=
1322
- fi
1323
- build_benchmark_this_target=$( not ${SKIP_BUILD_IOS_DEVICE} )
1324
- build_external_benchmark_this_target=$( not ${SKIP_BUILD_IOS_DEVICE} )
1325
-
1326
- # Never build iOS armv7s benchmarks.
1327
- if [[ " ${stdlib_deployment_target} " == " iphoneos-armv7s" ]]; then
1328
- build_benchmark_this_target=
1329
- build_external_benchmark_this_target=
1330
- fi
1331
- ;;
1332
- iphonesimulator-x86_64)
1333
- swift_sdk=" IOS_SIMULATOR"
1334
- build_for_this_target=$( not ${SKIP_BUILD_IOS_SIMULATOR} )
1335
- test_this_target=$( not ${SKIP_TEST_IOS_SIMULATOR} )
1336
- ;;
1337
- iphonesimulator-i386)
1338
- swift_sdk=" IOS_SIMULATOR"
1339
- build_for_this_target=$( not ${SKIP_BUILD_IOS_SIMULATOR} )
1340
- if [[ " ${SKIP_TEST_IOS_SIMULATOR} " == " 1" ]] ; then
1341
- SKIP_TEST_IOS_32BIT_SIMULATOR=" ${SKIP_TEST_IOS_SIMULATOR} "
1342
- fi
1343
- test_this_target=$( not ${SKIP_TEST_IOS_32BIT_SIMULATOR} )
1344
- ;;
1345
- appletvos-* )
1346
- swift_sdk=" TVOS"
1347
- build_for_this_target=$( not ${SKIP_BUILD_TVOS_DEVICE} )
1348
- if [[ ! " ${SKIP_TEST_TVOS_HOST} " ]] ; then
1349
- test_host_only=1
1350
- else
1351
- test_this_target=
1352
- fi
1353
- build_benchmark_this_target=$( not ${SKIP_BUILD_TVOS_DEVICE} )
1354
- build_external_benchmark_this_target=$( not ${SKIP_BUILD_TVOS_DEVICE} )
1355
- ;;
1356
- appletvsimulator-* )
1357
- swift_sdk=" TVOS_SIMULATOR"
1358
- build_for_this_target=$( not ${SKIP_BUILD_TVOS_SIMULATOR} )
1359
- test_this_target=$( not ${SKIP_TEST_TVOS_SIMULATOR} )
1360
- ;;
1361
- watchos-* )
1362
- swift_sdk=" WATCHOS"
1363
- build_for_this_target=$( not ${SKIP_BUILD_WATCHOS_DEVICE} )
1364
- if [[ ! " ${SKIP_TEST_WATCHOS_HOST} " ]] ; then
1365
- test_host_only=1
1366
- else
1367
- test_this_target=
1368
- fi
1369
- build_benchmark_this_target=$( not ${SKIP_BUILD_WATCHOS_DEVICE} )
1370
- build_external_benchmark_this_target=$( not ${SKIP_BUILD_WATCHOS_DEVICE} )
1371
- ;;
1372
- watchsimulator-* )
1373
- swift_sdk=" WATCHOS_SIMULATOR"
1374
- build_for_this_target=$( not ${SKIP_BUILD_WATCHOS_SIMULATOR} )
1375
- test_this_target=$( not ${SKIP_TEST_WATCHOS_SIMULATOR} )
1376
- ;;
1377
- android-* )
1378
- swift_sdk=" ANDROID"
1379
- build_for_this_target=$( not ${SKIP_BUILD_ANDROID} )
1380
- if [[ ! " ${SKIP_TEST_ANDROID_HOST} " ]] ; then
1381
- test_host_only=1
1382
- else
1383
- test_this_target=$( not ${SKIP_TEST_ANDROID} )
1384
- fi
1385
- ;;
1386
- * )
1387
- echo " Unknown compiler deployment target: ${stdlib_deployment_target} "
1388
- exit 1
1389
- ;;
1390
- esac
1391
-
1392
- SWIFT_SDKS+=(" ${swift_sdk} " )
1393
-
1394
- if [[ " ${build_for_this_target} " ]] && [[ " ${is_in_build_list} " ]]; then
1395
-
1396
- if [[ " ${BUILD_SWIFT_STDLIB_UNITTEST_EXTRA} " == " 1" ]] ; then
1397
- SWIFT_STDLIB_TARGETS+=(" swift-stdlib-${stdlib_deployment_target} " )
1398
- else
1399
- if [[ " ${VALIDATION_TEST} " == " 1" || " ${LONG_TEST} " == " 1" ]] ; then
1400
- SWIFT_STDLIB_TARGETS+=(" swift-stdlib-${stdlib_deployment_target} " )
1401
- else
1402
- SWIFT_STDLIB_TARGETS+=(" swift-test-stdlib-${stdlib_deployment_target} " )
1403
- fi
1404
- fi
1405
- fi
1406
- if [[ " ${build_benchmark_this_target} " ]] && [[ " ${is_in_build_list} " ]]; then
1407
- SWIFT_BENCHMARK_TARGETS+=(" swift-benchmark-${stdlib_deployment_target} " )
1408
- if [[ $( not ${SKIP_TEST_BENCHMARKS} ) ]] ; then
1409
- SWIFT_RUN_BENCHMARK_TARGETS+=(" check-swift-benchmark-${stdlib_deployment_target} " )
1410
- fi
1411
- fi
1412
-
1413
- if [[ " $( true_false ${SKIP_BUILD_EXTERNAL_BENCHMARKS} ) " == " FALSE" ]] &&
1414
- [[ " ${build_external_benchmark_this_target} " ]] &&
1415
- [[ " ${is_in_build_list} " ]] ; then
1416
- SWIFT_BENCHMARK_TARGETS+=(" swift-benchmark-${stdlib_deployment_target} -external" )
1417
- if [[ $( not ${SKIP_TEST_BENCHMARKS} ) ]] ; then
1418
- SWIFT_RUN_BENCHMARK_TARGETS+=(" check-swift-benchmark-${stdlib_deployment_target} -external" )
1419
- fi
1420
- fi
1421
-
1422
- if [[ " ${test_this_target} " ]] && [[ " ${is_in_build_list} " ]]; then
1423
- test_target_suffix=" "
1424
- if [[ -n " ${test_host_only} " ]] ; then
1425
- test_target_suffix=" -only_non_executable"
1426
- elif [[ -n " ${ONLY_EXECUTABLE_TEST} " ]] ; then
1427
- test_target_suffix=" -only_executable"
1428
- fi
1429
-
1430
- test_subset_target_suffix=" "
1431
- if [[ " ${VALIDATION_TEST} " == " 1" ]] ; then
1432
- if [[ " ${LONG_TEST} " == " 1" ]] ; then
1433
- test_subset_target_suffix=" -all"
1434
- else
1435
- test_subset_target_suffix=" -validation"
1436
- fi
1437
- else
1438
- if [[ " ${LONG_TEST} " == " 1" ]] ; then
1439
- test_subset_target_suffix=" -only_long"
1440
- fi
1441
- fi
1442
-
1443
- SWIFT_TEST_TARGETS+=(" check-swift${test_subset_target_suffix}${test_target_suffix} -${stdlib_deployment_target} " )
1444
- if [[ $( not ${SKIP_TEST_OPTIMIZED} ) && ! -n " ${test_host_only} " ]] ; then
1445
- SWIFT_TEST_TARGETS+=(" check-swift${test_subset_target_suffix} -optimize-${stdlib_deployment_target} " )
1446
- fi
1447
- if [[ $( not ${SKIP_TEST_OPTIMIZE_FOR_SIZE} ) && ! -n " ${test_host_only} " ]] ; then
1448
- SWIFT_TEST_TARGETS+=(" check-swift${test_subset_target_suffix} -optimize_size-${stdlib_deployment_target} " )
1449
- fi
1450
- if [[ $( not ${SKIP_TEST_OPTIMIZE_NONE_WITH_IMPLICIT_DYNAMIC} ) && ! -n " ${test_host_only} " ]] ; then
1451
- SWIFT_TEST_TARGETS+=(" check-swift${test_subset_target_suffix} -optimize_none_with_implicit_dynamic-${stdlib_deployment_target} " )
1452
- fi
1453
- fi
1454
- done
1455
-
1456
- # Filter duplicate SWIFT_SDKs
1457
- # We will get them if building for multiple architecture variants
1458
- SWIFT_SDKS=($( echo " ${SWIFT_SDKS[@]} " | tr " " " \n" | sort -u | tr " \n" " " ) )
1459
-
1460
1265
# Get the values passed by `build-script`.
1461
- LEGACY_SWIFT_STDLIB_TARGETS=(${SWIFT_STDLIB_TARGETS[@]} )
1462
- LEGACY_SWIFT_SDKS=(${SWIFT_SDKS[@]} )
1463
- LEGACY_SWIFT_BENCHMARK_TARGETS=(${SWIFT_BENCHMARK_TARGETS[@]} )
1464
- LEGACY_SWIFT_RUN_BENCHMARK_TARGETS=(${SWIFT_RUN_BENCHMARK_TARGETS[@]} )
1465
- LEGACY_SWIFT_TEST_TARGETS=(${SWIFT_TEST_TARGETS[@]} )
1466
1266
SWIFT_STDLIB_TARGETS=($( get_host_specific_variable ${host} SWIFT_STDLIB_TARGETS) )
1467
1267
SWIFT_SDKS=($( get_host_specific_variable ${host} SWIFT_SDKS) )
1468
1268
SWIFT_BENCHMARK_TARGETS=($( get_host_specific_variable ${host} SWIFT_BENCHMARK_TARGETS) )
1469
1269
SWIFT_RUN_BENCHMARK_TARGETS=($( get_host_specific_variable ${host} SWIFT_RUN_BENCHMARK_TARGETS) )
1470
1270
SWIFT_TEST_TARGETS=($( get_host_specific_variable ${host} SWIFT_TEST_TARGETS) )
1471
-
1472
- # Validate the parameters match.
1473
- if [[ " ${SWIFT_STDLIB_TARGETS[*]} " != " ${LEGACY_SWIFT_STDLIB_TARGETS[*]} " ]]; then
1474
- printf " error: invalid build-script refactor for 'SWIFT_STDLIB_TARGETS': '%s' vs '%s'\n" " ${SWIFT_STDLIB_TARGETS[*]} " " ${LEGACY_SWIFT_STDLIB_TARGETS[*]} "
1475
- exit 1
1476
- fi
1477
- if [[ " ${SWIFT_SDKS[*]} " != " ${LEGACY_SWIFT_SDKS[*]} " ]]; then
1478
- printf " error: invalid build-script for 'SWIFT_SDKS' refactor: '%s' vs '%s'\n" " ${SWIFT_SDKS[*]} " " ${LEGACY_SWIFT_SDKS[*]} "
1479
- exit 1
1480
- fi
1481
- if [[ " ${SWIFT_BENCHMARK_TARGETS[*]} " != " ${LEGACY_SWIFT_BENCHMARK_TARGETS[*]} " ]]; then
1482
- printf " error: invalid build-script refactor for 'SWIFT_BENCHMARK_TARGETS': '%s' vs '%s'\n" " ${SWIFT_BENCHMARK_TARGETS[*]} " " ${LEGACY_SWIFT_BENCHMARK_TARGETS[*]} "
1483
- exit 1
1484
- fi
1485
- if [[ " ${SWIFT_RUN_BENCHMARK_TARGETS[*]} " != " ${LEGACY_SWIFT_RUN_BENCHMARK_TARGETS[*]} " ]]; then
1486
- printf " error: invalid build-script refactor for 'SWIFT_RUN_BENCHMARK_TARGETS': '%s' vs '%s'\n" " ${SWIFT_RUN_BENCHMARK_TARGETS[*]} " " ${LEGACY_SWIFT_RUN_BENCHMARK_TARGETS[*]} "
1487
- exit 1
1488
- fi
1489
- if [[ " ${SWIFT_TEST_TARGETS[*]} " != " ${LEGACY_SWIFT_TEST_TARGETS[*]} " ]]; then
1490
- printf " error: invalid build-script refactor for 'SWIFT_TEST_TARGETS': '%s' vs '%s'\n" " ${SWIFT_TEST_TARGETS[*]} " " ${LEGACY_SWIFT_TEST_TARGETS[*]} "
1491
- exit 1
1492
- fi
1493
1271
}
1494
1272
1495
1273
0 commit comments