Skip to content

Commit 000fd24

Browse files
committed
build: final preparations for adding Android SDK support
Remove some hardcoded globals which assumed that builds were always for the same OS. With the introduction of Android SDK support, we will no longer be able to hold to that.
1 parent 63c0bf3 commit 000fd24

File tree

1 file changed

+67
-53
lines changed

1 file changed

+67
-53
lines changed

utils/build.ps1

Lines changed: 67 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -227,14 +227,10 @@ $NugetRoot = "$BinaryCache\nuget"
227227
$PinnedToolchain = [IO.Path]::GetFileNameWithoutExtension($PinnedBuild)
228228

229229
$LibraryRoot = "$ImageRoot\Library"
230-
$ToolchainInstallRoot = "$(Get-InstallDir $HostArch)\Toolchains\$ProductVersion+Asserts"
231-
$PlatformInstallRoot = "$(Get-InstallDir $HostArch)\Platforms\Windows.platform"
232-
$RuntimeInstallRoot = "$(Get-InstallDir $HostArch)\Runtimes\$ProductVersion"
233-
$SDKInstallRoot = "$PlatformInstallRoot\Developer\SDKs\Windows.sdk"
234230

235231
# For dev productivity, install the host toolchain directly using CMake.
236232
# This allows iterating on the toolchain using ninja builds.
237-
$HostArch.ToolchainInstallRoot = $ToolchainInstallRoot
233+
$HostArch.ToolchainInstallRoot = "$(Get-InstallDir $HostArch)\Toolchains\$ProductVersion+Asserts"
238234

239235
# Resolve the architectures received as argument
240236
$WindowsSDKArchs = @($WindowsSDKs | ForEach-Object {
@@ -594,9 +590,9 @@ function Build-CMakeProject {
594590

595591
if ($ToBatch) {
596592
Write-Output ""
597-
Write-Output "echo Building '$Src' to '$Bin' for arch '$($Arch.ShortName)'..."
593+
Write-Output "echo Building '$Src' to '$Bin' for arch '$($Arch.LLVMName)'..."
598594
} else {
599-
Write-Host -ForegroundColor Cyan "[$([DateTime]::Now.ToString("yyyy-MM-dd HH:mm:ss"))] Building '$Src' to '$Bin' for arch '$($Arch.ShortName)'..."
595+
Write-Host -ForegroundColor Cyan "[$([DateTime]::Now.ToString("yyyy-MM-dd HH:mm:ss"))] Building '$Src' to '$Bin' for arch '$($Arch.LLVMName)'..."
600596
}
601597

602598
$Stopwatch = [Diagnostics.Stopwatch]::StartNew()
@@ -787,7 +783,7 @@ function Build-CMakeProject {
787783
}
788784

789785
if ($UseBuiltCompilers.Contains("Swift")) {
790-
$env:Path = "$($HostArch.SDKInstallRoot)\usr\bin;$ToolchainInstallRoot\usr\bin;${env:Path}"
786+
$env:Path = "$($HostArch.SDKInstallRoot)\usr\bin;$($HostArch.ToolchainInstallRoot)\usr\bin;${env:Path}"
791787
}
792788
Invoke-Program cmake.exe @cmakeGenerateArgs
793789

@@ -806,13 +802,13 @@ function Build-CMakeProject {
806802
}
807803

808804
if (-not $ToBatch) {
809-
Write-Host -ForegroundColor Cyan "[$([DateTime]::Now.ToString("yyyy-MM-dd HH:mm:ss"))] Finished building '$Src' to '$Bin' for arch '$($Arch.ShortName)' in $($Stopwatch.Elapsed)"
805+
Write-Host -ForegroundColor Cyan "[$([DateTime]::Now.ToString("yyyy-MM-dd HH:mm:ss"))] Finished building '$Src' to '$Bin' for arch '$($Arch.LLVMName)' in $($Stopwatch.Elapsed)"
810806
Write-Host ""
811807
}
812808

813809
if ($Summary) {
814810
$TimingData.Add([PSCustomObject]@{
815-
Arch = $Arch.ShortName
811+
Arch = $Arch.LLVMName
816812
Checkout = $Src.Replace($SourceCache, '')
817813
BuildID = Split-Path -Path $Bin -Leaf
818814
"Elapsed Time" = $Stopwatch.Elapsed.ToString()
@@ -833,15 +829,18 @@ function Build-SPMProject {
833829

834830
if ($ToBatch) {
835831
Write-Output ""
836-
Write-Output "echo Building '$Src' to '$Bin' for arch '$($Arch.ShortName)'..."
832+
Write-Output "echo Building '$Src' to '$Bin' for arch '$($Arch.LLVMName)'..."
837833
} else {
838-
Write-Host -ForegroundColor Cyan "[$([DateTime]::Now.ToString("yyyy-MM-dd HH:mm:ss"))] Building '$Src' to '$Bin' for arch '$($Arch.ShortName)'..."
834+
Write-Host -ForegroundColor Cyan "[$([DateTime]::Now.ToString("yyyy-MM-dd HH:mm:ss"))] Building '$Src' to '$Bin' for arch '$($Arch.LLVMName)'..."
839835
}
840836

841837
$Stopwatch = [Diagnostics.Stopwatch]::StartNew()
842838

843839
Isolate-EnvVars {
844-
$env:Path = "$RuntimeInstallRoot\usr\bin;$ToolchainInstallRoot\usr\bin;${env:Path}"
840+
$SDKInstallRoot = [IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "Windows.platform", "Developer", "SDKs", "Windows.sdk")
841+
$RuntimeInstallRoot = [IO.Path]::Combine((Get-InstallDir $HostArch), "Runtimes", $ProductVersion)
842+
843+
$env:Path = "$RuntimeInstallRoot\usr\bin;$($HostArch.ToolchainInstallRoot)\usr\bin;${env:Path}"
845844
$env:SDKROOT = $SDKInstallRoot
846845

847846
$Arguments = @(
@@ -864,17 +863,17 @@ function Build-SPMProject {
864863
}
865864

866865
$Action = if ($Test) { "test" } else { "build" }
867-
Invoke-Program "$ToolchainInstallRoot\usr\bin\swift.exe" $Action @Arguments @AdditionalArguments
866+
Invoke-Program "$($HostArch.ToolchainInstallRoot)\usr\bin\swift.exe" $Action @Arguments @AdditionalArguments
868867
}
869868

870869
if (-not $ToBatch) {
871-
Write-Host -ForegroundColor Cyan "[$([DateTime]::Now.ToString("yyyy-MM-dd HH:mm:ss"))] Finished building '$Src' to '$Bin' for arch '$($Arch.ShortName)' in $($Stopwatch.Elapsed)"
870+
Write-Host -ForegroundColor Cyan "[$([DateTime]::Now.ToString("yyyy-MM-dd HH:mm:ss"))] Finished building '$Src' to '$Bin' for arch '$($Arch.LLVMName)' in $($Stopwatch.Elapsed)"
872871
Write-Host ""
873872
}
874873

875874
if ($Summary) {
876875
$TimingData.Add([PSCustomObject]@{
877-
Arch = $Arch.ShortName
876+
Arch = $Arch.LLVMName
878877
Checkout = $Src.Replace($SourceCache, '')
879878
BuildID = Split-Path -Path $Bin -Leaf
880879
"Elapsed Time" = $Stopwatch.Elapsed.ToString()
@@ -927,7 +926,7 @@ function Build-WiXProject() {
927926
}
928927

929928
function Build-CMark($Arch) {
930-
$ArchName = $Arch.ShortName
929+
$ArchName = $Arch.LLVMName
931930

932931
Build-CMakeProject `
933932
-Src $SourceCache\cmark `
@@ -1076,7 +1075,7 @@ function Build-LLVM([Platform]$Platform, $Arch) {
10761075
}
10771076

10781077
function Build-ZLib([Platform]$Platform, $Arch) {
1079-
$ArchName = $Arch.ShortName
1078+
$ArchName = $Arch.LLVMName
10801079

10811080
Build-CMakeProject `
10821081
-Src $SourceCache\zlib `
@@ -1092,7 +1091,7 @@ function Build-ZLib([Platform]$Platform, $Arch) {
10921091
}
10931092

10941093
function Build-XML2([Platform]$Platform, $Arch) {
1095-
$ArchName = $Arch.ShortName
1094+
$ArchName = $Arch.LLVMName
10961095

10971096
Build-CMakeProject `
10981097
-Src $SourceCache\libxml2 `
@@ -1115,7 +1114,7 @@ function Build-XML2([Platform]$Platform, $Arch) {
11151114
}
11161115

11171116
function Build-CURL([Platform]$Platform, $Arch) {
1118-
$ArchName = $Arch.ShortName
1117+
$ArchName = $Arch.LLVMName
11191118

11201119
Build-CMakeProject `
11211120
-Src $SourceCache\curl `
@@ -1208,7 +1207,7 @@ function Build-CURL([Platform]$Platform, $Arch) {
12081207
}
12091208

12101209
function Build-ICU([Platform]$Platform, $Arch) {
1211-
$ArchName = $Arch.ShortName
1210+
$ArchName = $Arch.LLVMName
12121211

12131212
if (-not $ToBatch) {
12141213
if (-not (Test-Path -Path "$SourceCache\icu\icu4c\CMakeLists.txt")) {
@@ -1294,7 +1293,7 @@ function Build-Dispatch([Platform]$Platform, $Arch, [switch]$Test = $false) {
12941293
function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
12951294
$DispatchBinaryCache = Get-TargetProjectBinaryCache $Arch Dispatch
12961295
$FoundationBinaryCache = Get-TargetProjectBinaryCache $Arch Foundation
1297-
$ShortArch = $Arch.ShortName
1296+
$ShortArch = $Arch.LLVMName
12981297

12991298
Isolate-EnvVars {
13001299
if ($Test) {
@@ -1375,17 +1374,20 @@ function Build-XCTest([Platform]$Platform, $Arch, [switch]$Test = $false) {
13751374
Foundation_DIR = "$FoundationBinaryCache\cmake\modules";
13761375
} + $TestingDefines)
13771376

1377+
$PList = [IO.Path]::Combine($Arch.BinaryCache, "${Platform}.platform".ToLower(), "Info.plist")
13781378
Invoke-Program $python -c "import plistlib; print(str(plistlib.dumps({ 'DefaultProperties': { 'XCTEST_VERSION': 'development', 'SWIFTC_FLAGS': ['-use-ld=lld'] } }), encoding='utf-8'))" `
1379-
-OutFile "$($Arch.PlatformInstallRoot)\Info.plist"
1379+
-OutFile "$PList"
13801380
}
13811381
}
13821382

13831383
# Copies files installed by CMake from the arch-specific platform root,
13841384
# where they follow the layout expected by the installer,
13851385
# to the final platform root, following the installer layout.
1386-
function Install-Platform($Arch) {
1386+
function Install-Platform([Platform]$Platform, $Arch) {
13871387
if ($ToBatch) { return }
13881388

1389+
$SDKInstallRoot = [IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "$Platform.platform", "Developer", "SDKs", "$Platform.sdk")
1390+
13891391
New-Item -ItemType Directory -ErrorAction Ignore $SDKInstallRoot\usr | Out-Null
13901392

13911393
# Copy SDK header files
@@ -1424,15 +1426,22 @@ function Install-Platform($Arch) {
14241426
}
14251427

14261428
# Copy plist files (same across architectures)
1427-
Copy-File "$($Arch.PlatformInstallRoot)\Info.plist" $PlatformInstallRoot\
1428-
Copy-File "$($Arch.SDKInstallRoot)\SDKSettings.plist" $SDKInstallRoot\
1429+
Copy-File "$($Arch.PlatformInstallRoot)\Info.plist" ([IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "${Platform}.platform"))
1430+
Copy-File "$($Arch.SDKInstallRoot)\SDKSettings.plist" ([IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "${Platform}.platform", "Developer", "SDKs", "${Platform}.sdk"))
14291431

14301432
# Copy XCTest
1431-
$XCTestInstallRoot = "$PlatformInstallRoot\Developer\Library\XCTest-development"
1432-
Copy-File "$($Arch.XCTestInstallRoot)\usr\bin\XCTest.dll" "$XCTestInstallRoot\usr\$($Arch.BinaryDir)\"
1433-
Copy-File "$($Arch.XCTestInstallRoot)\usr\lib\swift\windows\XCTest.lib" "$XCTestInstallRoot\usr\lib\swift\windows\$($Arch.LLVMName)\"
1434-
Copy-File "$($Arch.XCTestInstallRoot)\usr\lib\swift\windows\$($Arch.LLVMName)\XCTest.swiftmodule" "$XCTestInstallRoot\usr\lib\swift\windows\XCTest.swiftmodule\$($Arch.LLVMTarget).swiftmodule"
1435-
Copy-File "$($Arch.XCTestInstallRoot)\usr\lib\swift\windows\$($Arch.LLVMName)\XCTest.swiftdoc" "$XCTestInstallRoot\usr\lib\swift\windows\XCTest.swiftmodule\$($Arch.LLVMTarget).swiftdoc"
1433+
$XCTestInstallRoot = [IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "${Platform}.platform", "Developer", "Library", "XCTest-development")
1434+
switch ($Platform) {
1435+
Windows {
1436+
Copy-File "$($Arch.XCTestInstallRoot)\usr\bin\XCTest.dll" "$XCTestInstallRoot\usr\$($Arch.BinaryDir)\"
1437+
Copy-File "$($Arch.XCTestInstallRoot)\usr\lib\swift\windows\XCTest.lib" "$XCTestInstallRoot\usr\lib\swift\windows\$($Arch.LLVMName)\"
1438+
}
1439+
default {
1440+
Copy-File "$($Arch.XCTestInstallRoot)\usr\lib\libXCTest.so" "$XCTestInstallRoot\usr\lib\$($Arch.BinaryDir)\"
1441+
}
1442+
}
1443+
Copy-File "$($Arch.XCTestInstallRoot)\usr\lib\swift\$($Platform.ToString().ToLower())\$($Arch.LLVMName)\XCTest.swiftmodule" "$XCTestInstallRoot\usr\lib\swift\$($Platform.ToString().ToLower())\XCTest.swiftmodule\$($Arch.LLVMTarget).swiftmodule"
1444+
Copy-File "$($Arch.XCTestInstallRoot)\usr\lib\swift\$($Platform.ToString().ToLower())\$($Arch.LLVMName)\XCTest.swiftdoc" "$XCTestInstallRoot\usr\lib\swift\$($Platform.ToString().ToLower())\XCTest.swiftmodule\$($Arch.LLVMTarget).swiftdoc"
14361445
}
14371446

14381447
function Build-SQLite($Arch) {
@@ -1488,7 +1497,7 @@ function Build-System($Arch) {
14881497
-InstallTo "$($Arch.ToolchainInstallRoot)\usr" `
14891498
-Arch $Arch `
14901499
-UseBuiltCompilers C,Swift `
1491-
-SwiftSDK $SDKInstallRoot `
1500+
-SwiftSDK ([IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "Windows.platform", "Developer", "SDKs", "Windows.sdk")) `
14921501
-BuildTargets default `
14931502
-Defines @{
14941503
BUILD_SHARED_LIBS = "YES";
@@ -1502,7 +1511,7 @@ function Build-ToolsSupportCore($Arch) {
15021511
-InstallTo "$($Arch.ToolchainInstallRoot)\usr" `
15031512
-Arch $Arch `
15041513
-UseBuiltCompilers C,Swift `
1505-
-SwiftSDK $SDKInstallRoot `
1514+
-SwiftSDK ([IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "Windows.platform", "Developer", "SDKs", "Windows.sdk")) `
15061515
-BuildTargets default `
15071516
-Defines @{
15081517
BUILD_SHARED_LIBS = "YES";
@@ -1539,7 +1548,7 @@ function Build-LLBuild($Arch, [switch]$Test = $false) {
15391548
-Arch $Arch `
15401549
-UseMSVCCompilers CXX `
15411550
-UseBuiltCompilers Swift `
1542-
-SwiftSDK $SDKInstallRoot `
1551+
-SwiftSDK ([IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "Windows.platform", "Developer", "SDKs", "Windows.sdk")) `
15431552
-BuildTargets $Targets `
15441553
-Defines ($TestingDefines + @{
15451554
BUILD_SHARED_LIBS = "YES";
@@ -1556,7 +1565,7 @@ function Build-Yams($Arch) {
15561565
-Bin (Get-HostProjectBinaryCache Yams) `
15571566
-Arch $Arch `
15581567
-UseBuiltCompilers Swift `
1559-
-SwiftSDK $SDKInstallRoot `
1568+
-SwiftSDK ([IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "Windows.platform", "Developer", "SDKs", "Windows.sdk")) `
15601569
-BuildTargets default `
15611570
-Defines @{
15621571
BUILD_SHARED_LIBS = "NO";
@@ -1571,7 +1580,7 @@ function Build-ArgumentParser($Arch) {
15711580
-InstallTo "$($Arch.ToolchainInstallRoot)\usr" `
15721581
-Arch $Arch `
15731582
-UseBuiltCompilers Swift `
1574-
-SwiftSDK $SDKInstallRoot `
1583+
-SwiftSDK ([IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "Windows.platform", "Developer", "SDKs", "Windows.sdk")) `
15751584
-BuildTargets default `
15761585
-Defines @{
15771586
BUILD_SHARED_LIBS = "YES";
@@ -1586,7 +1595,7 @@ function Build-Driver($Arch) {
15861595
-InstallTo "$($Arch.ToolchainInstallRoot)\usr" `
15871596
-Arch $Arch `
15881597
-UseBuiltCompilers Swift `
1589-
-SwiftSDK $SDKInstallRoot `
1598+
-SwiftSDK ([IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "Windows.platform", "Developer", "SDKs", "Windows.sdk")) `
15901599
-BuildTargets default `
15911600
-Defines @{
15921601
BUILD_SHARED_LIBS = "YES";
@@ -1606,7 +1615,7 @@ function Build-Crypto($Arch) {
16061615
-Bin (Get-HostProjectBinaryCache Crypto) `
16071616
-Arch $Arch `
16081617
-UseBuiltCompilers Swift `
1609-
-SwiftSDK $SDKInstallRoot `
1618+
-SwiftSDK ([IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "Windows.platform", "Developer", "SDKs", "Windows.sdk")) `
16101619
-BuildTargets default `
16111620
-Defines @{
16121621
BUILD_SHARED_LIBS = "NO";
@@ -1620,7 +1629,7 @@ function Build-Collections($Arch) {
16201629
-InstallTo "$($Arch.ToolchainInstallRoot)\usr" `
16211630
-Arch $Arch `
16221631
-UseBuiltCompilers Swift `
1623-
-SwiftSDK $SDKInstallRoot `
1632+
-SwiftSDK ([IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "Windows.platform", "Developer", "SDKs", "Windows.sdk")) `
16241633
-BuildTargets default `
16251634
-Defines @{
16261635
BUILD_SHARED_LIBS = "YES";
@@ -1633,7 +1642,7 @@ function Build-ASN1($Arch) {
16331642
-Bin (Get-HostProjectBinaryCache ASN1) `
16341643
-Arch $Arch `
16351644
-UseBuiltCompilers Swift `
1636-
-SwiftSDK $SDKInstallRoot `
1645+
-SwiftSDK ([IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "Windows.platform", "Developer", "SDKs", "Windows.sdk")) `
16371646
-BuildTargets default `
16381647
-Defines @{
16391648
BUILD_SHARED_LIBS = "NO";
@@ -1646,7 +1655,7 @@ function Build-Certificates($Arch) {
16461655
-Bin (Get-HostProjectBinaryCache Certificates) `
16471656
-Arch $Arch `
16481657
-UseBuiltCompilers Swift `
1649-
-SwiftSDK $SDKInstallRoot `
1658+
-SwiftSDK ([IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "Windows.platform", "Developer", "SDKs", "Windows.sdk")) `
16501659
-BuildTargets default `
16511660
-Defines @{
16521661
BUILD_SHARED_LIBS = "NO";
@@ -1668,7 +1677,7 @@ function Build-PackageManager($Arch) {
16681677
-InstallTo "$($Arch.ToolchainInstallRoot)\usr" `
16691678
-Arch $Arch `
16701679
-UseBuiltCompilers C,Swift `
1671-
-SwiftSDK $SDKInstallRoot `
1680+
-SwiftSDK ([IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "Windows.platform", "Developer", "SDKs", "Windows.sdk")) `
16721681
-BuildTargets default `
16731682
-Defines @{
16741683
BUILD_SHARED_LIBS = "YES";
@@ -1694,7 +1703,7 @@ function Build-Markdown($Arch) {
16941703
-InstallTo "$($Arch.ToolchainInstallRoot)\usr" `
16951704
-Arch $Arch `
16961705
-UseBuiltCompilers Swift `
1697-
-SwiftSDK $SDKInstallRoot `
1706+
-SwiftSDK ([IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "Windows.platform", "Developer", "SDKs", "Windows.sdk")) `
16981707
-BuildTargets default `
16991708
-Defines @{
17001709
BUILD_SHARED_LIBS = "NO";
@@ -1711,7 +1720,7 @@ function Build-Format($Arch) {
17111720
-Arch $Arch `
17121721
-UseMSVCCompilers C `
17131722
-UseBuiltCompilers Swift `
1714-
-SwiftSDK $SDKInstallRoot `
1723+
-SwiftSDK ([IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "Windows.platform", "Developer", "SDKs", "Windows.sdk")) `
17151724
-BuildTargets default `
17161725
-Defines @{
17171726
BUILD_SHARED_LIBS = "YES";
@@ -1723,6 +1732,8 @@ function Build-Format($Arch) {
17231732
}
17241733

17251734
function Build-IndexStoreDB($Arch) {
1735+
$SDKInstallRoot = ([IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "Windows.platform", "Developer", "SDKs", "Windows.sdk"))
1736+
17261737
Build-CMakeProject `
17271738
-Src $SourceCache\indexstore-db `
17281739
-Bin (Get-HostProjectBinaryCache IndexStoreDB) `
@@ -1744,7 +1755,7 @@ function Build-SourceKitLSP($Arch) {
17441755
-InstallTo "$($Arch.ToolchainInstallRoot)\usr" `
17451756
-Arch $Arch `
17461757
-UseBuiltCompilers C,Swift `
1747-
-SwiftSDK $SDKInstallRoot `
1758+
-SwiftSDK ([IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "Windows.platform", "Developer", "SDKs", "Windows.sdk")) `
17481759
-BuildTargets default `
17491760
-Defines @{
17501761
SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
@@ -1767,20 +1778,21 @@ function Install-HostToolchain() {
17671778

17681779
# Restructure _InternalSwiftScan (keep the original one for the installer)
17691780
Copy-Item -Force `
1770-
$ToolchainInstallRoot\usr\lib\swift\_InternalSwiftScan `
1771-
$ToolchainInstallRoot\usr\include
1781+
"$($HostArch.ToolchainInstallRoot)\usr\lib\swift\_InternalSwiftScan" `
1782+
"$($HostArch.ToolchainInstallRoot)\usr\include"
17721783
Copy-Item -Force `
1773-
$ToolchainInstallRoot\usr\lib\swift\windows\_InternalSwiftScan.lib `
1774-
$ToolchainInstallRoot\usr\lib
1784+
"$($HostArch.ToolchainInstallRoot)\usr\lib\swift\windows\_InternalSwiftScan.lib" `
1785+
"$($HostArch.ToolchainInstallRoot)\usr\lib"
17751786

17761787
# Switch to swift-driver
17771788
$SwiftDriver = ([IO.Path]::Combine((Get-HostProjectBinaryCache Driver), "bin", "swift-driver.exe"))
1778-
Copy-Item -Force $SwiftDriver $ToolchainInstallRoot\usr\bin\swift.exe
1779-
Copy-Item -Force $SwiftDriver $ToolchainInstallRoot\usr\bin\swiftc.exe
1789+
Copy-Item -Force $SwiftDriver "$($HostArch.ToolchainInstallRoot)\usr\bin\swift.exe"
1790+
Copy-Item -Force $SwiftDriver "$($HostArch.ToolchainInstallRoot)\usr\bin\swiftc.exe"
17801791
}
17811792

17821793
function Build-Inspect() {
17831794
$OutDir = Join-Path -Path $HostArch.BinaryCache -ChildPath swift-inspect
1795+
$SDKInstallRoot = ([IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "Windows.platform", "Developer", "SDKs", "Windows.sdk")) `
17841796

17851797
Isolate-EnvVars {
17861798
$env:SWIFTCI_USE_LOCAL_DEPS=1
@@ -1912,13 +1924,15 @@ if (-not $SkipBuild) {
19121924

19131925
if (-not $ToBatch) {
19141926
if ($HostArch -in $WindowsSDKArchs) {
1927+
$RuntimeInstallRoot = [IO.Path]::Combine((Get-InstallDir $HostArch), "Runtimes", $ProductVersion)
1928+
19151929
Remove-Item -Force -Recurse $RuntimeInstallRoot -ErrorAction Ignore
19161930
Copy-Directory "$($HostArch.SDKInstallRoot)\usr\bin" "$RuntimeInstallRoot\usr"
19171931
}
19181932

1919-
Remove-Item -Force -Recurse $PlatformInstallRoot -ErrorAction Ignore
1933+
Remove-Item -Force -Recurse ([IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms")) -ErrorAction Ignore
19201934
foreach ($Arch in $WindowsSDKArchs) {
1921-
Install-Platform $Arch
1935+
Install-Platform Windows $Arch
19221936
}
19231937
}
19241938

0 commit comments

Comments
 (0)