Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions utils/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,8 @@ if (-not $PinnedBuild) {
}

$PinnedToolchain = [IO.Path]::GetFileNameWithoutExtension($PinnedBuild)
# Use a shorter name in paths to avoid going over the path length limit.
$ToolchainVersionIdentifier = $PinnedToolchain -replace 'swift-(.+?)-windows10.*', '$1'

if ($EnableCAS -and ($UseHostToolchain -or ($PinnedVersion -ne "0.0.0"))) {
throw "CAS currently requires using a main-branch pinned toolchain."
Expand Down Expand Up @@ -1400,7 +1402,7 @@ function Get-Dependencies {

# TODO(compnerd) stamp/validate that we need to re-extract
New-Item -ItemType Directory -ErrorAction Ignore $BinaryCache\toolchains | Out-Null
Extract-Toolchain "$PinnedToolchain.exe" $BinaryCache $PinnedToolchain.TrimStart("swift-").TrimEnd("-arm64").TrimEnd("-a-windows10")
Extract-Toolchain "$PinnedToolchain.exe" $BinaryCache $ToolchainVersionIdentifier
Write-Success "Swift Toolchain $PinnedVersion"

if ($Android) {
Expand Down Expand Up @@ -1454,9 +1456,7 @@ function Get-Dependencies {
}

function Get-PinnedToolchainToolsDir() {
$ToolchainName = $PinnedToolchain.TrimStart("swift-").TrimEnd("-a-windows10")

$ToolchainsRoot = [IO.Path]::Combine("$BinaryCache\toolchains", "$ToolchainName", "LocalApp", "Programs", "Swift", "Toolchains")
$ToolchainsRoot = [IO.Path]::Combine("$BinaryCache\toolchains", "$ToolchainVersionIdentifier", "LocalApp", "Programs", "Swift", "Toolchains")

# NOTE: Add a workaround for the main snapshots that inadvertently used the
# wrong version when they were built. This allows use of the nightly snapshot
Expand All @@ -1481,17 +1481,13 @@ function Get-PinnedToolchainToolsDir() {
}

function Get-PinnedToolchainSDK([OS] $OS = $BuildPlatform.OS, [string] $Identifier = $OS.ToString()) {
$ToolchainName = $PinnedToolchain.TrimStart("swift-").TrimEnd("-a-windows10")

return [IO.Path]::Combine("$BinaryCache\", "toolchains", $ToolchainName,
return [IO.Path]::Combine("$BinaryCache\", "toolchains", $ToolchainVersionIdentifier,
"LocalApp", "Programs", "Swift", "Platforms", (Get-PinnedToolchainVersion),
"$($OS.ToString()).platform", "Developer", "SDKs", "$Identifier.sdk")
}

function Get-PinnedToolchainRuntime() {
$ToolchainName = $PinnedToolchain.TrimStart("swift-").TrimEnd("-a-windows10")

return [IO.Path]::Combine("$BinaryCache\", "toolchains", $ToolchainName,
return [IO.Path]::Combine("$BinaryCache\", "toolchains", $ToolchainVersionIdentifier,
"LocalApp", "Programs", "Swift", "Runtimes", (Get-PinnedToolchainVersion),
"usr", "bin")
}
Expand Down