Skip to content

Commit 0a0fe14

Browse files
committed
Replaced -skip-osx/ios/tvos/watchos/linux/android/freebsd/cygwin flags
(and appropriate test flags) with an explicit build and test list. Made configuration message more visible and obvious
1 parent 0b6790c commit 0a0fe14

File tree

2 files changed

+192
-202
lines changed

2 files changed

+192
-202
lines changed

utils/build-script

Lines changed: 112 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,98 +1136,49 @@ details of the setups of other systems or automated environments.""")
11361136
platform.system() != "Darwin"):
11371137
args.build_foundation = True
11381138

1139-
# Propagate global --skip-build
1140-
if args.skip_build:
1141-
args.skip_build_linux = True
1142-
args.skip_build_freebsd = True
1143-
args.skip_build_cygwin = True
1144-
args.skip_build_osx = True
1145-
args.skip_build_ios = True
1146-
args.skip_build_tvos = True
1147-
args.skip_build_watchos = True
1148-
args.skip_build_android = True
1149-
args.skip_build_benchmarks = True
1150-
args.build_lldb = False
1151-
args.build_llbuild = False
1152-
args.build_swiftpm = False
1153-
args.build_xctest = False
1154-
args.build_foundation = False
1155-
args.build_libdispatch = False
1139+
# --validation-test implies --test.
1140+
if args.validation_test:
1141+
args.test = True
11561142

1157-
# --skip-{ios,tvos,watchos} or --skip-build-{ios,tvos,watchos} are
1158-
# merely shorthands for --skip-build-{**os}-{device,simulator}
1159-
if not args.ios or args.skip_build_ios:
1143+
# --long-test implies --test.
1144+
if args.long_test:
1145+
args.test = True
1146+
1147+
# --test-optimized implies --test.
1148+
if args.test_optimized:
1149+
args.test = True
1150+
1151+
# Expand iOS skip_build/test arguments for both device and simulator.
1152+
if args.skip_build_ios:
11601153
args.skip_build_ios_device = True
11611154
args.skip_build_ios_simulator = True
11621155

1163-
if not args.tvos or args.skip_build_tvos:
1156+
if args.skip_build_tvos:
11641157
args.skip_build_tvos_device = True
11651158
args.skip_build_tvos_simulator = True
11661159

1167-
if not args.watchos or args.skip_build_watchos:
1160+
if args.skip_build_watchos:
11681161
args.skip_build_watchos_device = True
11691162
args.skip_build_watchos_simulator = True
11701163

1171-
if not args.android or args.skip_build_android:
1172-
args.skip_build_android = True
1173-
1174-
# --validation-test implies --test.
1175-
if args.validation_test:
1176-
args.test = True
1177-
1178-
# --test-optimized implies --test.
1179-
if args.test_optimized:
1180-
args.test = True
1181-
1182-
# If none of tests specified skip swift stdlib test on all platforms
1183-
if not args.test and not args.validation_test and not args.long_test:
1184-
args.skip_test_linux = True
1185-
args.skip_test_freebsd = True
1186-
args.skip_test_cygwin = True
1187-
args.skip_test_osx = True
1188-
args.skip_test_ios = True
1189-
args.skip_test_tvos = True
1190-
args.skip_test_watchos = True
1191-
1192-
# --skip-test-ios is merely a shorthand for host and simulator tests.
11931164
if args.skip_test_ios:
11941165
args.skip_test_ios_host = True
11951166
args.skip_test_ios_simulator = True
1196-
# --skip-test-tvos is merely a shorthand for host and simulator tests.
1197-
if args.skip_test_tvos:
1198-
args.skip_test_tvos_host = True
1199-
args.skip_test_tvos_simulator = True
1200-
# --skip-test-watchos is merely a shorthand for host and simulator tests.
1201-
if args.skip_test_watchos:
1202-
args.skip_test_watchos_host = True
1203-
args.skip_test_watchos_simulator = True
12041167

1205-
# --skip-build-{ios,tvos,watchos}-{device,simulator} implies
1206-
# --skip-test-{ios,tvos,watchos}-{host,simulator}
1207-
if args.skip_build_ios_device:
1208-
args.skip_test_ios_host = True
1209-
if args.skip_build_ios_simulator:
1210-
args.skip_test_ios_simulator = True
1211-
1212-
if args.skip_build_tvos_device:
1168+
if args.skip_test_tvos:
12131169
args.skip_test_tvos_host = True
1214-
if args.skip_build_tvos_simulator:
12151170
args.skip_test_tvos_simulator = True
12161171

1217-
if args.skip_build_watchos_device:
1172+
if args.skip_test_watchos:
12181173
args.skip_test_watchos_host = True
1219-
if args.skip_build_watchos_simulator:
12201174
args.skip_test_watchos_simulator = True
12211175

1222-
if not args.host_test:
1223-
args.skip_test_ios_host = True
1224-
args.skip_test_tvos_host = True
1225-
args.skip_test_watchos_host = True
1226-
12271176
if args.build_subdir is None:
12281177
args.build_subdir = compute_build_subdir(args)
12291178

1230-
# Add optional stdlib-deployment-targets
1179+
# Configure additional selected stdlib-deployment-targets
1180+
# (we do not need to configure iOS targets, they are part of the default
1181+
# list).
12311182
if args.android:
12321183
args.stdlib_deployment_targets.append(
12331184
StdlibDeploymentTarget.Android.armv7)
@@ -1338,10 +1289,61 @@ details of the setups of other systems or automated environments.""")
13381289
"--install-symroot", os.path.abspath(args.install_symroot)
13391290
]
13401291

1292+
# Create the build target list.
1293+
#
1294+
# Take all of the configured stdlib-deployment-targets
1295+
# and subtract any we've been told to skip.
1296+
1297+
skipped_targets = []
1298+
if args.skip_build_linux:
1299+
skipped_targets += StdlibDeploymentTarget.Linux.allArchs
1300+
if args.skip_build_freebsd:
1301+
skipped_targets += StdlibDeploymentTarget.FreeBSD.allArchs
1302+
if args.skip_build_cygwin:
1303+
skipped_targets += StdlibDeploymentTarget.Cygwin.allArchs
1304+
if args.skip_build_android:
1305+
skipped_targets += StdlibDeploymentTarget.Android.allArchs
1306+
if args.skip_build_osx:
1307+
skipped_targets += StdlibDeploymentTarget.OSX.allArchs
1308+
1309+
# iOS targets are special: they are configured by default, but only built
1310+
# if the appropriate '--ios'/'--tvos'/... flag is given.
1311+
if args.skip_build_ios_device or not args.ios:
1312+
skipped_targets += StdlibDeploymentTarget.iOS.allArchs
1313+
if args.skip_build_ios_simulator or not args.ios:
1314+
skipped_targets += StdlibDeploymentTarget.iOSSimulator.allArchs
1315+
if args.skip_build_tvos_device or not args.tvos:
1316+
skipped_targets += StdlibDeploymentTarget.AppleTV.allArchs
1317+
if args.skip_build_tvos_simulator or not args.tvos:
1318+
skipped_targets += StdlibDeploymentTarget.AppleTVSimulator.allArchs
1319+
if args.skip_build_watchos_device or not args.watchos:
1320+
skipped_targets += StdlibDeploymentTarget.AppleWatch.allArchs
1321+
if args.skip_build_watchos_simulator or not args.watchos:
1322+
skipped_targets += StdlibDeploymentTarget.AppleWatchSimulator.allArchs
1323+
1324+
build_stdlib_deployment_targets = [
1325+
x for x in args.stdlib_deployment_targets
1326+
if x not in skipped_targets]
1327+
1328+
if args.skip_build or len(build_stdlib_deployment_targets) == 0:
1329+
build_stdlib_deployment_targets = ['none']
1330+
1331+
build_script_impl_args += ["--build-stdlib-deployment-targets",
1332+
" ".join(build_stdlib_deployment_targets)]
1333+
1334+
# Decide which products to build.
13411335
if args.skip_build:
13421336
build_script_impl_args += ["--skip-build-cmark",
13431337
"--skip-build-llvm",
13441338
"--skip-build-swift"]
1339+
args.skip_build_benchmarks = True
1340+
args.build_lldb = False
1341+
args.build_llbuild = False
1342+
args.build_swiftpm = False
1343+
args.build_xctest = False
1344+
args.build_foundation = False
1345+
args.build_libdispatch = False
1346+
13451347
if args.skip_build_benchmarks:
13461348
build_script_impl_args += ["--skip-build-benchmarks"]
13471349
if not args.build_foundation:
@@ -1357,29 +1359,46 @@ details of the setups of other systems or automated environments.""")
13571359
if not args.build_swiftpm:
13581360
build_script_impl_args += ["--skip-build-swiftpm"]
13591361

1360-
if args.skip_build_linux:
1361-
build_script_impl_args += ["--skip-build-linux"]
1362-
if args.skip_build_freebsd:
1363-
build_script_impl_args += ["--skip-build-freebsd"]
1364-
if args.skip_build_cygwin:
1365-
build_script_impl_args += ["--skip-build-cygwin"]
1366-
if args.skip_build_osx:
1367-
build_script_impl_args += ["--skip-build-osx"]
1368-
if args.skip_build_ios_device:
1369-
build_script_impl_args += ["--skip-build-ios-device"]
1370-
if args.skip_build_ios_simulator:
1371-
build_script_impl_args += ["--skip-build-ios-simulator"]
1372-
if args.skip_build_tvos_device:
1373-
build_script_impl_args += ["--skip-build-tvos-device"]
1374-
if args.skip_build_tvos_simulator:
1375-
build_script_impl_args += ["--skip-build-tvos-simulator"]
1376-
if args.skip_build_watchos_device:
1377-
build_script_impl_args += ["--skip-build-watchos-device"]
1378-
if args.skip_build_watchos_simulator:
1379-
build_script_impl_args += ["--skip-build-watchos-simulator"]
1380-
if args.skip_build_android:
1381-
build_script_impl_args += ["--skip-build-android"]
1362+
# Create the test target list.
1363+
#
1364+
# Take all of the stdlib-deployment-targets that we're actually building,
1365+
# and subtract any we've been told to skip.
13821366

1367+
skip_test_tgts = []
1368+
if args.skip_test_linux:
1369+
skip_test_tgts += StdlibDeploymentTarget.Linux.allArchs
1370+
if args.skip_test_freebsd:
1371+
skip_test_tgts += StdlibDeploymentTarget.FreeBSD.allArchs
1372+
if args.skip_test_cygwin:
1373+
skip_test_tgts += StdlibDeploymentTarget.Cygwin.allArchs
1374+
if args.skip_test_osx:
1375+
skip_test_tgts += StdlibDeploymentTarget.OSX.allArchs
1376+
if args.skip_test_ios_simulator:
1377+
skip_test_tgts += StdlibDeploymentTarget.iOSSimulator.allArchs
1378+
if args.skip_test_tvos_simulator:
1379+
skip_test_tgts += StdlibDeploymentTarget.AppleTVSimulator.allArchs
1380+
if args.skip_test_watchos_simulator:
1381+
skip_test_tgts += StdlibDeploymentTarget.AppleWatchSimulator.allArchs
1382+
if args.skip_test_ios_host or not args.host_test:
1383+
skip_test_tgts += StdlibDeploymentTarget.iOS.allArchs
1384+
if args.skip_test_tvos_host or not args.host_test:
1385+
skip_test_tgts += StdlibDeploymentTarget.AppleTV.allArchs
1386+
if args.skip_test_watchos_host or not args.host_test:
1387+
skip_test_tgts += StdlibDeploymentTarget.AppleWatch.allArchs
1388+
1389+
# The tests do not work on Android yet.
1390+
skip_test_tgts += StdlibDeploymentTarget.Android.allArchs
1391+
1392+
if args.test:
1393+
test_deployment_targets = [
1394+
x for x in build_stdlib_deployment_targets
1395+
if x not in skip_test_tgts]
1396+
1397+
if len(test_deployment_targets) > 0:
1398+
build_script_impl_args += ["--test-stdlib-deployment-targets",
1399+
" ".join(test_deployment_targets)]
1400+
1401+
# Decide which products to test
13831402
if not args.test and not args.long_test:
13841403
build_script_impl_args += ["--skip-test-swift"]
13851404
if not args.test:
@@ -1390,26 +1409,7 @@ details of the setups of other systems or automated environments.""")
13901409
"--skip-test-xctest",
13911410
"--skip-test-foundation",
13921411
"--skip-test-libdispatch"]
1393-
if args.skip_test_linux:
1394-
build_script_impl_args += ["--skip-test-linux"]
1395-
if args.skip_test_freebsd:
1396-
build_script_impl_args += ["--skip-test-freebsd"]
1397-
if args.skip_test_cygwin:
1398-
build_script_impl_args += ["--skip-test-cygwin"]
1399-
if args.skip_test_osx:
1400-
build_script_impl_args += ["--skip-test-osx"]
1401-
if args.skip_test_ios_host:
1402-
build_script_impl_args += ["--skip-test-ios-host"]
1403-
if args.skip_test_ios_simulator:
1404-
build_script_impl_args += ["--skip-test-ios-simulator"]
1405-
if args.skip_test_tvos_host:
1406-
build_script_impl_args += ["--skip-test-tvos-host"]
1407-
if args.skip_test_tvos_simulator:
1408-
build_script_impl_args += ["--skip-test-tvos-simulator"]
1409-
if args.skip_test_watchos_host:
1410-
build_script_impl_args += ["--skip-test-watchos-host"]
1411-
if args.skip_test_watchos_simulator:
1412-
build_script_impl_args += ["--skip-test-watchos-simulator"]
1412+
14131413
if args.build_runtime_with_host_compiler:
14141414
build_script_impl_args += ["--build-runtime-with-host-compiler"]
14151415
if args.validation_test:
@@ -1421,6 +1421,7 @@ details of the setups of other systems or automated environments.""")
14211421
if not args.test_optimized:
14221422
build_script_impl_args += ["--skip-test-optimized"]
14231423

1424+
# Other arguments
14241425
if args.android:
14251426
build_script_impl_args += [
14261427
"--android-ndk", args.android_ndk,

0 commit comments

Comments
 (0)