@@ -571,6 +571,8 @@ if (-not $PinnedBuild) {
571571}
572572
573573$PinnedToolchain = [IO.Path ]::GetFileNameWithoutExtension($PinnedBuild )
574+ # Use a shorter name in paths to avoid going over the path length limit.
575+ $ToolchainVersionIdentifier = $PinnedToolchain -replace ' swift-(.+?)-windows10.*' , ' $1'
574576
575577if ($EnableCAS -and ($UseHostToolchain -or ($PinnedVersion -ne " 0.0.0" ))) {
576578 throw " CAS currently requires using a main-branch pinned toolchain."
@@ -1390,7 +1392,7 @@ function Get-Dependencies {
13901392
13911393 # TODO(compnerd) stamp/validate that we need to re-extract
13921394 New-Item - ItemType Directory - ErrorAction Ignore $BinaryCache \toolchains | Out-Null
1393- Extract- Toolchain " $PinnedToolchain .exe" $BinaryCache $PinnedToolchain .TrimStart ( " swift- " ).TrimEnd( " -arm64 " ).TrimEnd( " -a-windows10 " )
1395+ Extract- Toolchain " $PinnedToolchain .exe" $BinaryCache $ToolchainVersionIdentifier
13941396 Write-Success " Swift Toolchain $PinnedVersion "
13951397
13961398 if ($Android ) {
@@ -1444,9 +1446,7 @@ function Get-Dependencies {
14441446}
14451447
14461448function Get-PinnedToolchainToolsDir () {
1447- $ToolchainName = $PinnedToolchain.TrimStart (" swift-" ).TrimEnd(" -a-windows10" )
1448-
1449- $ToolchainsRoot = [IO.Path ]::Combine(" $BinaryCache \toolchains" , " $ToolchainName " , " LocalApp" , " Programs" , " Swift" , " Toolchains" )
1449+ $ToolchainsRoot = [IO.Path ]::Combine(" $BinaryCache \toolchains" , " $ToolchainVersionIdentifier " , " LocalApp" , " Programs" , " Swift" , " Toolchains" )
14501450
14511451 # NOTE: Add a workaround for the main snapshots that inadvertently used the
14521452 # wrong version when they were built. This allows use of the nightly snapshot
@@ -1471,17 +1471,13 @@ function Get-PinnedToolchainToolsDir() {
14711471}
14721472
14731473function Get-PinnedToolchainSDK ([OS ] $OS = $BuildPlatform.OS , [string ] $Identifier = $OS.ToString ()) {
1474- $ToolchainName = $PinnedToolchain.TrimStart (" swift-" ).TrimEnd(" -a-windows10" )
1475-
1476- return [IO.Path ]::Combine(" $BinaryCache \" , " toolchains" , $ToolchainName ,
1474+ return [IO.Path ]::Combine(" $BinaryCache \" , " toolchains" , $ToolchainVersionIdentifier ,
14771475 " LocalApp" , " Programs" , " Swift" , " Platforms" , (Get-PinnedToolchainVersion ),
14781476 " $ ( $OS.ToString ()) .platform" , " Developer" , " SDKs" , " $Identifier .sdk" )
14791477}
14801478
14811479function Get-PinnedToolchainRuntime () {
1482- $ToolchainName = $PinnedToolchain.TrimStart (" swift-" ).TrimEnd(" -a-windows10" )
1483-
1484- return [IO.Path ]::Combine(" $BinaryCache \" , " toolchains" , $ToolchainName ,
1480+ return [IO.Path ]::Combine(" $BinaryCache \" , " toolchains" , $ToolchainVersionIdentifier ,
14851481 " LocalApp" , " Programs" , " Swift" , " Runtimes" , (Get-PinnedToolchainVersion ),
14861482 " usr" , " bin" )
14871483}
0 commit comments