@@ -189,13 +189,15 @@ param
189189 [ValidateRange (1 , 36 )]
190190 [int ] $AndroidAPILevel = 28 ,
191191 [string []] $AndroidSDKVersions = @ (" Android" , " AndroidExperimental" ),
192+ [string ] $AndroidSDKVersionDefault = " Android" ,
192193 [string []] $AndroidSDKArchitectures = @ (" aarch64" , " armv7" , " i686" , " x86_64" ),
193194
194195 # Windows SDK Options
195196 [switch ] $Windows = $true ,
196197 [ValidatePattern (" ^\d+\.\d+\.\d+(?:-\w+)?" )]
197198 [string ] $WinSDKVersion = " " ,
198199 [string []] $WindowsSDKVersions = @ (" Windows" , " WindowsExperimental" ),
200+ [string ] $WindowsSDKVersionDefault = " Windows" ,
199201 [string []] $WindowsSDKArchitectures = @ (" X64" , " X86" , " Arm64" ),
200202
201203 # Incremental Build Support
@@ -291,6 +293,7 @@ $KnownPlatforms = @{
291293 };
292294 BinaryDir = " bin64a" ;
293295 Cache = @ {};
296+ DefaultSDK = $WindowsSDKVersionDefault ;
294297 };
295298
296299 WindowsX64 = @ {
@@ -304,6 +307,7 @@ $KnownPlatforms = @{
304307 };
305308 BinaryDir = " bin64" ;
306309 Cache = @ {};
310+ DefaultSDK = $WindowsSDKVersionDefault ;
307311 };
308312
309313 WindowsX86 = @ {
@@ -317,6 +321,7 @@ $KnownPlatforms = @{
317321 };
318322 BinaryDir = " bin32" ;
319323 Cache = @ {};
324+ DefaultSDK = $WindowsSDKVersionDefault ;
320325 };
321326
322327 AndroidARMv7 = @ {
@@ -330,6 +335,7 @@ $KnownPlatforms = @{
330335 };
331336 BinaryDir = " bin32a" ;
332337 Cache = @ {};
338+ DefaultSDK = $AndroidSDKVersionDefault ;
333339 };
334340
335341 AndroidARM64 = @ {
@@ -343,6 +349,7 @@ $KnownPlatforms = @{
343349 };
344350 BinaryDir = " bin64a" ;
345351 Cache = @ {};
352+ DefaultSDK = $AndroidSDKVersionDefault ;
346353 };
347354
348355 AndroidX86 = @ {
@@ -356,6 +363,7 @@ $KnownPlatforms = @{
356363 };
357364 BinaryDir = " bin32" ;
358365 Cache = @ {};
366+ DefaultSDK = $AndroidSDKVersionDefault ;
359367 };
360368
361369 AndroidX64 = @ {
@@ -369,6 +377,7 @@ $KnownPlatforms = @{
369377 };
370378 BinaryDir = " bin64" ;
371379 Cache = @ {};
380+ DefaultSDK = $AndroidSDKVersionDefault ;
372381 };
373382}
374383
@@ -3053,36 +3062,47 @@ function Build-XCTest([Hashtable] $Platform) {
30533062 - InstallTo " $ ( [IO.Path ]::Combine((Get-PlatformRoot $Platform.OS ), " Developer" , " Library" , " XCTest-$ProductVersion " , " usr" )) " `
30543063 - Platform $Platform `
30553064 - UseBuiltCompilers Swift `
3056- - SwiftSDK (Get-SwiftSDK $Platform.OS ) `
3065+ - SwiftSDK (Get-SwiftSDK - OS $Platform.OS - Identifier $Platform .DefaultSDK ) `
30573066 - Defines @ {
30583067 BUILD_SHARED_LIBS = " YES" ;
30593068 CMAKE_INSTALL_BINDIR = $Platform.BinaryDir ;
30603069 ENABLE_TESTING = " NO" ;
3061- dispatch_DIR = $ (Get-ProjectCMakeModules $Platform Dispatch);
3062- Foundation_DIR = $ (Get-ProjectCMakeModules $Platform DynamicFoundation);
30633070 XCTest_INSTALL_NESTED_SUBDIR = " YES" ;
30643071 }
30653072}
30663073
30673074function Test-XCTest {
30683075 Invoke-IsolatingEnvVars {
3069- $env: Path = " $ ( Get-ProjectBinaryCache $BuildPlatform XCTest) ;$ ( Get-ProjectBinaryCache $BuildPlatform DynamicFoundation) \bin;$ ( Get-ProjectBinaryCache $BuildPlatform Dispatch) ;$ ( Get-ProjectBinaryCache $BuildPlatform Runtime) \bin;${env: Path} ;$UnixToolsBinDir "
3076+ $SwiftRuntime = if ($BuildPlatform.DefaultSDK -match " Experimental" ) {
3077+ [IO.Path ]::Combine((Get-InstallDir $BuildPlatform ), " Runtimes" , " $ProductVersion .experimental" );
3078+ } else {
3079+ [IO.Path ]::Combine((Get-InstallDir $BuildPlatform ), " Runtimes" , " $ProductVersion " );
3080+ }
3081+
3082+ $DispatchBinaryCache = if ($BuildPlatform.DefaultSDK -match " Experimental" ) {
3083+ Get-ProjectBinaryCache $BuildPlatform ExperimentalDynamicDispatch
3084+ } else {
3085+ Get-ProjectBinaryCache $BuildPlatform Dispatch
3086+ }
3087+
3088+ $FoundationBinaryCache = if ($BuildPlatform.DefaultSDK -match " Experimental" ) {
3089+ Get-ProjectBinaryCache $BuildPlatform ExperimentalDynamicFoundation
3090+ } else {
3091+ Get-ProjectBinaryCache $BuildPlatform DynamicFoundation
3092+ }
30703093
3071- $RuntimeBinaryCache = Get-ProjectBinaryCache $BuildPlatform Runtime
3072- $SwiftRuntimeDirectory = " ${RuntimeBinaryCache} \lib\swift "
3094+ $env: Path = " $ ( Get-ProjectBinaryCache $BuildPlatform XCTest ) ; ${FoundationBinaryCache} \bin; ${DispatchBinaryCache} ; ${SwiftRuntime} \usr\bin; ${ env: Path} ; $UnixToolsBinDir "
3095+ $env: SDKROOT = Get-SwiftSDK - OS $Platform .OS - Identifier $Platform .DefaultSDK
30733096
30743097 Build-CMakeProject `
30753098 - Src $SourceCache \swift- corelibs- xctest `
30763099 - Bin (Get-ProjectBinaryCache $BuildPlatform XCTest) `
30773100 - Platform $BuildPlatform `
30783101 - UseBuiltCompilers C, CXX, Swift `
3079- - SwiftSDK $null `
3102+ - SwiftSDK ( Get-SwiftSDK - OS $Platform .OS - Identifier $Platform .DefaultSDK ) `
30803103 - BuildTargets default , check- xctest `
30813104 - Defines @ {
3082- CMAKE_Swift_FLAGS = @ (" -resource-dir" , $SwiftRuntimeDirectory , " -vfsoverlay" , " ${RuntimeBinaryCache} \stdlib\windows-vfs-overlay.yaml" );
30833105 ENABLE_TESTING = " YES" ;
3084- dispatch_DIR = $ (Get-ProjectCMakeModules $BuildPlatform Dispatch);
3085- Foundation_DIR = $ (Get-ProjectCMakeModules $BuildPlatform DynamicFoundation);
30863106 LLVM_DIR = " $ ( Get-ProjectBinaryCache $BuildPlatform LLVM) \lib\cmake\llvm" ;
30873107 XCTEST_PATH_TO_FOUNDATION_BUILD = $ (Get-ProjectBinaryCache $BuildPlatform DynamicFoundation);
30883108 XCTEST_PATH_TO_LIBDISPATCH_BUILD = $ (Get-ProjectBinaryCache $BuildPlatform Dispatch);
@@ -3098,12 +3118,10 @@ function Build-Testing([Hashtable] $Platform) {
30983118 - InstallTo " $ ( [IO.Path ]::Combine((Get-PlatformRoot $Platform.OS ), " Developer" , " Library" , " Testing-$ProductVersion " , " usr" )) " `
30993119 - Platform $Platform `
31003120 - UseBuiltCompilers CXX, Swift `
3101- - SwiftSDK (Get-SwiftSDK $Platform.OS ) `
3121+ - SwiftSDK (Get-SwiftSDK - OS $Platform.OS - Identifier $Platform .DefaultSDK ) `
31023122 - Defines @ {
31033123 BUILD_SHARED_LIBS = " YES" ;
31043124 CMAKE_INSTALL_BINDIR = $Platform.BinaryDir ;
3105- dispatch_DIR = (Get-ProjectCMakeModules $Platform Dispatch);
3106- Foundation_DIR = (Get-ProjectCMakeModules $Platform DynamicFoundation);
31073125 SwiftTesting_MACRO = " $ ( Get-ProjectBinaryCache $BuildPlatform BootstrapTestingMacros) \TestingMacros.dll" ;
31083126 SwiftTesting_INSTALL_NESTED_SUBDIR = " YES" ;
31093127 }
@@ -3164,8 +3182,6 @@ function Build-SDK([Hashtable] $Platform) {
31643182 Invoke-BuildStep Build-Dispatch $Platform
31653183 Invoke-BuildStep Build-Foundation $Platform
31663184 Invoke-BuildStep Build-CompilerRuntime $Platform
3167- Invoke-BuildStep Build-XCTest $Platform
3168- Invoke-BuildStep Build-Testing $Platform
31693185}
31703186
31713187function Build-ExperimentalSDK ([Hashtable ] $Platform ) {
@@ -4092,6 +4108,11 @@ if (-not $SkipBuild) {
40924108 }
40934109 }
40944110
4111+ foreach ($Build in $WindowsSDKBuilds ) {
4112+ Invoke-BuildStep Build-XCTest $Build
4113+ Invoke-BuildStep Build-Testing $Build
4114+ }
4115+
40954116 Write-PlatformInfoPlist Windows
40964117 }
40974118
@@ -4145,6 +4166,11 @@ if (-not $SkipBuild) {
41454166 }
41464167 }
41474168
4169+ foreach ($Build in $AndroidSDKBuilds ) {
4170+ Invoke-BuildStep Build-XCTest $Build
4171+ Invoke-BuildStep Build-Testing $Build
4172+ }
4173+
41484174 Write-PlatformInfoPlist Android
41494175
41504176 # Android swift-inspect only supports 64-bit platforms.
0 commit comments