@@ -1320,234 +1320,12 @@ function get_host_specific_variable() {
1320
1320
}
1321
1321
1322
1322
function calculate_targets_for_host() {
1323
- local host=$1
1324
-
1325
- SWIFT_STDLIB_TARGETS=()
1326
- SWIFT_SDKS=()
1327
- SWIFT_BENCHMARK_TARGETS=()
1328
- SWIFT_RUN_BENCHMARK_TARGETS=()
1329
- SWIFT_TEST_TARGETS=()
1330
-
1331
- # Get the list of Target platforms for the Host
1332
- local stdlib_targets=($( get_stdlib_targets_for_host ${host} ) )
1333
-
1334
- for stdlib_deployment_target in " ${stdlib_targets[@]} " ; do
1335
- local swift_sdk=
1336
- local is_in_build_list=$( should_build_stdlib_target ${stdlib_deployment_target} ${host} )
1337
- local build_for_this_target=1
1338
- local test_this_target=1
1339
- local test_host_only=
1340
- local build_benchmark_this_target=
1341
- local build_external_benchmark_this_target=
1342
- local test_benchmark_this_target=
1343
-
1344
- case ${stdlib_deployment_target} in
1345
- linux-* )
1346
- swift_sdk=" LINUX"
1347
- build_for_this_target=$( not ${SKIP_BUILD_LINUX} )
1348
- test_this_target=$( not ${SKIP_TEST_LINUX} )
1349
- ;;
1350
- freebsd-* )
1351
- swift_sdk=" FREEBSD"
1352
- build_for_this_target=$( not ${SKIP_BUILD_FREEBSD} )
1353
- test_this_target=$( not ${SKIP_TEST_FREEBSD} )
1354
- ;;
1355
- cygwin-* )
1356
- swift_sdk=" CYGWIN"
1357
- build_for_this_target=$( not ${SKIP_BUILD_CYGWIN} )
1358
- test_this_target=$( not ${SKIP_TEST_CYGWIN} )
1359
- ;;
1360
- haiku-* )
1361
- swift_sdk=" HAIKU"
1362
- build_for_this_target=$( not ${SKIP_BUILD_HAIKU} )
1363
- test_this_target=$( not ${SKIP_TEST_HAIKU} )
1364
- ;;
1365
- macosx-* )
1366
- swift_sdk=" OSX"
1367
- build_for_this_target=$( not ${SKIP_BUILD_OSX} )
1368
- test_this_target=$( not ${SKIP_TEST_OSX} )
1369
- build_benchmark_this_target=$( not ${SKIP_BUILD_OSX} )
1370
- build_external_benchmark_this_target=$( not ${SKIP_BUILD_OSX} )
1371
- test_benchmark_this_target=$( not ${SKIP_BUILD_OSX} )
1372
- ;;
1373
- iphoneos-* )
1374
- swift_sdk=" IOS"
1375
- build_for_this_target=$( not ${SKIP_BUILD_IOS_DEVICE} )
1376
- if [[ ! " ${SKIP_TEST_IOS_HOST} " ]] ; then
1377
- test_host_only=1
1378
- else
1379
- test_this_target=
1380
- fi
1381
- build_benchmark_this_target=$( not ${SKIP_BUILD_IOS_DEVICE} )
1382
- build_external_benchmark_this_target=$( not ${SKIP_BUILD_IOS_DEVICE} )
1383
-
1384
- # Never build iOS armv7s benchmarks.
1385
- if [[ " ${stdlib_deployment_target} " == " iphoneos-armv7s" ]]; then
1386
- build_benchmark_this_target=
1387
- build_external_benchmark_this_target=
1388
- fi
1389
- ;;
1390
- iphonesimulator-x86_64)
1391
- swift_sdk=" IOS_SIMULATOR"
1392
- build_for_this_target=$( not ${SKIP_BUILD_IOS_SIMULATOR} )
1393
- test_this_target=$( not ${SKIP_TEST_IOS_SIMULATOR} )
1394
- ;;
1395
- iphonesimulator-i386)
1396
- swift_sdk=" IOS_SIMULATOR"
1397
- build_for_this_target=$( not ${SKIP_BUILD_IOS_SIMULATOR} )
1398
- if [[ " ${SKIP_TEST_IOS_SIMULATOR} " == " 1" ]] ; then
1399
- SKIP_TEST_IOS_32BIT_SIMULATOR=" ${SKIP_TEST_IOS_SIMULATOR} "
1400
- fi
1401
- test_this_target=$( not ${SKIP_TEST_IOS_32BIT_SIMULATOR} )
1402
- ;;
1403
- appletvos-* )
1404
- swift_sdk=" TVOS"
1405
- build_for_this_target=$( not ${SKIP_BUILD_TVOS_DEVICE} )
1406
- if [[ ! " ${SKIP_TEST_TVOS_HOST} " ]] ; then
1407
- test_host_only=1
1408
- else
1409
- test_this_target=
1410
- fi
1411
- build_benchmark_this_target=$( not ${SKIP_BUILD_TVOS_DEVICE} )
1412
- build_external_benchmark_this_target=$( not ${SKIP_BUILD_TVOS_DEVICE} )
1413
- ;;
1414
- appletvsimulator-* )
1415
- swift_sdk=" TVOS_SIMULATOR"
1416
- build_for_this_target=$( not ${SKIP_BUILD_TVOS_SIMULATOR} )
1417
- test_this_target=$( not ${SKIP_TEST_TVOS_SIMULATOR} )
1418
- ;;
1419
- watchos-* )
1420
- swift_sdk=" WATCHOS"
1421
- build_for_this_target=$( not ${SKIP_BUILD_WATCHOS_DEVICE} )
1422
- if [[ ! " ${SKIP_TEST_WATCHOS_HOST} " ]] ; then
1423
- test_host_only=1
1424
- else
1425
- test_this_target=
1426
- fi
1427
- build_benchmark_this_target=$( not ${SKIP_BUILD_WATCHOS_DEVICE} )
1428
- build_external_benchmark_this_target=$( not ${SKIP_BUILD_WATCHOS_DEVICE} )
1429
- ;;
1430
- watchsimulator-* )
1431
- swift_sdk=" WATCHOS_SIMULATOR"
1432
- build_for_this_target=$( not ${SKIP_BUILD_WATCHOS_SIMULATOR} )
1433
- test_this_target=$( not ${SKIP_TEST_WATCHOS_SIMULATOR} )
1434
- ;;
1435
- android-* )
1436
- swift_sdk=" ANDROID"
1437
- build_for_this_target=$( not ${SKIP_BUILD_ANDROID} )
1438
- if [[ ! " ${SKIP_TEST_ANDROID_HOST} " ]] ; then
1439
- test_host_only=1
1440
- else
1441
- test_this_target=$( not ${SKIP_TEST_ANDROID} )
1442
- fi
1443
- ;;
1444
- * )
1445
- echo " Unknown compiler deployment target: ${stdlib_deployment_target} "
1446
- exit 1
1447
- ;;
1448
- esac
1449
-
1450
- SWIFT_SDKS+=(" ${swift_sdk} " )
1451
-
1452
- if [[ " ${build_for_this_target} " ]] && [[ " ${is_in_build_list} " ]]; then
1453
-
1454
- if [[ " ${BUILD_SWIFT_STDLIB_UNITTEST_EXTRA} " == " 1" ]] ; then
1455
- SWIFT_STDLIB_TARGETS+=(" swift-stdlib-${stdlib_deployment_target} " )
1456
- else
1457
- if [[ " ${VALIDATION_TEST} " == " 1" || " ${LONG_TEST} " == " 1" ]] ; then
1458
- SWIFT_STDLIB_TARGETS+=(" swift-stdlib-${stdlib_deployment_target} " )
1459
- else
1460
- SWIFT_STDLIB_TARGETS+=(" swift-test-stdlib-${stdlib_deployment_target} " )
1461
- fi
1462
- fi
1463
- fi
1464
- if [[ " ${build_benchmark_this_target} " ]] && [[ " ${is_in_build_list} " ]]; then
1465
- SWIFT_BENCHMARK_TARGETS+=(" swift-benchmark-${stdlib_deployment_target} " )
1466
- if [[ $( not ${SKIP_TEST_BENCHMARKS} ) ]] ; then
1467
- SWIFT_RUN_BENCHMARK_TARGETS+=(" check-swift-benchmark-${stdlib_deployment_target} " )
1468
- fi
1469
- fi
1470
-
1471
- if [[ " $( true_false ${SKIP_BUILD_EXTERNAL_BENCHMARKS} ) " == " FALSE" ]] &&
1472
- [[ " ${build_external_benchmark_this_target} " ]] &&
1473
- [[ " ${is_in_build_list} " ]] ; then
1474
- SWIFT_BENCHMARK_TARGETS+=(" swift-benchmark-${stdlib_deployment_target} -external" )
1475
- if [[ $( not ${SKIP_TEST_BENCHMARKS} ) ]] ; then
1476
- SWIFT_RUN_BENCHMARK_TARGETS+=(" check-swift-benchmark-${stdlib_deployment_target} -external" )
1477
- fi
1478
- fi
1479
-
1480
- if [[ " ${test_this_target} " ]] && [[ " ${is_in_build_list} " ]]; then
1481
- test_target_suffix=" "
1482
- if [[ -n " ${test_host_only} " ]] ; then
1483
- test_target_suffix=" -only_non_executable"
1484
- elif [[ -n " ${ONLY_EXECUTABLE_TEST} " ]] ; then
1485
- test_target_suffix=" -only_executable"
1486
- fi
1487
-
1488
- test_subset_target_suffix=" "
1489
- if [[ " ${VALIDATION_TEST} " == " 1" ]] ; then
1490
- if [[ " ${LONG_TEST} " == " 1" ]] ; then
1491
- test_subset_target_suffix=" -all"
1492
- else
1493
- test_subset_target_suffix=" -validation"
1494
- fi
1495
- else
1496
- if [[ " ${LONG_TEST} " == " 1" ]] ; then
1497
- test_subset_target_suffix=" -only_long"
1498
- fi
1499
- fi
1500
-
1501
- SWIFT_TEST_TARGETS+=(" check-swift${test_subset_target_suffix}${test_target_suffix} -${stdlib_deployment_target} " )
1502
- if [[ $( not ${SKIP_TEST_OPTIMIZED} ) && ! -n " ${test_host_only} " ]] ; then
1503
- SWIFT_TEST_TARGETS+=(" check-swift${test_subset_target_suffix} -optimize-${stdlib_deployment_target} " )
1504
- fi
1505
- if [[ $( not ${SKIP_TEST_OPTIMIZE_FOR_SIZE} ) && ! -n " ${test_host_only} " ]] ; then
1506
- SWIFT_TEST_TARGETS+=(" check-swift${test_subset_target_suffix} -optimize_size-${stdlib_deployment_target} " )
1507
- fi
1508
- if [[ $( not ${SKIP_TEST_OPTIMIZE_NONE_WITH_IMPLICIT_DYNAMIC} ) && ! -n " ${test_host_only} " ]] ; then
1509
- SWIFT_TEST_TARGETS+=(" check-swift${test_subset_target_suffix} -optimize_none_with_implicit_dynamic-${stdlib_deployment_target} " )
1510
- fi
1511
- fi
1512
- done
1513
-
1514
- # Filter duplicate SWIFT_SDKs
1515
- # We will get them if building for multiple architecture variants
1516
- SWIFT_SDKS=($( echo " ${SWIFT_SDKS[@]} " | tr " " " \n" | sort -u | tr " \n" " " ) )
1517
-
1518
1323
# Get the values passed by `build-script`.
1519
- LEGACY_SWIFT_STDLIB_TARGETS=(${SWIFT_STDLIB_TARGETS[@]} )
1520
- LEGACY_SWIFT_SDKS=(${SWIFT_SDKS[@]} )
1521
- LEGACY_SWIFT_BENCHMARK_TARGETS=(${SWIFT_BENCHMARK_TARGETS[@]} )
1522
- LEGACY_SWIFT_RUN_BENCHMARK_TARGETS=(${SWIFT_RUN_BENCHMARK_TARGETS[@]} )
1523
- LEGACY_SWIFT_TEST_TARGETS=(${SWIFT_TEST_TARGETS[@]} )
1524
1324
SWIFT_STDLIB_TARGETS=($( get_host_specific_variable ${host} SWIFT_STDLIB_TARGETS) )
1525
1325
SWIFT_SDKS=($( get_host_specific_variable ${host} SWIFT_SDKS) )
1526
1326
SWIFT_BENCHMARK_TARGETS=($( get_host_specific_variable ${host} SWIFT_BENCHMARK_TARGETS) )
1527
1327
SWIFT_RUN_BENCHMARK_TARGETS=($( get_host_specific_variable ${host} SWIFT_RUN_BENCHMARK_TARGETS) )
1528
1328
SWIFT_TEST_TARGETS=($( get_host_specific_variable ${host} SWIFT_TEST_TARGETS) )
1529
-
1530
- # Validate the parameters match.
1531
- if [[ " ${SWIFT_STDLIB_TARGETS[*]} " != " ${LEGACY_SWIFT_STDLIB_TARGETS[*]} " ]]; then
1532
- printf " error: invalid build-script refactor for 'SWIFT_STDLIB_TARGETS': '%s' vs '%s'\n" " ${SWIFT_STDLIB_TARGETS[*]} " " ${LEGACY_SWIFT_STDLIB_TARGETS[*]} "
1533
- exit 1
1534
- fi
1535
- if [[ " ${SWIFT_SDKS[*]} " != " ${LEGACY_SWIFT_SDKS[*]} " ]]; then
1536
- printf " error: invalid build-script for 'SWIFT_SDKS' refactor: '%s' vs '%s'\n" " ${SWIFT_SDKS[*]} " " ${LEGACY_SWIFT_SDKS[*]} "
1537
- exit 1
1538
- fi
1539
- if [[ " ${SWIFT_BENCHMARK_TARGETS[*]} " != " ${LEGACY_SWIFT_BENCHMARK_TARGETS[*]} " ]]; then
1540
- printf " error: invalid build-script refactor for 'SWIFT_BENCHMARK_TARGETS': '%s' vs '%s'\n" " ${SWIFT_BENCHMARK_TARGETS[*]} " " ${LEGACY_SWIFT_BENCHMARK_TARGETS[*]} "
1541
- exit 1
1542
- fi
1543
- if [[ " ${SWIFT_RUN_BENCHMARK_TARGETS[*]} " != " ${LEGACY_SWIFT_RUN_BENCHMARK_TARGETS[*]} " ]]; then
1544
- printf " error: invalid build-script refactor for 'SWIFT_RUN_BENCHMARK_TARGETS': '%s' vs '%s'\n" " ${SWIFT_RUN_BENCHMARK_TARGETS[*]} " " ${LEGACY_SWIFT_RUN_BENCHMARK_TARGETS[*]} "
1545
- exit 1
1546
- fi
1547
- if [[ " ${SWIFT_TEST_TARGETS[*]} " != " ${LEGACY_SWIFT_TEST_TARGETS[*]} " ]]; then
1548
- printf " error: invalid build-script refactor for 'SWIFT_TEST_TARGETS': '%s' vs '%s'\n" " ${SWIFT_TEST_TARGETS[*]} " " ${LEGACY_SWIFT_TEST_TARGETS[*]} "
1549
- exit 1
1550
- fi
1551
1329
}
1552
1330
1553
1331
0 commit comments