@@ -544,7 +544,6 @@ function Get-InstallDir([Hashtable] $Platform) {
544
544
} elseif (($HostPlatform -eq $KnownPlatforms [" WindowsARM64" ]) -and ($Platform -eq $KnownPlatforms [" WindowsX64" ])) {
545
545
# x64 programs actually install under "Program Files" on arm64,
546
546
# but this would conflict with the native installation.
547
-
548
547
$ProgramFilesName = " Program Files (Amd64)"
549
548
} else {
550
549
# arm64 cannot be installed on x64
@@ -1069,9 +1068,9 @@ function Get-Dependencies {
1069
1068
$WinSDKPlatforms += $HostPlatform
1070
1069
}
1071
1070
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 "
1075
1074
}
1076
1075
}
1077
1076
}
@@ -1105,7 +1104,8 @@ function Get-PinnedToolchainToolsDir() {
1105
1104
return $VariantToolchainPath
1106
1105
}
1107
1106
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" )
1109
1109
}
1110
1110
1111
1111
function Get-PinnedToolchainSDK () {
@@ -1161,12 +1161,14 @@ function Get-PlatformRoot([OS] $OS) {
1161
1161
return ([IO.Path ]::Combine((Get-InstallDir $HostPlatform ), " Platforms" , " $ ( $OS.ToString ()) .platform" ))
1162
1162
}
1163
1163
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" ))
1170
1172
}
1171
1173
1172
1174
function Build-CMakeProject {
@@ -2285,7 +2287,7 @@ function Build-ExperimentalRuntime {
2285
2287
Build-CMakeProject `
2286
2288
- Src $SourceCache \swift\Runtimes\Core `
2287
2289
- Bin (Get-ProjectBinaryCache $Platform ExperimentalRuntime) `
2288
- - InstallTo " $ ( Get-SwiftSDK $Platform.OS - Experimental) \usr" `
2290
+ - InstallTo " $ ( Get-SwiftSDK $Platform.OS - Identifier " $ ( $Platform .OS ) Experimental" ) \usr" `
2289
2291
- Platform $Platform `
2290
2292
- UseBuiltCompilers C, CXX, Swift `
2291
2293
- UseGNUDriver `
@@ -2376,7 +2378,7 @@ function Build-Foundation {
2376
2378
Build-CMakeProject `
2377
2379
- Src $SourceCache \swift- corelibs- foundation `
2378
2380
- 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" }) `
2380
2382
- Platform $Platform `
2381
2383
- UseBuiltCompilers ASM, C, CXX, Swift `
2382
2384
- SwiftSDK (Get-SwiftSDK $Platform.OS ) `
@@ -2539,11 +2541,11 @@ function Install-Platform([Hashtable[]] $Platforms, [OS] $OS) {
2539
2541
}
2540
2542
2541
2543
# 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 {
2545
2547
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 ) "
2547
2549
}
2548
2550
}
2549
2551
}
@@ -3110,10 +3112,10 @@ function Build-Installer([Hashtable] $Platform) {
3110
3112
}
3111
3113
}
3112
3114
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) \"
3117
3119
}
3118
3120
3119
3121
Build-WiXProject bundle\installer.wixproj - Platform $Platform - Bundle - Properties $Properties
@@ -3122,10 +3124,10 @@ function Build-Installer([Hashtable] $Platform) {
3122
3124
function Copy-BuildArtifactsToStage ([Hashtable ] $Platform ) {
3123
3125
Copy-File " $BinaryCache \$ ( $Platform.Triple ) \installer\Release\$ ( $Platform.Architecture.VSName ) \*.cab" $Stage
3124
3126
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
3129
3131
}
3130
3132
Copy-File " $BinaryCache \$ ( $Platform.Triple ) \installer\Release\$ ( $Platform.Architecture.VSName ) \installer.exe" $Stage
3131
3133
# Extract installer engine to ease code-signing on swift.org CI
@@ -3147,11 +3149,11 @@ if ($Clean) {
3147
3149
3148
3150
# In case of a previous test run, clear out the swiftmodules as they are not a stable format.
3149
3151
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
3152
3154
}
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
3155
3157
}
3156
3158
3157
3159
Remove-Item - Force - Recurse ([IO.Path ]::Combine((Get-InstallDir $HostPlatform ), " Runtimes" , $ProductVersion )) - ErrorAction Ignore
@@ -3178,69 +3180,69 @@ if (-not $SkipBuild) {
3178
3180
Invoke-BuildStep Build-XML2 $HostPlatform
3179
3181
Invoke-BuildStep Build-Compilers $HostPlatform
3180
3182
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
3186
3188
3187
3189
# 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
3190
3192
# 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 ) {
3192
3194
Invoke-BuildStep Build-FoundationMacros $BuildPlatform
3193
3195
Invoke-BuildStep Build-TestingMacros $BuildPlatform
3194
3196
}
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
3200
3202
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
3203
3205
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 ) {
3206
3208
Copy-Directory " $ ( Get-SwiftSDK Windows) \usr\bin" " $ ( [IO.Path ]::Combine((Get-InstallDir $HostPlatform ), " Runtimes" , $ProductVersion )) \usr"
3207
3209
}
3208
3210
}
3209
3211
Install-Platform $WindowsSDKPlatforms Windows
3210
3212
Invoke-BuildStep Write-PlatformInfoPlist $HostPlatform
3211
3213
3212
3214
if ($Android ) {
3213
- foreach ($Plat in $AndroidSDKPlatforms ) {
3215
+ foreach ($Platform in $AndroidSDKPlatforms ) {
3214
3216
if ($IncludeDS2 ) {
3215
- Invoke-BuildStep Build-DS2 $Plat
3217
+ Invoke-BuildStep Build-DS2 $Platform
3216
3218
}
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
3221
3223
3222
3224
# 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
3229
3231
3230
3232
# 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
3233
3235
}
3234
- Invoke-BuildStep Write-SDKSettingsPlist $Plat
3236
+ Invoke-BuildStep Write-SDKSettingsPlist $Platform
3235
3237
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
3238
3240
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 ) \"
3241
3243
}
3242
3244
Install-Platform $AndroidSDKPlatforms Android
3243
- Invoke-BuildStep Write-PlatformInfoPlist $Plat
3245
+ Invoke-BuildStep Write-PlatformInfoPlist $Platform
3244
3246
}
3245
3247
3246
3248
# Build Macros for distribution
@@ -3308,9 +3310,9 @@ if (-not $IsCrossCompiling) {
3308
3310
if ($Test -contains " sourcekit-lsp" ) { Invoke-BuildStep Test-SourceKitLSP }
3309
3311
3310
3312
if ($Test -contains " swift" ) {
3311
- foreach ($Plat in $AndroidSDKPlatforms ) {
3313
+ foreach ($Platform in $AndroidSDKPlatforms ) {
3312
3314
try {
3313
- Invoke-BuildStep Test-Runtime $Plat
3315
+ Invoke-BuildStep Test-Runtime $Platform
3314
3316
} catch {}
3315
3317
}
3316
3318
}
0 commit comments