@@ -544,7 +544,6 @@ function Get-InstallDir([Hashtable] $Platform) {
544544 } elseif (($HostPlatform -eq $KnownPlatforms [" WindowsARM64" ]) -and ($Platform -eq $KnownPlatforms [" WindowsX64" ])) {
545545 # x64 programs actually install under "Program Files" on arm64,
546546 # but this would conflict with the native installation.
547-
548547 $ProgramFilesName = " Program Files (Amd64)"
549548 } else {
550549 # arm64 cannot be installed on x64
@@ -1069,9 +1068,9 @@ function Get-Dependencies {
10691068 $WinSDKPlatforms += $HostPlatform
10701069 }
10711070
1072- foreach ($Plat in $WinSDKPlatforms ) {
1073- Invoke-Program nuget install $Package .$ ($Plat .Architecture.ShortName ) - Version $WinSDKVersion - OutputDirectory $NugetRoot
1074- Copy-Directory " $NugetRoot \$Package .$ ( $Plat .Architecture.ShortName ) .$WinSDKVersion \c\*" " $CustomWinSDKRoot \lib\$WinSDKVersion "
1071+ foreach ($Platform in $WinSDKPlatforms ) {
1072+ Invoke-Program nuget install $Package .$ ($Platform .Architecture.ShortName ) - Version $WinSDKVersion - OutputDirectory $NugetRoot
1073+ Copy-Directory " $NugetRoot \$Package .$ ( $Platform .Architecture.ShortName ) .$WinSDKVersion \c\*" " $CustomWinSDKRoot \lib\$WinSDKVersion "
10751074 }
10761075 }
10771076 }
@@ -1105,7 +1104,8 @@ function Get-PinnedToolchainToolsDir() {
11051104 return $VariantToolchainPath
11061105 }
11071106
1108- return " $BinaryCache \toolchains\$PinnedToolchain \Library\Developer\Toolchains\unknown-$PinnedToolchainVariant -development.xctoolchain\usr\bin"
1107+ return [IO.Path ]::Combine(" $BinaryCache \" , " toolchains" , $PinnedToolchain ,
1108+ " Library" , " Developer" , " Toolchains" , " unknown-$PinnedToolchainVariant -development.xctoolchain" , " usr" , " bin" )
11091109}
11101110
11111111function Get-PinnedToolchainSDK () {
@@ -1161,12 +1161,14 @@ function Get-PlatformRoot([OS] $OS) {
11611161 return ([IO.Path ]::Combine((Get-InstallDir $HostPlatform ), " Platforms" , " $ ( $OS.ToString ()) .platform" ))
11621162}
11631163
1164- function Get-SwiftSDK ([OS ] $OS , [switch ] $Experimental ) {
1165- $PlatformStr = $OS.ToString ()
1166- if ($Experimental ) {
1167- $PlatformStr += " Experimental"
1168- }
1169- return ([IO.Path ]::Combine((Get-PlatformRoot $OS ), " Developer" , " SDKs" , " $PlatformStr .sdk" ))
1164+ function Get-SwiftSDK {
1165+ param
1166+ (
1167+ [Parameter (Mandatory )]
1168+ [OS ] $OS ,
1169+ [string ] $Identifier = $OS.ToString ()
1170+ )
1171+ return ([IO.Path ]::Combine((Get-PlatformRoot $OS ), " Developer" , " SDKs" , " $Identifier .sdk" ))
11701172}
11711173
11721174function Build-CMakeProject {
@@ -2285,7 +2287,7 @@ function Build-ExperimentalRuntime {
22852287 Build-CMakeProject `
22862288 - Src $SourceCache \swift\Runtimes\Core `
22872289 - Bin (Get-ProjectBinaryCache $Platform ExperimentalRuntime) `
2288- - InstallTo " $ ( Get-SwiftSDK $Platform.OS - Experimental) \usr" `
2290+ - InstallTo " $ ( Get-SwiftSDK $Platform.OS - Identifier " $ ( $Platform .OS ) Experimental" ) \usr" `
22892291 - Platform $Platform `
22902292 - UseBuiltCompilers C, CXX, Swift `
22912293 - UseGNUDriver `
@@ -2376,7 +2378,7 @@ function Build-Foundation {
23762378 Build-CMakeProject `
23772379 - Src $SourceCache \swift- corelibs- foundation `
23782380 - Bin $FoundationBinaryCache `
2379- - InstallTo $ (if ($Static ) { " $ ( Get-SwiftSDK $Platform.OS - Experimental) \usr" } else { " $ ( Get-SwiftSDK $Platform.OS ) \usr" }) `
2381+ - InstallTo $ (if ($Static ) { " $ ( Get-SwiftSDK $Platform.OS - Identifier " $ ( $Platform .OS ) Experimental" ) \usr" } else { " $ ( Get-SwiftSDK $Platform.OS ) \usr" }) `
23802382 - Platform $Platform `
23812383 - UseBuiltCompilers ASM, C, CXX, Swift `
23822384 - SwiftSDK (Get-SwiftSDK $Platform.OS ) `
@@ -2539,11 +2541,11 @@ function Install-Platform([Hashtable[]] $Platforms, [OS] $OS) {
25392541 }
25402542
25412543 # Copy files from the arch subdirectory, including "*.swiftmodule" which need restructuring
2542- foreach ($Plat in $Platforms ) {
2543- $PlatformResources = " $ ( Get-SwiftSDK $Plat .OS ) \usr\lib\swift\$ ( $Plat .OS.ToString ().ToLowerInvariant()) "
2544- Get-ChildItem - Recurse " $PlatformResources \$ ( $Plat .Architecture.LLVMName ) " | ForEach-Object {
2544+ foreach ($Platform in $Platforms ) {
2545+ $PlatformResources = " $ ( Get-SwiftSDK $Platform .OS ) \usr\lib\swift\$ ( $Platform .OS.ToString ().ToLowerInvariant()) "
2546+ Get-ChildItem - Recurse " $PlatformResources \$ ( $Platform .Architecture.LLVMName ) " | ForEach-Object {
25452547 if (" .swiftmodule" , " .swiftdoc" , " .swiftinterface" -contains $_.Extension ) {
2546- Copy-File $_.FullName " $PlatformResources \$ ( $_.BaseName ) .swiftmodule\$ ( Get-ModuleTriple $Plat ) $ ( $_.Extension ) "
2548+ Copy-File $_.FullName " $PlatformResources \$ ( $_.BaseName ) .swiftmodule\$ ( Get-ModuleTriple $Platform ) $ ( $_.Extension ) "
25472549 }
25482550 }
25492551 }
@@ -3110,10 +3112,10 @@ function Build-Installer([Hashtable] $Platform) {
31103112 }
31113113 }
31123114
3113- foreach ($Plat in $WindowsSDKPlatforms ) {
3114- $Properties [" INCLUDE_WINDOWS_$ ( $Plat .Architecture.VSName.ToUpperInvariant ()) _SDK" ] = " true"
3115- $Properties [" PLATFORM_ROOT_$ ( $Plat .Architecture.VSName.ToUpperInvariant ()) " ] = " $ ( Get-PlatformRoot Windows) \" ;
3116- $Properties [" SDK_ROOT_$ ( $Plat .Architecture.VSName.ToUpperInvariant ()) " ] = " $ ( Get-SwiftSDK Windows) \"
3115+ foreach ($SDKPlatform in $WindowsSDKPlatforms ) {
3116+ $Properties [" INCLUDE_WINDOWS_$ ( $SDKPlatform .Architecture.VSName.ToUpperInvariant ()) _SDK" ] = " true"
3117+ $Properties [" PLATFORM_ROOT_$ ( $SDKPlatform .Architecture.VSName.ToUpperInvariant ()) " ] = " $ ( Get-PlatformRoot Windows) \" ;
3118+ $Properties [" SDK_ROOT_$ ( $SDKPlatform .Architecture.VSName.ToUpperInvariant ()) " ] = " $ ( Get-SwiftSDK Windows) \"
31173119 }
31183120
31193121 Build-WiXProject bundle\installer.wixproj - Platform $Platform - Bundle - Properties $Properties
@@ -3122,10 +3124,10 @@ function Build-Installer([Hashtable] $Platform) {
31223124function Copy-BuildArtifactsToStage ([Hashtable ] $Platform ) {
31233125 Copy-File " $BinaryCache \$ ( $Platform.Triple ) \installer\Release\$ ( $Platform.Architecture.VSName ) \*.cab" $Stage
31243126 Copy-File " $BinaryCache \$ ( $Platform.Triple ) \installer\Release\$ ( $Platform.Architecture.VSName ) \*.msi" $Stage
3125- foreach ($Plat in $WindowsSDKPlatforms ) {
3126- Copy-File " $BinaryCache \$ ( $Platform.Triple ) \installer\Release\$ ( $Plat .Architecture.VSName ) \sdk.windows.$ ( $Plat .Architecture.VSName ) .cab" $Stage
3127- Copy-File " $BinaryCache \$ ( $Platform.Triple ) \installer\Release\$ ( $Plat .Architecture.VSName ) \sdk.windows.$ ( $Plat .Architecture.VSName ) .msi" $Stage
3128- Copy-File " $BinaryCache \$ ( $Platform.Triple ) \installer\Release\$ ( $Plat .Architecture.VSName ) \rtl.$ ( $Plat .Architecture.VSName ) .msm" $Stage
3127+ foreach ($SDKPlatform in $WindowsSDKPlatforms ) {
3128+ Copy-File " $BinaryCache \$ ( $Platform.Triple ) \installer\Release\$ ( $SDKPlatform .Architecture.VSName ) \sdk.windows.$ ( $SDKPlatform .Architecture.VSName ) .cab" $Stage
3129+ Copy-File " $BinaryCache \$ ( $Platform.Triple ) \installer\Release\$ ( $SDKPlatform .Architecture.VSName ) \sdk.windows.$ ( $SDKPlatform .Architecture.VSName ) .msi" $Stage
3130+ Copy-File " $BinaryCache \$ ( $Platform.Triple ) \installer\Release\$ ( $SDKPlatform .Architecture.VSName ) \rtl.$ ( $SDKPlatform .Architecture.VSName ) .msm" $Stage
31293131 }
31303132 Copy-File " $BinaryCache \$ ( $Platform.Triple ) \installer\Release\$ ( $Platform.Architecture.VSName ) \installer.exe" $Stage
31313133 # Extract installer engine to ease code-signing on swift.org CI
@@ -3147,11 +3149,11 @@ if ($Clean) {
31473149
31483150 # In case of a previous test run, clear out the swiftmodules as they are not a stable format.
31493151 Remove-Item - Force - Recurse - Path " $ ( $HostPlatform.ToolchainInstallRoot ) \usr\lib\swift\windows\*.swiftmodule" - ErrorAction Ignore
3150- foreach ($Plat in $WindowsSDKPlatforms ) {
3151- Remove-Item - Force - Recurse - Path " $BinaryCache \$ ( $Plat .Triple ) \" - ErrorAction Ignore
3152+ foreach ($Platform in $WindowsSDKPlatforms ) {
3153+ Remove-Item - Force - Recurse - Path " $BinaryCache \$ ( $Platform .Triple ) \" - ErrorAction Ignore
31523154 }
3153- foreach ($Plat in $AndroidSDKPlatforms ) {
3154- Remove-Item - Force - Recurse - Path " $BinaryCache \$ ( $Plat .Triple ) \" - ErrorAction Ignore
3155+ foreach ($Platform in $AndroidSDKPlatforms ) {
3156+ Remove-Item - Force - Recurse - Path " $BinaryCache \$ ( $Platform .Triple ) \" - ErrorAction Ignore
31553157 }
31563158
31573159 Remove-Item - Force - Recurse ([IO.Path ]::Combine((Get-InstallDir $HostPlatform ), " Runtimes" , $ProductVersion )) - ErrorAction Ignore
@@ -3178,69 +3180,69 @@ if (-not $SkipBuild) {
31783180 Invoke-BuildStep Build-XML2 $HostPlatform
31793181 Invoke-BuildStep Build-Compilers $HostPlatform
31803182
3181- foreach ($Plat in $WindowsSDKPlatforms ) {
3182- Invoke-BuildStep Build-ZLib $Plat
3183- Invoke-BuildStep Build-XML2 $Plat
3184- Invoke-BuildStep Build-CURL $Plat
3185- Invoke-BuildStep Build-LLVM $Plat
3183+ foreach ($Platform in $WindowsSDKPlatforms ) {
3184+ Invoke-BuildStep Build-ZLib $Platform
3185+ Invoke-BuildStep Build-XML2 $Platform
3186+ Invoke-BuildStep Build-CURL $Platform
3187+ Invoke-BuildStep Build-LLVM $Platform
31863188
31873189 # Build platform: SDK, Redist and XCTest
3188- Invoke-BuildStep Build-Runtime $Plat
3189- Invoke-BuildStep Build-Dispatch $Plat
3190+ Invoke-BuildStep Build-Runtime $Platform
3191+ Invoke-BuildStep Build-Dispatch $Platform
31903192 # FIXME(compnerd) ensure that the _build_ is the first arch and don't rebuild on each arch
3191- if ($Plat -eq $BuildPlatform ) {
3193+ if ($Platform -eq $BuildPlatform ) {
31923194 Invoke-BuildStep Build-FoundationMacros $BuildPlatform
31933195 Invoke-BuildStep Build-TestingMacros $BuildPlatform
31943196 }
3195- Invoke-BuildStep Build-Foundation $Plat
3196- Invoke-BuildStep Build-Sanitizers $Plat
3197- Invoke-BuildStep Build-XCTest $Plat
3198- Invoke-BuildStep Build-Testing $Plat
3199- Invoke-BuildStep Write-SDKSettingsPlist $Plat
3197+ Invoke-BuildStep Build-Foundation $Platform
3198+ Invoke-BuildStep Build-Sanitizers $Platform
3199+ Invoke-BuildStep Build-XCTest $Platform
3200+ Invoke-BuildStep Build-Testing $Platform
3201+ Invoke-BuildStep Write-SDKSettingsPlist $Platform
32003202
3201- Invoke-BuildStep Build-ExperimentalRuntime $Plat - Static
3202- Invoke-BuildStep Build-Foundation $Plat - Static
3203+ Invoke-BuildStep Build-ExperimentalRuntime $Platform - Static
3204+ Invoke-BuildStep Build-Foundation $Platform - Static
32033205
3204- Copy-File " $ ( Get-SwiftSDK Windows) \usr\lib\swift\windows\*.lib" " $ ( Get-SwiftSDK Windows) \usr\lib\swift\windows\$ ( $Plat .Architecture.LLVMName ) \"
3205- if ($Plat -eq $HostPlatform ) {
3206+ Copy-File " $ ( Get-SwiftSDK Windows) \usr\lib\swift\windows\*.lib" " $ ( Get-SwiftSDK Windows) \usr\lib\swift\windows\$ ( $Platform .Architecture.LLVMName ) \"
3207+ if ($Platform -eq $HostPlatform ) {
32063208 Copy-Directory " $ ( Get-SwiftSDK Windows) \usr\bin" " $ ( [IO.Path ]::Combine((Get-InstallDir $HostPlatform ), " Runtimes" , $ProductVersion )) \usr"
32073209 }
32083210 }
32093211 Install-Platform $WindowsSDKPlatforms Windows
32103212 Invoke-BuildStep Write-PlatformInfoPlist $HostPlatform
32113213
32123214 if ($Android ) {
3213- foreach ($Plat in $AndroidSDKPlatforms ) {
3215+ foreach ($Platform in $AndroidSDKPlatforms ) {
32143216 if ($IncludeDS2 ) {
3215- Invoke-BuildStep Build-DS2 $Plat
3217+ Invoke-BuildStep Build-DS2 $Platform
32163218 }
3217- Invoke-BuildStep Build-ZLib $Plat
3218- Invoke-BuildStep Build-XML2 $Plat
3219- Invoke-BuildStep Build-CURL $Plat
3220- Invoke-BuildStep Build-LLVM $Plat
3219+ Invoke-BuildStep Build-ZLib $Platform
3220+ Invoke-BuildStep Build-XML2 $Platform
3221+ Invoke-BuildStep Build-CURL $Platform
3222+ Invoke-BuildStep Build-LLVM $Platform
32213223
32223224 # Build platform: SDK, Redist and XCTest
3223- Invoke-BuildStep Build-Runtime $Plat
3224- Invoke-BuildStep Build-Dispatch $Plat
3225- Invoke-BuildStep Build-Foundation $Plat
3226- Invoke-BuildStep Build-Sanitizers $Plat
3227- Invoke-BuildStep Build-XCTest $Plat
3228- Invoke-BuildStep Build-Testing $Plat
3225+ Invoke-BuildStep Build-Runtime $Platform
3226+ Invoke-BuildStep Build-Dispatch $Platform
3227+ Invoke-BuildStep Build-Foundation $Platform
3228+ Invoke-BuildStep Build-Sanitizers $Platform
3229+ Invoke-BuildStep Build-XCTest $Platform
3230+ Invoke-BuildStep Build-Testing $Platform
32293231
32303232 # Android swift-inspect only supports 64-bit platforms.
3231- if ($Plat .Architecture.ABI -in @ (" arm64-v8a" , " x86_64" )) {
3232- Invoke-BuildStep Build-Inspect $Plat
3233+ if ($Platform .Architecture.ABI -in @ (" arm64-v8a" , " x86_64" )) {
3234+ Invoke-BuildStep Build-Inspect $Platform
32333235 }
3234- Invoke-BuildStep Write-SDKSettingsPlist $Plat
3236+ Invoke-BuildStep Write-SDKSettingsPlist $Platform
32353237
3236- Invoke-BuildStep Build-ExperimentalRuntime $Plat - Static
3237- Invoke-BuildStep Build-Foundation $Plat - Static
3238+ Invoke-BuildStep Build-ExperimentalRuntime $Platform - Static
3239+ Invoke-BuildStep Build-Foundation $Platform - Static
32383240
3239- Move-Item " $ ( Get-SwiftSDK [OS ]::Android) \usr\lib\swift\android\*.a" " $ ( Get-SwiftSDK [OS ]::Android) \usr\lib\swift\android\$ ( $Plat .Architecture.LLVMName ) \"
3240- Move-Item " $ ( Get-SwiftSDK [OS ]::Android) \usr\lib\swift\android\*.so" " $ ( Get-SwiftSDK [OS ]::Android) \usr\lib\swift\android\$ ( $Plat .Architecture.LLVMName ) \"
3241+ Move-Item " $ ( Get-SwiftSDK [OS ]::Android) \usr\lib\swift\android\*.a" " $ ( Get-SwiftSDK [OS ]::Android) \usr\lib\swift\android\$ ( $Platform .Architecture.LLVMName ) \"
3242+ Move-Item " $ ( Get-SwiftSDK [OS ]::Android) \usr\lib\swift\android\*.so" " $ ( Get-SwiftSDK [OS ]::Android) \usr\lib\swift\android\$ ( $Platform .Architecture.LLVMName ) \"
32413243 }
32423244 Install-Platform $AndroidSDKPlatforms Android
3243- Invoke-BuildStep Write-PlatformInfoPlist $Plat
3245+ Invoke-BuildStep Write-PlatformInfoPlist $Platform
32443246 }
32453247
32463248 # Build Macros for distribution
@@ -3308,9 +3310,9 @@ if (-not $IsCrossCompiling) {
33083310 if ($Test -contains " sourcekit-lsp" ) { Invoke-BuildStep Test-SourceKitLSP }
33093311
33103312 if ($Test -contains " swift" ) {
3311- foreach ($Plat in $AndroidSDKPlatforms ) {
3313+ foreach ($Platform in $AndroidSDKPlatforms ) {
33123314 try {
3313- Invoke-BuildStep Test-Runtime $Plat
3315+ Invoke-BuildStep Test-Runtime $Platform
33143316 } catch {}
33153317 }
33163318 }
0 commit comments