@@ -215,6 +215,7 @@ $ArchX64 = @{
215
215
PlatformInstallRoot = " $BinaryCache \x64\Windows.platform" ;
216
216
SDKInstallRoot = " $BinaryCache \x64\Windows.platform\Developer\SDKs\Windows.sdk" ;
217
217
XCTestInstallRoot = " $BinaryCache \x64\Windows.platform\Developer\Library\XCTest-development" ;
218
+ SwiftTestingInstallRoot = " $BinaryCache \x64\Windows.platform\Developer\Library\Testing-development" ;
218
219
ToolchainInstallRoot = " $BinaryCache \x64\toolchains\$ProductVersion +Asserts" ;
219
220
}
220
221
@@ -230,6 +231,7 @@ $ArchX86 = @{
230
231
PlatformInstallRoot = " $BinaryCache \x86\Windows.platform" ;
231
232
SDKInstallRoot = " $BinaryCache \x86\Windows.platform\Developer\SDKs\Windows.sdk" ;
232
233
XCTestInstallRoot = " $BinaryCache \x86\Windows.platform\Developer\Library\XCTest-development" ;
234
+ SwiftTestingInstallRoot = " $BinaryCache \x86\Windows.platform\Developer\Library\Testing-development" ;
233
235
}
234
236
235
237
$ArchARM64 = @ {
@@ -245,6 +247,7 @@ $ArchARM64 = @{
245
247
SDKInstallRoot = " $BinaryCache \arm64\Windows.platform\Developer\SDKs\Windows.sdk" ;
246
248
XCTestInstallRoot = " $BinaryCache \arm64\Windows.platform\Developer\Library\XCTest-development" ;
247
249
ToolchainInstallRoot = " $BinaryCache \arm64\toolchains\$ProductVersion +Asserts" ;
250
+ SwiftTestingInstallRoot = " $BinaryCache \arm64\Windows.platform\Developer\Library\Testing-development" ;
248
251
}
249
252
250
253
$AndroidARM64 = @ {
@@ -258,6 +261,7 @@ $AndroidARM64 = @{
258
261
PlatformInstallRoot = " $BinaryCache \arm64\Android.platform" ;
259
262
SDKInstallRoot = " $BinaryCache \arm64\Android.platform\Developer\SDKs\Android.sdk" ;
260
263
XCTestInstallRoot = " $BinaryCache \arm64\Android.platform\Developer\Library\XCTest-development" ;
264
+ SwiftTestingInstallRoot = " $BinaryCache \arm64\Android.platform\Developer\Library\Testing-development" ;
261
265
}
262
266
263
267
$AndroidARMv7 = @ {
@@ -271,6 +275,7 @@ $AndroidARMv7 = @{
271
275
PlatformInstallRoot = " $BinaryCache \armv7\Android.platform" ;
272
276
SDKInstallRoot = " $BinaryCache \armv7\Android.platform\Developer\SDKs\Android.sdk" ;
273
277
XCTestInstallRoot = " $BinaryCache \armv7\Android.platform\Developer\Library\XCTest-development" ;
278
+ SwiftTestingInstallRoot = " $BinaryCache \armv7\Android.platform\Developer\Library\Testing-development" ;
274
279
}
275
280
276
281
$AndroidX86 = @ {
@@ -284,6 +289,7 @@ $AndroidX86 = @{
284
289
PlatformInstallRoot = " $BinaryCache \x86\Android.platform" ;
285
290
SDKInstallRoot = " $BinaryCache \x86\Android.platform\Developer\SDKs\Android.sdk" ;
286
291
XCTestInstallRoot = " $BinaryCache \x86\Android.platform\Developer\Library\XCTest-development" ;
292
+ SwiftTestingInstallRoot = " $BinaryCache \x86\Android.platform\Developer\Library\Testing-development" ;
287
293
}
288
294
289
295
$AndroidX64 = @ {
@@ -297,6 +303,7 @@ $AndroidX64 = @{
297
303
PlatformInstallRoot = " $BinaryCache \x64\Android.platform" ;
298
304
SDKInstallRoot = " $BinaryCache \x64\Android.platform\Developer\SDKs\Android.sdk" ;
299
305
XCTestInstallRoot = " $BinaryCache \x64\Android.platform\Developer\Library\XCTest-development" ;
306
+ SwiftTestingInstallRoot = " $BinaryCache \x64\Android.platform\Developer\Library\Testing-development" ;
300
307
}
301
308
302
309
$HostArch = switch ($HostArchName ) {
@@ -387,6 +394,7 @@ enum TargetComponent {
387
394
Dispatch
388
395
Foundation
389
396
XCTest
397
+ SwiftTesting
390
398
}
391
399
392
400
function Get-TargetProjectBinaryCache ($Arch , [TargetComponent ]$Project ) {
@@ -413,6 +421,7 @@ enum HostComponent {
413
421
LMDB
414
422
SymbolKit
415
423
DocC
424
+ SwiftTestingMacros
416
425
}
417
426
418
427
function Get-HostProjectBinaryCache ([HostComponent ]$Project ) {
@@ -1749,11 +1758,43 @@ function Build-XCTest([Platform]$Platform, $Arch, [switch]$Test = $false) {
1749
1758
dispatch_DIR = " $DispatchBinaryCache \cmake\modules" ;
1750
1759
Foundation_DIR = " $FoundationBinaryCache \cmake\modules" ;
1751
1760
} + $TestingDefines )
1761
+ }
1762
+ }
1763
+
1764
+ function Build-SwiftTesting ([Platform ]$Platform , $Arch , [switch ]$Test = $false ) {
1765
+ $SwiftTestingBinaryCache = Get-TargetProjectBinaryCache $Arch SwiftTesting
1766
+
1767
+ Isolate- EnvVars {
1768
+ if ($Test ) {
1769
+ # TODO: Test
1770
+ return
1771
+ } else {
1772
+ $Targets = @ (" default" )
1773
+ $InstallPath = " $ ( $Arch.SwiftTestingInstallRoot ) \usr"
1774
+ }
1775
+
1776
+ Build-CMakeProject `
1777
+ - Src $SourceCache \swift- testing `
1778
+ - Bin $SwiftTestingBinaryCache `
1779
+ - InstallTo $InstallPath `
1780
+ - Arch $Arch `
1781
+ - Platform $Platform `
1782
+ - UseBuiltCompilers C, CXX, Swift `
1783
+ - BuildTargets $Targets `
1784
+ - Defines (@ {
1785
+ BUILD_SHARED_LIBS = " YES" ;
1786
+ CMAKE_BUILD_WITH_INSTALL_RPATH = " YES" ;
1787
+ SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
1788
+ # FIXME: Build the plugin for the builder and specify the path.
1789
+ SwiftTesting_MACRO = " NO" ;
1790
+ })
1791
+ }
1792
+ }
1752
1793
1794
+ function Write-PlatformInfoPlist ($Arch ) {
1753
1795
$PList = Join-Path - Path $Arch.PlatformInstallRoot - ChildPath " Info.plist"
1754
- Invoke-Program $python - c " import plistlib; print(str(plistlib.dumps({ 'DefaultProperties': { 'XCTEST_VERSION': 'development', 'SWIFTC_FLAGS': ['-use-ld=lld'] } }), encoding='utf-8'))" `
1796
+ Invoke-Program $python - c " import plistlib; print(str(plistlib.dumps({ 'DefaultProperties': { 'XCTEST_VERSION': 'development', 'SWIFT_TESTING_VERSION': 'development', ' SWIFTC_FLAGS': ['-use-ld=lld'] } }), encoding='utf-8'))" `
1755
1797
- OutFile " $PList "
1756
- }
1757
1798
}
1758
1799
1759
1800
# Copies files installed by CMake from the arch-specific platform root,
@@ -2185,6 +2226,21 @@ function Build-SourceKitLSP($Arch) {
2185
2226
}
2186
2227
}
2187
2228
2229
+ function Build-SwiftTestingMacros ($Arch ) {
2230
+ Build-CMakeProject `
2231
+ - Src $SourceCache \swift- testing\Sources\TestingMacros `
2232
+ - Bin (Get-HostProjectBinaryCache SwiftTestingMacros) `
2233
+ - InstallTo " $ ( $Arch.ToolchainInstallRoot ) \usr" `
2234
+ - Arch $Arch `
2235
+ - Platform Windows `
2236
+ - UseBuiltCompilers Swift `
2237
+ - SwiftSDK (Get-HostSwiftSDK ) `
2238
+ - BuildTargets default `
2239
+ - Defines @ {
2240
+ SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
2241
+ }
2242
+ }
2243
+
2188
2244
function Install-HostToolchain () {
2189
2245
if ($ToBatch ) { return }
2190
2246
@@ -2343,20 +2399,24 @@ if (-not $SkipBuild) {
2343
2399
Invoke-BuildStep Build-Dispatch Windows $Arch
2344
2400
Invoke-BuildStep Build-Foundation Windows $Arch
2345
2401
Invoke-BuildStep Build-XCTest Windows $Arch
2402
+ Invoke-BuildStep Build-SwiftTesting Windows $Arch
2403
+ Invoke-BuildStep Write-PlatformInfoPlist $Arch
2346
2404
}
2347
2405
2348
- foreach ($Arch in $AndroidSDKArchs ) {
2349
- Invoke-BuildStep Build-ZLib Android $Arch
2350
- Invoke-BuildStep Build-XML2 Android $Arch
2351
- Invoke-BuildStep Build-CURL Android $Arch
2352
- Invoke-BuildStep Build-LLVM Android $Arch
2406
+ foreach ($Arch in $AndroidSDKArchs ) {
2407
+ Invoke-BuildStep Build-ZLib Android $Arch
2408
+ Invoke-BuildStep Build-XML2 Android $Arch
2409
+ Invoke-BuildStep Build-CURL Android $Arch
2410
+ Invoke-BuildStep Build-LLVM Android $Arch
2353
2411
2354
- # Build platform: SDK, Redist and XCTest
2355
- Invoke-BuildStep Build-Runtime Android $Arch
2356
- Invoke-BuildStep Build-Dispatch Android $Arch
2357
- Invoke-BuildStep Build-Foundation Android $Arch
2358
- Invoke-BuildStep Build-XCTest Android $Arch
2359
- }
2412
+ # Build platform: SDK, Redist and XCTest
2413
+ Invoke-BuildStep Build-Runtime Android $Arch
2414
+ Invoke-BuildStep Build-Dispatch Android $Arch
2415
+ Invoke-BuildStep Build-Foundation Android $Arch
2416
+ Invoke-BuildStep Build-XCTest Android $Arch
2417
+ Invoke-BuildStep Build-SwiftTesting Android $Arch
2418
+ Invoke-BuildStep Write-PlatformInfoPlist $Arch
2419
+ }
2360
2420
}
2361
2421
2362
2422
if (-not $ToBatch ) {
@@ -2378,6 +2438,8 @@ if (-not $ToBatch) {
2378
2438
}
2379
2439
2380
2440
if (-not $SkipBuild ) {
2441
+ # TestingMacros can't be built before the standard library for the host as it is required for the Swift code.
2442
+ Invoke-BuildStep Build-SwiftTestingMacros $HostArch
2381
2443
Invoke-BuildStep Build-SQLite $HostArch
2382
2444
Invoke-BuildStep Build-System $HostArch
2383
2445
Invoke-BuildStep Build-ToolsSupportCore $HostArch
@@ -2432,6 +2494,9 @@ if (-not $IsCrossCompiling) {
2432
2494
if ($Test -contains " xctest" ) {
2433
2495
Build-XCTest Windows $HostArch - Test
2434
2496
}
2497
+ if ($Test -contains " testing" ) {
2498
+ Build-SwiftTesting Windows $HostArch - Test
2499
+ }
2435
2500
if ($Test -contains " llbuild" ) { Build-LLBuild $HostArch - Test }
2436
2501
if ($Test -contains " swiftpm" ) { Test-PackageManager $HostArch }
2437
2502
}
0 commit comments