fbtenv: link toolchain to 'current' on Windows

This commit is contained in:
hedger 2024-02-12 23:49:32 +00:00
parent a9fb8da642
commit 9d5135daff
2 changed files with 12 additions and 3 deletions

View File

@ -24,17 +24,17 @@ set "FBT_TOOLCHAIN_ROOT=%FBT_TOOLCHAIN_PATH%\toolchain\x86_64-windows"
set "FBT_TOOLCHAIN_VERSION_FILE=%FBT_TOOLCHAIN_ROOT%\VERSION"
if not exist "%FBT_TOOLCHAIN_ROOT%" (
powershell -ExecutionPolicy Bypass -File "%FBT_ROOT%\scripts\toolchain\windows-toolchain-download.ps1" %flipper_toolchain_version% "%FBT_TOOLCHAIN_ROOT%"
powershell -ExecutionPolicy Bypass -File "%FBT_ROOT%\scripts\toolchain\windows-toolchain-download.ps1" %flipper_toolchain_version% "%FBT_TOOLCHAIN_ROOT%" || exit /b
)
if not exist "%FBT_TOOLCHAIN_VERSION_FILE%" (
powershell -ExecutionPolicy Bypass -File "%FBT_ROOT%\scripts\toolchain\windows-toolchain-download.ps1" %flipper_toolchain_version% "%FBT_TOOLCHAIN_ROOT%"
powershell -ExecutionPolicy Bypass -File "%FBT_ROOT%\scripts\toolchain\windows-toolchain-download.ps1" %flipper_toolchain_version% "%FBT_TOOLCHAIN_ROOT%" || exit /b
)
set /p REAL_TOOLCHAIN_VERSION=<"%FBT_TOOLCHAIN_VERSION_FILE%"
if not "%REAL_TOOLCHAIN_VERSION%" == "%FLIPPER_TOOLCHAIN_VERSION%" (
echo FBT: starting toolchain upgrade process..
powershell -ExecutionPolicy Bypass -File "%FBT_ROOT%\scripts\toolchain\windows-toolchain-download.ps1" %flipper_toolchain_version% "%FBT_TOOLCHAIN_ROOT%"
powershell -ExecutionPolicy Bypass -File "%FBT_ROOT%\scripts\toolchain\windows-toolchain-download.ps1" %flipper_toolchain_version% "%FBT_TOOLCHAIN_ROOT%" || exit /b
set /p REAL_TOOLCHAIN_VERSION=<"%FBT_TOOLCHAIN_VERSION_FILE%"
)

View File

@ -18,6 +18,13 @@ if (Test-Path -LiteralPath "$toolchain_target_path") {
Remove-Item -LiteralPath "$toolchain_target_path" -Force -Recurse
Write-Host "done!"
}
if (Test-path -Path "$toolchain_target_path\..\current") {
Write-Host -NoNewline "Unlinking 'current'.."
Remove-Item -LiteralPath "$toolchain_target_path\..\current" -Force
Write-Host "done!"
}
if (!(Test-Path -Path "$toolchain_zip_temp_path" -PathType Leaf)) {
Write-Host -NoNewline "Downloading Windows toolchain.."
$wc = New-Object net.webclient
@ -42,6 +49,8 @@ Add-Type -Assembly "System.IO.Compression.Filesystem"
Write-Host -NoNewline "moving.."
Move-Item -LiteralPath "$toolchain_dist_temp_path" -Destination "$toolchain_target_path" -Force
Write-Host -NoNewline "linking to 'current'.."
cmd /c mklink /J "$toolchain_target_path\..\current" "$toolchain_target_path"
Write-Host "done!"
Write-Host -NoNewline "Cleaning up temporary files.."