Skip to content

Commit

Permalink
[windows] download .zip deps
Browse files Browse the repository at this point in the history
`tar.exe` on GH runners is too old and doesn't support `.tar.xz`. Instead, download `.zip` files  and use PowerShell commands to extract them.
  • Loading branch information
nil4 committed Oct 21, 2024
1 parent 6f42eb7 commit 655696e
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions Scripts/windows/dependencies.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,21 @@ Set-StrictMode -Version Latest

$nmake = (Get-Command nmake.exe -ErrorAction Stop)
$swift = (Get-Command swift.exe -ErrorAction Stop)
$tar = (Get-Command $env:windir\system32\tar.exe -ErrorAction Stop)

$nmake,$swift,$tar | Format-Table -AutoSize -HideTableHeaders -Property Source
$nmake,$swift | Format-Table -AutoSize -HideTableHeaders -Property Source

exec { swift --version }
exec { & $tar --version }

$BIN_DIR = Join-Path $ROOT_PATH "bin" -Resolve

function download_and_extract([string]$repo, [string]$version, [string]$file) {
[string]$filename = "${file}-${version}.tar.xz"
[string]$filename = "${file}-${version}.zip"
if (-not (file_exists "${BIN_DIR}\${filename}")) {
exec { curl.exe -L -o "${BIN_DIR}\${filename}" "https://github.com/libtom/${repo}/releases/download/v${version}/${filename}" }
exec { curl.exe -sSL -o "${BIN_DIR}\${filename}" "https://github.com/libtom/${repo}/releases/download/v${version}/${filename}" }
}

[string]$directory = "${BIN_DIR}\${repo}-${version}"
if (-not (dir_exists $directory)) {
exec { tar.exe -xzf "${BIN_DIR}\${filename}" -C "${BIN_DIR}" }
}

return $directory
Expand-Archive "${BIN_DIR}\${filename}" "${BIN_DIR}"
return "${BIN_DIR}\${repo}-${version}"
}

$mathDir = download_and_extract 'libtommath' '1.3.0' 'ltm'
Expand Down

0 comments on commit 655696e

Please sign in to comment.