@@ -191,9 +191,9 @@ if ($PinnedBuild -eq "") {
191
191
$PinnedVersion = " 6.0.3"
192
192
}
193
193
" ARM64" {
194
- $PinnedBuild = " https://download.swift.org/swift-6.0.3-release/windows10-arm64/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE-windows10 -arm64.exe"
194
+ $PinnedBuild = " https://download.swift.org/installer -arm64.exe"
195
195
$PinnedSHA256 = " 81474651E59A9955C9E6A389EF53ABD61631FFC62C63A2A02977271019E7C722"
196
- $PinnedVersion = " 6.0.3 "
196
+ $PinnedVersion = " 6.0.0 "
197
197
}
198
198
default { throw " Unsupported processor architecture" }
199
199
}
@@ -557,6 +557,7 @@ function Invoke-Program() {
557
557
[string ] $Executable ,
558
558
[switch ] $OutNull = $false ,
559
559
[string ] $OutFile = " " ,
560
+ [string ] $ErrorFile = " " ,
560
561
[Parameter (Position = 1 , ValueFromRemainingArguments )]
561
562
[string []] $Args
562
563
)
@@ -588,13 +589,20 @@ function Invoke-Program() {
588
589
} elseif (" " -ne $OutFile ) {
589
590
$OutputLine += " > `" $OutFile `" "
590
591
}
592
+ if (" " -ne $ErrorFile ) {
593
+ $OutputLine += " > `" $ErrorFile `" "
594
+ }
591
595
592
596
Write-Output $OutputLine
593
597
} else {
594
598
if ($OutNull ) {
595
599
& $Executable @Args | Out-Null
600
+ } elseif (" " -ne $OutFile -and " " -ne $ErrorFile ) {
601
+ & $Executable @Args > $OutFile 2> $ErrorFile
596
602
} elseif (" " -ne $OutFile ) {
597
- & $Executable @Args | Out-File - Encoding UTF8 $OutFile
603
+ & $Executable @Args > $OutFile
604
+ } elseif (" " -ne $ErrorFile ) {
605
+ & $Executable @Args 2> $ErrorFile
598
606
} else {
599
607
& $Executable @Args
600
608
}
@@ -1811,9 +1819,17 @@ function Build-mimalloc() {
1811
1819
foreach ($Tool in $Tools ) {
1812
1820
$Binary = [IO.Path ]::Combine($Arch.ToolchainInstallRoot , " usr" , " bin" , $Tool )
1813
1821
# Binary-patch in place
1814
- Start-Process - Wait - WindowStyle Hidden - FilePath " $SourceCache \mimalloc\bin\minject$BuildSuffix " - ArgumentList @ ( " -f" , " -i" , " -v" , " $Binary " )
1822
+ Invoke-Program " $SourceCache \mimalloc\bin\minject$BuildSuffix " " -f" " -i" " -v" " $Binary "
1815
1823
# Log the import table
1816
- Start-Process - Wait - WindowStyle Hidden - FilePath " $SourceCache \mimalloc\bin\minject$BuildSuffix " - ArgumentList @ (" -l" , " $Binary " )
1824
+ $LogFile = " $BinaryCache \$ ( $Arch.LLVMTarget ) \mimalloc\minject-log-$Tool .txt"
1825
+ $ErrorFile = " $BinaryCache \$ ( $Arch.LLVMTarget ) \mimalloc\minject-log-$Tool -error.txt"
1826
+ Invoke-Program " $SourceCache \mimalloc\bin\minject$BuildSuffix " " -l" " $Binary " - OutFile $LogFile 2> $ErrorFile
1827
+ # Verify patching
1828
+ $Found = Select-String - Path $LogFile - Pattern " mimalloc"
1829
+ if (-not $Found ) {
1830
+ Get-Content $ErrorFile
1831
+ throw " Failed to patch mimalloc for $Tool "
1832
+ }
1817
1833
}
1818
1834
}
1819
1835
0 commit comments