@@ -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 ) {
@@ -1731,11 +1740,43 @@ function Build-XCTest([Platform]$Platform, $Arch, [switch]$Test = $false) {
1731
1740
dispatch_DIR = " $DispatchBinaryCache \cmake\modules" ;
1732
1741
Foundation_DIR = " $FoundationBinaryCache \cmake\modules" ;
1733
1742
} + $TestingDefines )
1743
+ }
1744
+ }
1745
+
1746
+ function Build-SwiftTesting ([Platform ]$Platform , $Arch , [switch ]$Test = $false ) {
1747
+ $SwiftTestingBinaryCache = Get-TargetProjectBinaryCache $Arch SwiftTesting
1748
+
1749
+ Isolate- EnvVars {
1750
+ if ($Test ) {
1751
+ # TODO: Test
1752
+ return
1753
+ } else {
1754
+ $Targets = @ (" default" )
1755
+ $InstallPath = " $ ( $Arch.SwiftTestingInstallRoot ) \usr"
1756
+ }
1757
+
1758
+ Build-CMakeProject `
1759
+ - Src $SourceCache \swift- testing `
1760
+ - Bin $SwiftTestingBinaryCache `
1761
+ - InstallTo $InstallPath `
1762
+ - Arch $Arch `
1763
+ - Platform $Platform `
1764
+ - UseBuiltCompilers C, CXX, Swift `
1765
+ - BuildTargets $Targets `
1766
+ - Defines (@ {
1767
+ BUILD_SHARED_LIBS = " YES" ;
1768
+ CMAKE_BUILD_WITH_INSTALL_RPATH = " YES" ;
1769
+ SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
1770
+ # FIXME: Build the plugin for the builder and specify the path.
1771
+ SwiftTesting_MACRO = " NO" ;
1772
+ })
1773
+ }
1774
+ }
1734
1775
1776
+ function Write-PlatformInfoPlist ($Arch ) {
1735
1777
$PList = Join-Path - Path $Arch.PlatformInstallRoot - ChildPath " Info.plist"
1736
- Invoke-Program $python - c " import plistlib; print(str(plistlib.dumps({ 'DefaultProperties': { 'XCTEST_VERSION': 'development', 'SWIFTC_FLAGS': ['-use-ld=lld'] } }), encoding='utf-8'))" `
1778
+ 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'))" `
1737
1779
- OutFile " $PList "
1738
- }
1739
1780
}
1740
1781
1741
1782
# Copies files installed by CMake from the arch-specific platform root,
@@ -2167,6 +2208,21 @@ function Build-SourceKitLSP($Arch) {
2167
2208
}
2168
2209
}
2169
2210
2211
+ function Build-SwiftTestingMacros ($Arch ) {
2212
+ Build-CMakeProject `
2213
+ - Src $SourceCache \swift- testing\Sources\TestingMacros `
2214
+ - Bin (Get-HostProjectBinaryCache SwiftTestingMacros) `
2215
+ - InstallTo " $ ( $Arch.ToolchainInstallRoot ) \usr" `
2216
+ - Arch $Arch `
2217
+ - Platform Windows `
2218
+ - UseBuiltCompilers Swift `
2219
+ - SwiftSDK (Get-HostSwiftSDK ) `
2220
+ - BuildTargets default `
2221
+ - Defines @ {
2222
+ SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
2223
+ }
2224
+ }
2225
+
2170
2226
function Install-HostToolchain () {
2171
2227
if ($ToBatch ) { return }
2172
2228
@@ -2325,20 +2381,24 @@ if (-not $SkipBuild) {
2325
2381
Invoke-BuildStep Build-Dispatch Windows $Arch
2326
2382
Invoke-BuildStep Build-Foundation Windows $Arch
2327
2383
Invoke-BuildStep Build-XCTest Windows $Arch
2384
+ Invoke-BuildStep Build-SwiftTesting Windows $Arch
2385
+ Invoke-BuildStep Write-PlatformInfoPlist $Arch
2328
2386
}
2329
2387
2330
- foreach ($Arch in $AndroidSDKArchs ) {
2331
- Invoke-BuildStep Build-ZLib Android $Arch
2332
- Invoke-BuildStep Build-XML2 Android $Arch
2333
- Invoke-BuildStep Build-CURL Android $Arch
2334
- Invoke-BuildStep Build-LLVM Android $Arch
2388
+ foreach ($Arch in $AndroidSDKArchs ) {
2389
+ Invoke-BuildStep Build-ZLib Android $Arch
2390
+ Invoke-BuildStep Build-XML2 Android $Arch
2391
+ Invoke-BuildStep Build-CURL Android $Arch
2392
+ Invoke-BuildStep Build-LLVM Android $Arch
2335
2393
2336
- # Build platform: SDK, Redist and XCTest
2337
- Invoke-BuildStep Build-Runtime Android $Arch
2338
- Invoke-BuildStep Build-Dispatch Android $Arch
2339
- Invoke-BuildStep Build-Foundation Android $Arch
2340
- Invoke-BuildStep Build-XCTest Android $Arch
2341
- }
2394
+ # Build platform: SDK, Redist and XCTest
2395
+ Invoke-BuildStep Build-Runtime Android $Arch
2396
+ Invoke-BuildStep Build-Dispatch Android $Arch
2397
+ Invoke-BuildStep Build-Foundation Android $Arch
2398
+ Invoke-BuildStep Build-XCTest Android $Arch
2399
+ Invoke-BuildStep Build-SwiftTesting Android $Arch
2400
+ Invoke-BuildStep Write-PlatformInfoPlist $Arch
2401
+ }
2342
2402
}
2343
2403
2344
2404
if (-not $ToBatch ) {
@@ -2360,6 +2420,8 @@ if (-not $ToBatch) {
2360
2420
}
2361
2421
2362
2422
if (-not $SkipBuild ) {
2423
+ # TestingMacros can't be built before the standard library for the host as it is required for the Swift code.
2424
+ Invoke-BuildStep Build-SwiftTestingMacros $HostArch
2363
2425
Invoke-BuildStep Build-SQLite $HostArch
2364
2426
Invoke-BuildStep Build-System $HostArch
2365
2427
Invoke-BuildStep Build-ToolsSupportCore $HostArch
@@ -2414,6 +2476,9 @@ if (-not $IsCrossCompiling) {
2414
2476
if ($Test -contains " xctest" ) {
2415
2477
Build-XCTest Windows $HostArch - Test
2416
2478
}
2479
+ if ($Test -contains " testing" ) {
2480
+ Build-SwiftTesting Windows $HostArch - Test
2481
+ }
2417
2482
if ($Test -contains " llbuild" ) { Build-LLBuild $HostArch - Test }
2418
2483
if ($Test -contains " swiftpm" ) { Test-PackageManager $HostArch }
2419
2484
}
0 commit comments