Skip to content

Commit f02a20c

Browse files
committed
Fix the SDK builds when the build arch isn't the first in WindowsSDKs
This fixes it so that the built compiler to run with the pinned runtime in building some of the SDK components so that the build doesn't fail due to yet-to-be-built runtimes even when the build arch isn't the first in the WindowsSDKs list.
1 parent 283ce7f commit f02a20c

File tree

1 file changed

+58
-37
lines changed

1 file changed

+58
-37
lines changed

utils/build.ps1

Lines changed: 58 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ if ($PinnedBuild -eq "") {
171171
$PinnedVersion = "6.0.3"
172172
}
173173
"ARM64" {
174-
$PinnedBuild = "https://download.swift.org/swift-6.0.3-release/windows10-arm64/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE-windows10-arm64.exe"
175-
$PinnedSHA256 = "81474651E59A9955C9E6A389EF53ABD61631FFC62C63A2A02977271019E7C722"
176-
$PinnedVersion = "6.0.3"
174+
$PinnedBuild = "https://github.com/thebrowsercompany/swift-build/releases/download/swift-6.0.0-20241216.0/installer-arm64.exe"
175+
$PinnedSHA256 = "9007ABBA15E863206C35EDA3285CD31F9196E81C046DBA911E76282E78F3103F"
176+
$PinnedVersion = "6.0.0"
177177
}
178178
default { throw "Unsupported processor architecture" }
179179
}
@@ -1858,16 +1858,20 @@ function Build-Dispatch([Platform]$Platform, $Arch, [switch]$Test = $false) {
18581858
$InstallPath = "$($Arch.SDKInstallRoot)\usr"
18591859
}
18601860

1861-
Build-CMakeProject `
1862-
-Src $SourceCache\swift-corelibs-libdispatch `
1863-
-Bin (Get-TargetProjectBinaryCache $Arch Dispatch) `
1864-
-InstallTo $InstallPath `
1865-
-Arch $Arch `
1866-
-Platform $Platform `
1867-
-UseBuiltCompilers C,CXX,Swift `
1868-
-Defines @{
1869-
ENABLE_SWIFT = "YES";
1870-
}
1861+
Isolate-EnvVars {
1862+
$env:Path = "$(Get-CMarkBinaryCache $BuildArch)\src;$(Get-PinnedToolchainRuntime);${env:Path}"
1863+
1864+
Build-CMakeProject `
1865+
-Src $SourceCache\swift-corelibs-libdispatch `
1866+
-Bin (Get-TargetProjectBinaryCache $Arch Dispatch) `
1867+
-InstallTo $InstallPath `
1868+
-Arch $Arch `
1869+
-Platform $Platform `
1870+
-UseBuiltCompilers C,CXX,Swift `
1871+
-Defines @{
1872+
ENABLE_SWIFT = "YES";
1873+
}
1874+
}
18711875
}
18721876

18731877
function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
@@ -1919,6 +1923,8 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
19191923
(Get-Variable "${Platform}$($Arch.ShortName)" -ValueOnly).SDKInstallRoot
19201924
}
19211925

1926+
$env:Path = "$(Get-CMarkBinaryCache $BuildArch)\src;$(Get-PinnedToolchainRuntime);${env:Path}"
1927+
19221928
Build-CMakeProject `
19231929
-Src $SourceCache\swift-corelibs-foundation `
19241930
-Bin $FoundationBinaryCache `
@@ -1969,7 +1975,7 @@ function Build-FoundationMacros() {
19691975

19701976
$SwiftSDK = $null
19711977
if ($Build) {
1972-
$SwiftSDK = $BuildArch.SDKInstallRoot
1978+
$SwiftSDK = $(Get-PinnedToolchainSDK)
19731979
}
19741980

19751981
$InstallDir = $null
@@ -1985,18 +1991,24 @@ function Build-FoundationMacros() {
19851991
Get-HostProjectCMakeModules Compilers
19861992
}
19871993

1988-
Build-CMakeProject `
1989-
-Src $SourceCache\swift-foundation\Sources\FoundationMacros `
1990-
-Bin $FoundationMacrosBinaryCache `
1991-
-InstallTo:$InstallDir `
1992-
-Arch $Arch `
1993-
-Platform $Platform `
1994-
-UseBuiltCompilers Swift `
1995-
-SwiftSDK:$SwiftSDK `
1996-
-BuildTargets:$Targets `
1997-
-Defines @{
1998-
SwiftSyntax_DIR = $SwiftSyntaxCMakeModules;
1994+
Isolate-EnvVars {
1995+
if ($Build) {
1996+
$env:Path = "$(Get-CMarkBinaryCache $BuildArch)\src;$(Get-PinnedToolchainRuntime);${env:Path}"
19991997
}
1998+
1999+
Build-CMakeProject `
2000+
-Src $SourceCache\swift-foundation\Sources\FoundationMacros `
2001+
-Bin $FoundationMacrosBinaryCache `
2002+
-InstallTo:$InstallDir `
2003+
-Arch $Arch `
2004+
-Platform $Platform `
2005+
-UseBuiltCompilers Swift `
2006+
-SwiftSDK:$SwiftSDK `
2007+
-BuildTargets:$Targets `
2008+
-Defines @{
2009+
SwiftSyntax_DIR = $SwiftSyntaxCMakeModules;
2010+
}
2011+
}
20002012
}
20012013

20022014
function Build-XCTest([Platform]$Platform, $Arch, [switch]$Test = $false) {
@@ -2020,6 +2032,7 @@ function Build-XCTest([Platform]$Platform, $Arch, [switch]$Test = $false) {
20202032
$TestingDefines = @{ ENABLE_TESTING = "NO" }
20212033
$Targets = @("install")
20222034
$InstallPath = "$($Arch.XCTestInstallRoot)\usr"
2035+
$env:Path = "$(Get-CMarkBinaryCache $BuildArch)\src;$(Get-PinnedToolchainRuntime);${env:Path}"
20232036
}
20242037

20252038
Build-CMakeProject `
@@ -2051,6 +2064,8 @@ function Build-Testing([Platform]$Platform, $Arch, [switch]$Test = $false) {
20512064
$InstallPath = "$($Arch.SwiftTestingInstallRoot)\usr"
20522065
}
20532066

2067+
$env:Path = "$(Get-CMarkBinaryCache $BuildArch)\src;$(Get-PinnedToolchainRuntime);${env:Path}"
2068+
20542069
Build-CMakeProject `
20552070
-Src $SourceCache\swift-testing `
20562071
-Bin $SwiftTestingBinaryCache `
@@ -2605,7 +2620,7 @@ function Build-TestingMacros() {
26052620

26062621
$SwiftSDK = $null
26072622
if ($Build) {
2608-
$SwiftSDK = $BuildArch.SDKInstallRoot
2623+
$SwiftSDK = $(Get-PinnedToolchainSDK)
26092624
}
26102625

26112626
$Targets = if ($Build) {
@@ -2627,18 +2642,24 @@ function Build-TestingMacros() {
26272642
Get-HostProjectCMakeModules Compilers
26282643
}
26292644

2630-
Build-CMakeProject `
2631-
-Src $SourceCache\swift-testing\Sources\TestingMacros `
2632-
-Bin $TestingMacrosBinaryCache `
2633-
-InstallTo:$InstallDir `
2634-
-Arch $Arch `
2635-
-Platform $Platform `
2636-
-UseBuiltCompilers Swift `
2637-
-SwiftSDK:$SwiftSDK `
2638-
-BuildTargets:$Targets `
2639-
-Defines @{
2640-
SwiftSyntax_DIR = $SwiftSyntaxCMakeModules;
2645+
Isolate-EnvVars {
2646+
if ($Build) {
2647+
$env:Path = "$(Get-CMarkBinaryCache $BuildArch)\src;$(Get-PinnedToolchainRuntime);${env:Path}"
26412648
}
2649+
2650+
Build-CMakeProject `
2651+
-Src $SourceCache\swift-testing\Sources\TestingMacros `
2652+
-Bin $TestingMacrosBinaryCache `
2653+
-InstallTo:$InstallDir `
2654+
-Arch $Arch `
2655+
-Platform $Platform `
2656+
-UseBuiltCompilers Swift `
2657+
-SwiftSDK:$SwiftSDK `
2658+
-BuildTargets:$Targets `
2659+
-Defines @{
2660+
SwiftSyntax_DIR = $SwiftSyntaxCMakeModules;
2661+
}
2662+
}
26422663
}
26432664

26442665
function Install-HostToolchain() {

0 commit comments

Comments
 (0)