@@ -215,6 +215,7 @@ $ArchX64 = @{
215215 PlatformInstallRoot = " $BinaryCache \x64\Windows.platform" ;
216216 SDKInstallRoot = " $BinaryCache \x64\Windows.platform\Developer\SDKs\Windows.sdk" ;
217217 XCTestInstallRoot = " $BinaryCache \x64\Windows.platform\Developer\Library\XCTest-development" ;
218+ SwiftTestingInstallRoot = " $BinaryCache \x64\Windows.platform\Developer\Library\Testing-development" ;
218219 ToolchainInstallRoot = " $BinaryCache \x64\toolchains\$ProductVersion +Asserts" ;
219220}
220221
@@ -230,6 +231,7 @@ $ArchX86 = @{
230231 PlatformInstallRoot = " $BinaryCache \x86\Windows.platform" ;
231232 SDKInstallRoot = " $BinaryCache \x86\Windows.platform\Developer\SDKs\Windows.sdk" ;
232233 XCTestInstallRoot = " $BinaryCache \x86\Windows.platform\Developer\Library\XCTest-development" ;
234+ SwiftTestingInstallRoot = " $BinaryCache \x86\Windows.platform\Developer\Library\Testing-development" ;
233235}
234236
235237$ArchARM64 = @ {
@@ -245,6 +247,7 @@ $ArchARM64 = @{
245247 SDKInstallRoot = " $BinaryCache \arm64\Windows.platform\Developer\SDKs\Windows.sdk" ;
246248 XCTestInstallRoot = " $BinaryCache \arm64\Windows.platform\Developer\Library\XCTest-development" ;
247249 ToolchainInstallRoot = " $BinaryCache \arm64\toolchains\$ProductVersion +Asserts" ;
250+ SwiftTestingInstallRoot = " $BinaryCache \arm64\Windows.platform\Developer\Library\Testing-development" ;
248251}
249252
250253$AndroidARM64 = @ {
@@ -258,6 +261,7 @@ $AndroidARM64 = @{
258261 PlatformInstallRoot = " $BinaryCache \arm64\Android.platform" ;
259262 SDKInstallRoot = " $BinaryCache \arm64\Android.platform\Developer\SDKs\Android.sdk" ;
260263 XCTestInstallRoot = " $BinaryCache \arm64\Android.platform\Developer\Library\XCTest-development" ;
264+ SwiftTestingInstallRoot = " $BinaryCache \arm64\Android.platform\Developer\Library\Testing-development" ;
261265}
262266
263267$AndroidARMv7 = @ {
@@ -271,6 +275,7 @@ $AndroidARMv7 = @{
271275 PlatformInstallRoot = " $BinaryCache \armv7\Android.platform" ;
272276 SDKInstallRoot = " $BinaryCache \armv7\Android.platform\Developer\SDKs\Android.sdk" ;
273277 XCTestInstallRoot = " $BinaryCache \armv7\Android.platform\Developer\Library\XCTest-development" ;
278+ SwiftTestingInstallRoot = " $BinaryCache \armv7\Android.platform\Developer\Library\Testing-development" ;
274279}
275280
276281$AndroidX86 = @ {
@@ -284,6 +289,7 @@ $AndroidX86 = @{
284289 PlatformInstallRoot = " $BinaryCache \x86\Android.platform" ;
285290 SDKInstallRoot = " $BinaryCache \x86\Android.platform\Developer\SDKs\Android.sdk" ;
286291 XCTestInstallRoot = " $BinaryCache \x86\Android.platform\Developer\Library\XCTest-development" ;
292+ SwiftTestingInstallRoot = " $BinaryCache \x86\Android.platform\Developer\Library\Testing-development" ;
287293}
288294
289295$AndroidX64 = @ {
@@ -297,6 +303,7 @@ $AndroidX64 = @{
297303 PlatformInstallRoot = " $BinaryCache \x64\Android.platform" ;
298304 SDKInstallRoot = " $BinaryCache \x64\Android.platform\Developer\SDKs\Android.sdk" ;
299305 XCTestInstallRoot = " $BinaryCache \x64\Android.platform\Developer\Library\XCTest-development" ;
306+ SwiftTestingInstallRoot = " $BinaryCache \x64\Android.platform\Developer\Library\Testing-development" ;
300307}
301308
302309$HostArch = switch ($HostArchName ) {
@@ -387,6 +394,7 @@ enum TargetComponent {
387394 Dispatch
388395 Foundation
389396 XCTest
397+ SwiftTesting
390398}
391399
392400function Get-TargetProjectBinaryCache ($Arch , [TargetComponent ]$Project ) {
@@ -413,6 +421,7 @@ enum HostComponent {
413421 LMDB
414422 SymbolKit
415423 DocC
424+ SwiftTestingMacros
416425}
417426
418427function Get-HostProjectBinaryCache ([HostComponent ]$Project ) {
@@ -1749,11 +1758,43 @@ function Build-XCTest([Platform]$Platform, $Arch, [switch]$Test = $false) {
17491758 dispatch_DIR = " $DispatchBinaryCache \cmake\modules" ;
17501759 Foundation_DIR = " $FoundationBinaryCache \cmake\modules" ;
17511760 } + $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+ }
17521793
1794+ function Write-PlatformInfoPlist ($Arch ) {
17531795 $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'))" `
17551797 - OutFile " $PList "
1756- }
17571798}
17581799
17591800# Copies files installed by CMake from the arch-specific platform root,
@@ -2185,6 +2226,21 @@ function Build-SourceKitLSP($Arch) {
21852226 }
21862227}
21872228
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+
21882244function Install-HostToolchain () {
21892245 if ($ToBatch ) { return }
21902246
@@ -2343,20 +2399,24 @@ if (-not $SkipBuild) {
23432399 Invoke-BuildStep Build-Dispatch Windows $Arch
23442400 Invoke-BuildStep Build-Foundation Windows $Arch
23452401 Invoke-BuildStep Build-XCTest Windows $Arch
2402+ Invoke-BuildStep Build-SwiftTesting Windows $Arch
2403+ Invoke-BuildStep Write-PlatformInfoPlist $Arch
23462404 }
23472405
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
23532411
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+ }
23602420}
23612421
23622422if (-not $ToBatch ) {
@@ -2378,6 +2438,8 @@ if (-not $ToBatch) {
23782438}
23792439
23802440if (-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
23812443 Invoke-BuildStep Build-SQLite $HostArch
23822444 Invoke-BuildStep Build-System $HostArch
23832445 Invoke-BuildStep Build-ToolsSupportCore $HostArch
@@ -2432,6 +2494,9 @@ if (-not $IsCrossCompiling) {
24322494 if ($Test -contains " xctest" ) {
24332495 Build-XCTest Windows $HostArch - Test
24342496 }
2497+ if ($Test -contains " testing" ) {
2498+ Build-SwiftTesting Windows $HostArch - Test
2499+ }
24352500 if ($Test -contains " llbuild" ) { Build-LLBuild $HostArch - Test }
24362501 if ($Test -contains " swiftpm" ) { Test-PackageManager $HostArch }
24372502}
0 commit comments