Skip to content

Commit 2ecf873

Browse files
committed
build.ps1: rename WindowsSDKPlatforms and AndroidSDKPlatforms
Rename these to `WindowsSDKBuilds` and `AndroidSDKBuilds`. This prepares for the new parameter/terminology: - `WindowsSDKs` {default, experimental}` - `WindowsSDKArchitectures` {arm64, x64, x86} - `AndroidSDKs` {default, experimental}` - `AndroidSDKArchitectures` {aarch64, armv7, i686, x86_64}
1 parent 4adccbd commit 2ecf873

File tree

1 file changed

+40
-39
lines changed

1 file changed

+40
-39
lines changed

utils/build.ps1

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ if ($Android -and ($HostPlatform -ne $KnownPlatforms["WindowsX64"])) {
492492
}
493493

494494
# Resolve the architectures received as argument
495-
$AndroidSDKPlatforms = @($AndroidSDKs | ForEach-Object {
495+
$AndroidSDKBuilds = @($AndroidSDKs | ForEach-Object {
496496
switch ($_) {
497497
"aarch64" { $KnownPlatforms["AndroidARM64"] }
498498
"armv7" { $KnownPlatforms["AndroidARMv7"] }
@@ -502,7 +502,7 @@ $AndroidSDKPlatforms = @($AndroidSDKs | ForEach-Object {
502502
}
503503
})
504504

505-
$WindowsSDKPlatforms = @($WindowsSDKs | ForEach-Object {
505+
$WindowsSDKBuilds = @($WindowsSDKs | ForEach-Object {
506506
switch ($_) {
507507
"X64" { $KnownPlatforms["WindowsX64"] }
508508
"X86" { $KnownPlatforms["WindowsX86"] }
@@ -1189,14 +1189,14 @@ function Get-Dependencies {
11891189
$script:CustomWinSDKRoot = "$NugetRoot\$Package.$WinSDKVersion\c"
11901190

11911191
# Install each required architecture package and move files under the base /lib directory.
1192-
$WinSDKPlatforms = $WindowsSDKPlatforms.Clone()
1193-
if (-not ($HostPlatform -in $WinSDKPlatforms)) {
1194-
$WinSDKPlatforms += $HostPlatform
1192+
$Builds = $WindowsSDKBuilds.Clone()
1193+
if (-not ($HostPlatform -in $Builds)) {
1194+
$Builds += $HostPlatform
11951195
}
11961196

1197-
foreach ($Platform in $WinSDKPlatforms) {
1198-
Invoke-Program nuget install $Package.$($Platform.Architecture.ShortName) -Version $WinSDKVersion -OutputDirectory $NugetRoot
1199-
Copy-Directory "$NugetRoot\$Package.$($Platform.Architecture.ShortName).$WinSDKVersion\c\*" "$CustomWinSDKRoot\lib\$WinSDKVersion"
1197+
foreach ($Build in $Builds) {
1198+
Invoke-Program nuget install $Package.$($Build.Architecture.ShortName) -Version $WinSDKVersion -OutputDirectory $NugetRoot
1199+
Copy-Directory "$NugetRoot\$Package.$($Build.Architecture.ShortName).$WinSDKVersion\c\*" "$CustomWinSDKRoot\lib\$WinSDKVersion"
12001200
}
12011201
}
12021202
}
@@ -2708,13 +2708,13 @@ function Write-SDKSettings([OS] $OS, [string] $Identifier = $OS.ToString()) {
27082708
$SDKSettings.SupportedTargets.windows.LLVMTargetVendor = "unknown"
27092709
$SDKSettings.SupportedTargets.windows.LLVMTargetSys = "windows"
27102710
$SDKSettings.SupportedTargets.windows.LLVMTargetTripleEnvironment = "msvc"
2711-
$SDKSettings.SupportedTargets.windows.Archs = $WindowsSDKPlatforms | ForEach-Object { $_.Architecture.LLVMName } | Sort-Object
2711+
$SDKSettings.SupportedTargets.windows.Archs = $WindowsSDKBuilds | ForEach-Object { $_.Architecture.LLVMName } | Sort-Object
27122712
}
27132713
Android {
27142714
$SDKSettings.SupportedTargets.android.LLVMTargetVendor = "unknown"
27152715
$SDKSettings.SupportedTargets.android.LLVMTargetSys = "linux"
27162716
$SDKSettings.SupportedTargets.android.LLVMTargetTripleEnvironment = "android${AndroidAPILevel}"
2717-
$SDKSettings.SupportedTargets.android.Archs = $AndroidSDKPlatforms | ForEach-Object { $_.Architecture.LLVMName } | Sort-Object
2717+
$SDKSettings.SupportedTargets.android.Archs = $AndroidSDKBuilds | ForEach-Object { $_.Architecture.LLVMName } | Sort-Object
27182718
}
27192719
}
27202720
$SDKSettings | ConvertTo-JSON -Depth 4 | Out-FIle -FilePath "$(Get-SwiftSDK $OS -Identifier $Identifier)\SDKSettings.json"
@@ -3610,11 +3610,11 @@ function Build-Installer([Hashtable] $Platform) {
36103610
}
36113611

36123612
$Properties["Platforms"] = "`"windows$(if ($Android) { ";android" })`"";
3613-
$Properties["AndroidArchitectures"] = "`"$(($AndroidSDKPlatforms | ForEach-Object { $_.Architecture.LLVMName }) -Join ";")`""
3614-
$Properties["WindowsArchitectures"] = "`"$(($WindowsSDKPlatforms | ForEach-Object { $_.Architecture.LLVMName }) -Join ";")`""
3613+
$Properties["AndroidArchitectures"] = "`"$(($AndroidSDKBuilds | ForEach-Object { $_.Architecture.LLVMName }) -Join ";")`""
3614+
$Properties["WindowsArchitectures"] = "`"$(($WindowsSDKBuilds | ForEach-Object { $_.Architecture.LLVMName }) -Join ";")`""
36153615
$Properties["ToolchainVariants"] = "`"asserts$(if ($IncludeNoAsserts) { ";noasserts" })`"";
3616-
foreach ($SDKPlatform in $WindowsSDKPlatforms) {
3617-
$Properties["WindowsRuntime$($SDKPlatform.Architecture.ShortName.ToUpperInvariant())"] = [IO.Path]::Combine((Get-InstallDir $SDKPlatform), "Runtimes", "$ProductVersion");
3616+
foreach ($Build in $WindowsSDKBuilds) {
3617+
$Properties["WindowsRuntime$($Build.Architecture.ShortName.ToUpperInvariant())"] = [IO.Path]::Combine((Get-InstallDir $Build), "Runtimes", "$ProductVersion");
36183618
}
36193619

36203620
Build-WiXProject bundle\installer.wixproj -Platform $Platform -Bundle -Properties $Properties
@@ -3623,8 +3623,8 @@ function Build-Installer([Hashtable] $Platform) {
36233623
function Copy-BuildArtifactsToStage([Hashtable] $Platform) {
36243624
Copy-File "$BinaryCache\$($Platform.Triple)\installer\Release\$($Platform.Architecture.VSName)\*.cab" $Stage
36253625
Copy-File "$BinaryCache\$($Platform.Triple)\installer\Release\$($Platform.Architecture.VSName)\*.msi" $Stage
3626-
foreach ($SDKPlatform in $WindowsSDKPlatforms) {
3627-
Copy-File "$BinaryCache\$($Platform.Triple)\installer\Release\$($SDKPlatform.Architecture.VSName)\*.msm" $Stage
3626+
foreach ($Build in $WindowsSDKBuilds) {
3627+
Copy-File "$BinaryCache\$($Platform.Triple)\installer\Release\$($Build.Architecture.VSName)\*.msm" $Stage
36283628
}
36293629
Copy-File "$BinaryCache\$($Platform.Triple)\installer\Release\$($Platform.Architecture.VSName)\installer.exe" $Stage
36303630
# Extract installer engine to ease code-signing on swift.org CI
@@ -3675,11 +3675,11 @@ Get-Dependencies
36753675
if ($Clean) {
36763676
Remove-Item -Force -Recurse -Path "$BinaryCache\$($BuildPlatform.Triple)\" -ErrorAction Ignore
36773677
Remove-Item -Force -Recurse -Path "$BinaryCache\$($HostPlatform.Triple)\" -ErrorAction Ignore
3678-
foreach ($Platform in $WindowsSDKPlatforms) {
3679-
Remove-Item -Force -Recurse -Path "$BinaryCache\$($Platform.Triple)\" -ErrorAction Ignore
3678+
foreach ($Build in $WindowsSDKBuilds) {
3679+
Remove-Item -Force -Recurse -Path "$BinaryCache\$($Build.Triple)\" -ErrorAction Ignore
36803680
}
3681-
foreach ($Platform in $AndroidSDKPlatforms) {
3682-
Remove-Item -Force -Recurse -Path "$BinaryCache\$($Platform.Triple)\" -ErrorAction Ignore
3681+
foreach ($Build in $AndroidSDKBuilds) {
3682+
Remove-Item -Force -Recurse -Path "$BinaryCache\$($Build.Triple)\" -ErrorAction Ignore
36833683
}
36843684
Remove-Item -Force -Recurse -Path "$BinaryCache\1" -ErrorAction Ignore
36853685
Remove-Item -Force -Recurse -Path "$BinaryCache\5" -ErrorAction Ignore
@@ -3709,55 +3709,55 @@ if (-not $SkipBuild) {
37093709

37103710
Invoke-BuildStep Build-SDK $BuildPlatform -IncludeMacros
37113711

3712-
foreach ($Platform in $WindowsSDKPlatforms) {
3713-
Invoke-BuildStep Build-SDK $Platform
3712+
foreach ($Build in $WindowsSDKBuilds) {
3713+
Invoke-BuildStep Build-SDK $Build
37143714

37153715
Get-ChildItem "$(Get-SwiftSDK Windows)\usr\lib\swift\windows" -Filter "*.lib" -File -ErrorAction Ignore | ForEach-Object {
37163716
Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory"
3717-
Move-Item $_.FullName "$(Get-SwiftSDK Windows)\usr\lib\swift\windows\$($Platform.Architecture.LLVMName)\" | Out-Null
3717+
Move-Item $_.FullName "$(Get-SwiftSDK Windows)\usr\lib\swift\windows\$($Build.Architecture.LLVMName)\" | Out-Null
37183718
}
37193719

3720-
Copy-Directory "$(Get-SwiftSDK Windows)\usr\bin" "$([IO.Path]::Combine((Get-InstallDir $Platform), "Runtimes", $ProductVersion, "usr"))"
3720+
Copy-Directory "$(Get-SwiftSDK Windows)\usr\bin" "$([IO.Path]::Combine((Get-InstallDir $Build), "Runtimes", $ProductVersion, "usr"))"
37213721

3722-
Invoke-BuildStep Build-ExperimentalSDK $Platform
3722+
Invoke-BuildStep Build-ExperimentalSDK $Build
37233723

37243724
Get-ChildItem "$(Get-SwiftSDK Windows -Identifier WindowsExperimental)\usr\lib\swift_static\windows" -Filter "*.lib" -File -ErrorAction Ignore | ForEach-Object {
37253725
Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory"
3726-
Move-Item $_.FullName "$(Get-SwiftSDK Windows -Identifier WindowsExperimental)\usr\lib\swift_static\windows\$($Platform.Architecture.LLVMName)\" | Out-Null
3726+
Move-Item $_.FullName "$(Get-SwiftSDK Windows -Identifier WindowsExperimental)\usr\lib\swift_static\windows\$($Build.Architecture.LLVMName)\" | Out-Null
37273727
}
37283728
}
37293729

37303730
Write-PlatformInfoPlist Windows
3731-
Install-SDK $WindowsSDKPlatforms
3731+
Install-SDK $WindowsSDKBuilds
37323732
Write-SDKSettings Windows
3733-
Install-SDK $WindowsSDKPlatforms -Identifier WindowsExperimental
3733+
Install-SDK $WindowsSDKBuilds -Identifier WindowsExperimental
37343734
Write-SDKSettings Windows -Identifier WindowsExperimental
37353735

37363736
if ($Android) {
3737-
foreach ($Platform in $AndroidSDKPlatforms) {
3738-
Invoke-BuildStep Build-SDK $Platform
3737+
foreach ($Build in $AndroidSDKBuilds) {
3738+
Invoke-BuildStep Build-SDK $Build
37393739

37403740
Get-ChildItem "$(Get-SwiftSDK Android)\usr\lib\swift\android" -File | Where-Object { $_.Name -match ".a$|.so$" } | ForEach-Object {
37413741
Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory"
3742-
Move-Item $_.FullName "$(Get-SwiftSDK Android)\usr\lib\swift\android\$($Platform.Architecture.LLVMName)\" | Out-Null
3742+
Move-Item $_.FullName "$(Get-SwiftSDK Android)\usr\lib\swift\android\$($Build.Architecture.LLVMName)\" | Out-Null
37433743
}
37443744

3745-
Invoke-BuildStep Build-ExperimentalSDK $Platform
3745+
Invoke-BuildStep Build-ExperimentalSDK $Build
37463746

37473747
Get-ChildItem "$(Get-SwiftSDK Android -Identifier AndroidExperimental)\usr\lib\swift_static\android" -File | Where-Object { $_.Name -match ".a$|.so$" } | ForEach-Object {
37483748
Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory"
3749-
Move-Item $_.FullName "$(Get-SwiftSDK Android -Identifier AndroidExperimental)\usr\lib\swift_static\android\$($Platform.Architecture.LLVMName)\" | Out-Null
3749+
Move-Item $_.FullName "$(Get-SwiftSDK Android -Identifier AndroidExperimental)\usr\lib\swift_static\android\$($Build.Architecture.LLVMName)\" | Out-Null
37503750
}
37513751
}
37523752

37533753
Write-PlatformInfoPlist Android
3754-
Install-SDK $AndroidSDKPlatforms
3754+
Install-SDK $AndroidSDKBuilds
37553755
Write-SDKSettings Android
3756-
Install-SDK $AndroidSDKPlatforms -Identifiers AndroidExperimental
3756+
Install-SDK $AndroidSDKBuilds -Identifiers AndroidExperimental
37573757
Write-SDKSettings Android -Identifier AndroidExperimental
37583758

37593759
# Android swift-inspect only supports 64-bit platforms.
3760-
$AndroidSDKPlatforms | Where-Object { @("arm64-v8a", "x86_64") -contains $_.Architecture.ABI } | ForEach-Object {
3760+
$AndroidSDKBuilds | Where-Object { @("arm64-v8a", "x86_64") -contains $_.Architecture.ABI } | ForEach-Object {
37613761
Invoke-BuildStep Build-Inspect $_
37623762
}
37633763
}
@@ -3834,10 +3834,11 @@ if (-not $IsCrossCompiling) {
38343834
if ($Test -contains "sourcekit-lsp") { Invoke-BuildStep Test-SourceKitLSP $BuildPlatform}
38353835

38363836
if ($Test -contains "swift") {
3837-
foreach ($Platform in $AndroidSDKPlatforms) {
3837+
foreach ($Build in $AndroidSDKBuilds) {
38383838
try {
3839-
Invoke-BuildStep Test-Runtime $Platform
3840-
} catch {}
3839+
Invoke-BuildStep Test-Runtime $Build
3840+
} catch {
3841+
}
38413842
}
38423843
}
38433844
}

0 commit comments

Comments
 (0)