Skip to content

Commit d6d4182

Browse files
committed
build.ps1: rename the extracted toolchain location
Strip the `swift-` prefix and the `-a-windows10` suffix on the toolchain. This allows us to get back within the path limits which otherwise prevents extracting the experimental SDK.
1 parent 75a6d10 commit d6d4182

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

utils/build.ps1

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ function Get-Dependencies {
10461046
Write-Output "Extracting '$InstallerExeName' ..."
10471047

10481048
# The new runtime MSI is built to expand files into the immediate directory. So, setup the installation location.
1049-
New-Item -ItemType Directory -ErrorAction Ignore $BinaryCache\toolchains\$PinnedToolchain\LocalApp\Programs\Swift\Runtimes\$(Get-PinnedToolchainVersion)\usr\bin | Out-Null
1049+
New-Item -ItemType Directory -ErrorAction Ignore $BinaryCache\toolchains\$ToolchainName\LocalApp\Programs\Swift\Runtimes\$(Get-PinnedToolchainVersion)\usr\bin | Out-Null
10501050
Invoke-Program "$($WiX.Path)\wix.exe" -- burn extract $BinaryCache\$InstallerExeName -out $BinaryCache\toolchains\ -outba $BinaryCache\toolchains\
10511051
Get-ChildItem "$BinaryCache\toolchains\WixAttachedContainer" -Filter "*.msi" | ForEach-Object {
10521052
$LogFile = [System.IO.Path]::ChangeExtension($_.Name, "log")
@@ -1091,7 +1091,7 @@ function Get-Dependencies {
10911091

10921092
# TODO(compnerd) stamp/validate that we need to re-extract
10931093
New-Item -ItemType Directory -ErrorAction Ignore $BinaryCache\toolchains | Out-Null
1094-
Extract-Toolchain "$PinnedToolchain.exe" $BinaryCache $PinnedToolchain
1094+
Extract-Toolchain "$PinnedToolchain.exe" $BinaryCache $PinnedToolchain.TrimStart("swift-").TrimEnd("-a-windows10")
10951095

10961096
function Get-KnownPython([string] $ArchName) {
10971097
if (-not $KnownPythons.ContainsKey($PythonVersion)) {
@@ -1213,7 +1213,9 @@ function Get-Dependencies {
12131213
}
12141214

12151215
function Get-PinnedToolchainToolsDir() {
1216-
$ToolchainsRoot = [IO.Path]::Combine("$BinaryCache\toolchains", "$PinnedToolchain", "LocalApp", "Programs", "Swift", "Toolchains")
1216+
$ToolchainName = $PinnedToolchain.TrimStart("swift-").TrimEnd("-a-windows10")
1217+
1218+
$ToolchainsRoot = [IO.Path]::Combine("$BinaryCache\toolchains", "$ToolchainName", "LocalApp", "Programs", "Swift", "Toolchains")
12171219

12181220
# NOTE: Add a workaround for the main snapshots that inadvertently used the
12191221
# wrong version when they were built. This allows use of the nightly snapshot
@@ -1232,19 +1234,23 @@ function Get-PinnedToolchainToolsDir() {
12321234
return $VariantToolchainPath
12331235
}
12341236

1235-
return [IO.Path]::Combine("$BinaryCache\", "toolchains", $PinnedToolchain,
1237+
return [IO.Path]::Combine("$BinaryCache\", "toolchains", $ToolchainName,
12361238
"Library", "Developer", "Toolchains",
12371239
"unknown-Asserts-development.xctoolchain", "usr", "bin")
12381240
}
12391241

12401242
function Get-PinnedToolchainSDK([OS] $OS = $BuildPlatform.OS, [string] $Identifier = $OS.ToString()) {
1241-
return [IO.Path]::Combine("$BinaryCache\", "toolchains", $PinnedToolchain,
1243+
$ToolchainName = $PinnedToolchain.TrimStart("swift-").TrimEnd("-a-windows10")
1244+
1245+
return [IO.Path]::Combine("$BinaryCache\", "toolchains", $ToolchainName,
12421246
"LocalApp", "Programs", "Swift", "Platforms", (Get-PinnedToolchainVersion),
12431247
"$($OS.ToString()).platform", "Developer", "SDKs", "$Identifier.sdk")
12441248
}
12451249

12461250
function Get-PinnedToolchainRuntime() {
1247-
return [IO.Path]::Combine("$BinaryCache\", "toolchains", $PinnedToolchain,
1251+
$ToolchainName = $PinnedToolchain.TrimStart("swift-").TrimEnd("-a-windows10")
1252+
1253+
return [IO.Path]::Combine("$BinaryCache\", "toolchains", $ToolchainName,
12481254
"LocalApp", "Programs", "Swift", "Runtimes", (Get-PinnedToolchainVersion),
12491255
"usr", "bin")
12501256
}

0 commit comments

Comments
 (0)