Skip to content

utils: cleanup module triple computation #79765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 4, 2025
Merged
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
19 changes: 5 additions & 14 deletions utils/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -521,30 +521,21 @@ function Get-TargetInfo($Arch) {
# Cache the result of "swift -print-target-info" as $Arch.Cache.TargetInfo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swift -> swiftc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is a failure, I'll update this, otherwise, I'll do that subsequently I think. I have a number of upcoming changes in the script.

$CacheKey = "TargetInfo"
if (-not $Arch.Cache.ContainsKey($CacheKey)) {
$CompilersBinaryCache = if ($IsCrossCompiling) {
Get-BuildProjectBinaryCache Compilers
} else {
Get-HostProjectBinaryCache Compilers
}
$ToolchainBinDir = Join-Path -Path $CompilersBinaryCache -ChildPath "bin"
$CMarkDir = Join-Path -Path (Get-CMarkBinaryCache $BuildArch) -ChildPath "src"
$SwiftExe = Join-Path -Path $ToolchainBinDir -ChildPath "swift.exe"
Isolate-EnvVars {
$env:Path = "$ToolchainBinDir;$CMarkDir;$(Get-PinnedToolchainRuntime);${env:Path}"
$TargetInfoJson = & $SwiftExe -target $Arch.LLVMTarget -print-target-info
$env:Path = "$(Get-PinnedToolchainRuntime);$(Get-PinnedToolchainToolsDir);${env:Path}"
$TargetInfo = & swiftc -target $Arch.LLVMTarget -print-target-info
if ($LastExitCode -ne 0) {
throw "Unable to print target info for $($Arch.LLVMTarget) $TargetInfoJson"
throw "Unable to print target info for '$($Arch.LLVMTarget)'"
}
$TargetInfo = $TargetInfoJson | ConvertFrom-Json
$TargetInfo = $TargetInfo | ConvertFrom-JSON
$Arch.Cache[$CacheKey] = $TargetInfo.target
}
}
return $Arch.Cache[$CacheKey]
}

function Get-ModuleTriple($Arch) {
$targetInfo = Get-TargetInfo -Arch $Arch
return $targetInfo.moduleTriple
return (Get-TargetInfo -Arch $Arch).moduleTriple
}

function Copy-File($Src, $Dst) {
Expand Down