@@ -187,6 +187,7 @@ $ArchX64 = @{
187
187
PlatformInstallRoot = " $BinaryCache \x64\Windows.platform" ;
188
188
SDKInstallRoot = " $BinaryCache \x64\Windows.platform\Developer\SDKs\Windows.sdk" ;
189
189
XCTestInstallRoot = " $BinaryCache \x64\Windows.platform\Developer\Library\XCTest-development" ;
190
+ SwiftTestingInstallRoot = " $BinaryCache \x64\Windows.platform\Developer\Library\Testing-development" ;
190
191
ToolchainInstallRoot = " $BinaryCache \x64\toolchains\$ProductVersion +Asserts" ;
191
192
}
192
193
@@ -202,6 +203,7 @@ $ArchX86 = @{
202
203
PlatformInstallRoot = " $BinaryCache \x86\Windows.platform" ;
203
204
SDKInstallRoot = " $BinaryCache \x86\Windows.platform\Developer\SDKs\Windows.sdk" ;
204
205
XCTestInstallRoot = " $BinaryCache \x86\Windows.platform\Developer\Library\XCTest-development" ;
206
+ SwiftTestingInstallRoot = " $BinaryCache \x86\Windows.platform\Developer\Library\Testing-development" ;
205
207
}
206
208
207
209
$ArchARM64 = @ {
@@ -217,6 +219,7 @@ $ArchARM64 = @{
217
219
SDKInstallRoot = " $BinaryCache \arm64\Windows.platform\Developer\SDKs\Windows.sdk" ;
218
220
XCTestInstallRoot = " $BinaryCache \arm64\Windows.platform\Developer\Library\XCTest-development" ;
219
221
ToolchainInstallRoot = " $BinaryCache \arm64\toolchains\$ProductVersion +Asserts" ;
222
+ SwiftTestingInstallRoot = " $BinaryCache \arm64\Windows.platform\Developer\Library\Testing-development" ;
220
223
}
221
224
222
225
$HostArch = switch ($HostArchName ) {
@@ -284,6 +287,7 @@ enum TargetComponent {
284
287
Dispatch
285
288
Foundation
286
289
XCTest
290
+ SwiftTesting
287
291
}
288
292
289
293
function Get-TargetProjectBinaryCache ($Arch , [TargetComponent ]$Project ) {
@@ -310,6 +314,7 @@ enum HostComponent {
310
314
LMDB
311
315
SymbolKit
312
316
DocC
317
+ SwiftTestingMacros
313
318
}
314
319
315
320
function Get-HostProjectBinaryCache ([HostComponent ]$Project ) {
@@ -1492,11 +1497,43 @@ function Build-XCTest([Platform]$Platform, $Arch, [switch]$Test = $false) {
1492
1497
dispatch_DIR = " $DispatchBinaryCache \cmake\modules" ;
1493
1498
Foundation_DIR = " $FoundationBinaryCache \cmake\modules" ;
1494
1499
} + $TestingDefines )
1500
+ }
1501
+ }
1502
+
1503
+ function Build-SwiftTesting ([Platform ]$Platform , $Arch , [switch ]$Test = $false ) {
1504
+ $SwiftTestingBinaryCache = Get-TargetProjectBinaryCache $Arch SwiftTesting
1505
+
1506
+ Isolate- EnvVars {
1507
+ if ($Test ) {
1508
+ # TODO: Test
1509
+ return
1510
+ } else {
1511
+ $Targets = @ (" default" )
1512
+ $InstallPath = " $ ( $Arch.SwiftTestingInstallRoot ) \usr"
1513
+ }
1514
+
1515
+ Build-CMakeProject `
1516
+ - Src $SourceCache \swift- testing `
1517
+ - Bin $SwiftTestingBinaryCache `
1518
+ - InstallTo $InstallPath `
1519
+ - Arch $Arch `
1520
+ - Platform $Platform `
1521
+ - UseBuiltCompilers C, CXX, Swift `
1522
+ - BuildTargets $Targets `
1523
+ - Defines (@ {
1524
+ BUILD_SHARED_LIBS = " YES" ;
1525
+ CMAKE_BUILD_WITH_INSTALL_RPATH = " YES" ;
1526
+ SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
1527
+ # FIXME: Build the plugin for the builder and specify the path.
1528
+ SwiftTesting_MACRO = " NO" ;
1529
+ })
1530
+ }
1531
+ }
1495
1532
1533
+ function Write-PlatformInfoPlist ([Platform ]$Platform , $Arch ) {
1496
1534
$PList = [IO.Path ]::Combine($Arch.BinaryCache , " ${Platform} .platform" .ToLower(), " Info.plist" )
1497
- Invoke-Program $python - c " import plistlib; print(str(plistlib.dumps({ 'DefaultProperties': { 'XCTEST_VERSION': 'development', 'SWIFTC_FLAGS': ['-use-ld=lld'] } }), encoding='utf-8'))" `
1535
+ 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'))" `
1498
1536
- OutFile " $PList "
1499
- }
1500
1537
}
1501
1538
1502
1539
# Copies files installed by CMake from the arch-specific platform root,
@@ -1900,6 +1937,21 @@ function Build-SourceKitLSP($Arch) {
1900
1937
}
1901
1938
}
1902
1939
1940
+ function Build-SwiftTestingMacros ($Arch ) {
1941
+ Build-CMakeProject `
1942
+ - Src $SourceCache \swift- testing\Sources\TestingMacros `
1943
+ - Bin (Get-HostProjectBinaryCache SwiftTestingMacros) `
1944
+ - InstallTo " $ ( $Arch.ToolchainInstallRoot ) \usr" `
1945
+ - Arch $Arch `
1946
+ - Platform Windows `
1947
+ - UseBuiltCompilers Swift `
1948
+ - SwiftSDK (Get-HostSwiftSDK ) `
1949
+ - BuildTargets default `
1950
+ - Defines @ {
1951
+ SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
1952
+ }
1953
+ }
1954
+
1903
1955
function Install-HostToolchain () {
1904
1956
if ($ToBatch ) { return }
1905
1957
@@ -2059,6 +2111,8 @@ if (-not $SkipBuild) {
2059
2111
Invoke-BuildStep Build-Dispatch Windows $Arch
2060
2112
Invoke-BuildStep Build-Foundation Windows $Arch
2061
2113
Invoke-BuildStep Build-XCTest Windows $Arch
2114
+ Invoke-BuildStep Build-SwiftTesting Windows $Arch
2115
+ Invoke-BuildStep Write-PlatformInfoPlist Windows $Arch
2062
2116
}
2063
2117
}
2064
2118
@@ -2077,6 +2131,8 @@ if (-not $ToBatch) {
2077
2131
}
2078
2132
2079
2133
if (-not $SkipBuild ) {
2134
+ # TestingMacros can't be built before the standard library for the host as it is required for the Swift code.
2135
+ Invoke-BuildStep Build-SwiftTestingMacros $HostArch
2080
2136
Invoke-BuildStep Build-SQLite $HostArch
2081
2137
Invoke-BuildStep Build-System $HostArch
2082
2138
Invoke-BuildStep Build-ToolsSupportCore $HostArch
@@ -2131,6 +2187,9 @@ if (-not $IsCrossCompiling) {
2131
2187
if ($Test -contains " xctest" ) {
2132
2188
Build-XCTest Windows $HostArch - Test
2133
2189
}
2190
+ if ($Test -contains " testing" ) {
2191
+ Build-SwiftTesting Windows $HostArch - Test
2192
+ }
2134
2193
if ($Test -contains " llbuild" ) { Build-LLBuild $HostArch - Test }
2135
2194
if ($Test -contains " swiftpm" ) { Test-PackageManager $HostArch }
2136
2195
}
0 commit comments