Skip to content

Commit 375bc35

Browse files
authored
Merge pull request #79765 from compnerd/invocation
utils: cleanup module triple computation
2 parents f636aa0 + 0bb5ec7 commit 375bc35

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

utils/build.ps1

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -521,30 +521,21 @@ function Get-TargetInfo($Arch) {
521521
# Cache the result of "swift -print-target-info" as $Arch.Cache.TargetInfo
522522
$CacheKey = "TargetInfo"
523523
if (-not $Arch.Cache.ContainsKey($CacheKey)) {
524-
$CompilersBinaryCache = if ($IsCrossCompiling) {
525-
Get-BuildProjectBinaryCache Compilers
526-
} else {
527-
Get-HostProjectBinaryCache Compilers
528-
}
529-
$ToolchainBinDir = Join-Path -Path $CompilersBinaryCache -ChildPath "bin"
530-
$CMarkDir = Join-Path -Path (Get-CMarkBinaryCache $BuildArch) -ChildPath "src"
531-
$SwiftExe = Join-Path -Path $ToolchainBinDir -ChildPath "swift.exe"
532524
Isolate-EnvVars {
533-
$env:Path = "$ToolchainBinDir;$CMarkDir;$(Get-PinnedToolchainRuntime);${env:Path}"
534-
$TargetInfoJson = & $SwiftExe -target $Arch.LLVMTarget -print-target-info
525+
$env:Path = "$(Get-PinnedToolchainRuntime);$(Get-PinnedToolchainToolsDir);${env:Path}"
526+
$TargetInfo = & swiftc -target $Arch.LLVMTarget -print-target-info
535527
if ($LastExitCode -ne 0) {
536-
throw "Unable to print target info for $($Arch.LLVMTarget) $TargetInfoJson"
528+
throw "Unable to print target info for '$($Arch.LLVMTarget)'"
537529
}
538-
$TargetInfo = $TargetInfoJson | ConvertFrom-Json
530+
$TargetInfo = $TargetInfo | ConvertFrom-JSON
539531
$Arch.Cache[$CacheKey] = $TargetInfo.target
540532
}
541533
}
542534
return $Arch.Cache[$CacheKey]
543535
}
544536

545537
function Get-ModuleTriple($Arch) {
546-
$targetInfo = Get-TargetInfo -Arch $Arch
547-
return $targetInfo.moduleTriple
538+
return (Get-TargetInfo -Arch $Arch).moduleTriple
548539
}
549540

550541
function Copy-File($Src, $Dst) {

0 commit comments

Comments
 (0)