@@ -2490,18 +2490,37 @@ function Build-Foundation {
24902490 Get-ProjectBinaryCache $Platform DynamicFoundation
24912491 }
24922492
2493+ $FoundationImage = if ($Static ) {
2494+ " $ ( Get-SwiftSDK $Platform.OS - Identifier " $ ( $Platform.OS ) Experimental" ) \usr"
2495+ } else {
2496+ " $ ( Get-SwiftSDK $Platform.OS ) \usr"
2497+ }
2498+
2499+ $SwiftFlags = if ($Static ) {
2500+ @ (" -static-stdlib" , " -Xfrontend" , " -use-static-resource-dir" )
2501+ } else {
2502+ @ ()
2503+ }
2504+
2505+ $SwiftSDK = if ($Static ) {
2506+ Get-SwiftSDK $Platform.OS - Identifier " $ ( $Platform.OS ) Experimental"
2507+ } else {
2508+ Get-SwiftSDK $Platform.OS
2509+ }
2510+
24932511 Build-CMakeProject `
24942512 - Src $SourceCache \swift- corelibs- foundation `
24952513 - Bin $FoundationBinaryCache `
2496- - InstallTo $ ( if ( $Static ) { " $ ( Get-SwiftSDK $Platform .OS - Identifier " $ ( $Platform .OS ) Experimental " ) \usr " } else { " $ ( Get-SwiftSDK $Platform .OS ) \usr " }) `
2514+ - InstallTo $FoundationImage `
24972515 - Platform $Platform `
24982516 - UseBuiltCompilers ASM, C, CXX, Swift `
2499- - SwiftSDK ( Get-SwiftSDK $Platform .OS ) `
2517+ - SwiftSDK $SwiftSDK `
25002518 - Defines @ {
25012519 BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
25022520 CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
25032521 CMAKE_NINJA_FORCE_RESPONSE_FILE = " YES" ;
25042522 CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
2523+ CMAKE_Swift_FLAGS = $SwiftFlags ;
25052524 ENABLE_TESTING = " NO" ;
25062525 FOUNDATION_BUILD_TOOLS = if ($Platform.OS -eq [OS ]::Windows) { " YES" } else { " NO" };
25072526 CURL_DIR = " $BinaryCache \$ ( $Platform.Triple ) \usr\lib\cmake\CURL" ;
@@ -3337,7 +3356,6 @@ if (-not $SkipBuild) {
33373356
33383357 foreach ($Platform in $WindowsSDKPlatforms ) {
33393358 Invoke-BuildStep Build-SDK $Platform
3340- Invoke-BuildStep Build-ExperimentalSDK $Platform
33413359
33423360 Get-ChildItem " $ ( Get-SwiftSDK Windows) \usr\lib\swift\windows" - Filter " *.lib" - File - ErrorAction Ignore | ForEach-Object {
33433361 Write-Host - BackgroundColor DarkRed - ForegroundColor White " $ ( $_.FullName ) is not nested in an architecture directory"
@@ -3347,29 +3365,48 @@ if (-not $SkipBuild) {
33473365 Copy-Directory " $ ( Get-SwiftSDK Windows) \usr\bin" " $ ( [IO.Path ]::Combine((Get-InstallDir $Platform ), " Runtimes" , $ProductVersion , " usr" )) "
33483366 }
33493367
3350- Write-PlatformInfoPlist Windows
33513368 Install-SDK $WindowsSDKPlatforms
33523369 Write-SDKSettings Windows
3370+
3371+ foreach ($Platform in $WindowsSDKPlatforms ) {
3372+ Invoke-BuildStep Build-ExperimentalSDK $Platform
3373+ Get-ChildItem " $ ( Get-SwiftSDK Windows - Identifier WindowsExperimental) \usr\lib\swift_static\windows" - Filter " *.lib" - File - ErrorAction Ignore | ForEach-Object {
3374+ Write-Host - BackgroundColor DarkRed - ForegroundColor White " $ ( $_.FullName ) is not nested in an architecture directory"
3375+ Move-Item $_.FullName " $ ( Get-SwiftSDK Windows - Identifier WindowsExperimental) \usr\lib\swift_static\windows\$ ( $Platform.Architecture.LLVMName ) \" | Out-Null
3376+ }
3377+ }
3378+
33533379 Install-SDK $WindowsSDKPlatforms - Identifier WindowsExperimental
33543380 Write-SDKSettings Windows - Identifier WindowsExperimental
33553381
3382+ Write-PlatformInfoPlist Windows
3383+
33563384 if ($Android ) {
33573385 foreach ($Platform in $AndroidSDKPlatforms ) {
33583386 Invoke-BuildStep Build-SDK $Platform
3359- Invoke-BuildStep Build-ExperimentalSDK $Platform
33603387
33613388 Get-ChildItem " $ ( Get-SwiftSDK Android) \usr\lib\swift\android" - File | Where-Object { $_.Name -match " .a$|.so$" } | ForEach-Object {
33623389 Write-Host - BackgroundColor DarkRed - ForegroundColor White " $ ( $_.FullName ) is not nested in an architecture directory"
33633390 Move-Item $_.FullName " $ ( Get-SwiftSDK Android) \usr\lib\swift\android\$ ( $Platform.Architecture.LLVMName ) \" | Out-Null
33643391 }
33653392 }
33663393
3367- Write-PlatformInfoPlist Android
33683394 Install-SDK $AndroidSDKPlatforms
33693395 Write-SDKSettings Android
3370- Install-SDK $AndroidSDKPlatforms - Identifiers AndroidExperimental
3396+
3397+ foreach ($Platform in $AndroidSDKPlatforms ) {
3398+ Invoke-BuildStep Build-ExperimentalSDK $Platform
3399+ Get-ChildItem " $ ( Get-SwiftSDK Android - Identifier AndroidExperimental) \usr\lib\swift_static\android" - File | Where-Object { $_.Name -match " .a$" } | ForEach-Object {
3400+ Write-Host - BackgroundColor DarkRed - ForegroundColor White " $ ( $_.FullName ) is not nested in an architecture directory"
3401+ Move-Item $_.FullName " $ ( Get-SwiftSDK Android - Identifier AndroidExperimental) \usr\lib\swift_static\android\$ ( $Platform.Architecture.LLVMName ) \" | Out-Null
3402+ }
3403+ }
3404+
3405+ Install-SDK $AndroidSDKPlatforms - Identifier AndroidExperimental
33713406 Write-SDKSettings Android - Identifier AndroidExperimental
33723407
3408+ Write-PlatformInfoPlist Android
3409+
33733410 # Android swift-inspect only supports 64-bit platforms.
33743411 $AndroidSDKPlatforms | Where-Object { @ (" arm64-v8a" , " x86_64" ) -contains $_.Architecture.ABI } | ForEach-Object {
33753412 Invoke-BuildStep Build-Inspect $_
0 commit comments