fix(copy_libcore.bat): 改进jq安装脚本的可靠性和清理逻辑
Some checks failed
Build Windows / ACT Windows Checkout Verification (push) Successful in 7h0m18s
Build Windows / 编译 libcore (Windows) (20.15.1) (push) Successful in 19m10s
Build Windows / build (push) Failing after 7h0m29s

将内联的PowerShell命令改为临时脚本文件执行
添加临时文件清理逻辑确保脚本执行后不留残留
This commit is contained in:
shanshanzhong 2025-11-07 04:10:24 -08:00
parent 9873f670fa
commit ad5d0c9b7a

View File

@ -29,20 +29,28 @@ echo ⚠️ 未找到 libcore.dll
:install_jq :install_jq
echo 📦 安装 jq... echo 📦 安装 jq...
powershell -Command "
if (!(Get-Command choco -ErrorAction SilentlyContinue)) { :: 创建临时 PowerShell 脚本文件
Set-ExecutionPolicy Bypass -Scope Process -Force; echo if (!(Get-Command choco -ErrorAction SilentlyContinue)) { > install_jq.ps1
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; echo Set-ExecutionPolicy Bypass -Scope Process -Force; >> install_jq.ps1
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) echo [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; >> install_jq.ps1
} echo iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) >> install_jq.ps1
choco install jq -y echo } >> install_jq.ps1
$env:Path = [System.Environment]::GetEnvironmentVariable('Path','Machine') + ';' + [System.Environment]::GetEnvironmentVariable('Path','User') echo choco install jq -y >> install_jq.ps1
jq --version echo $env:Path = [System.Environment]::GetEnvironmentVariable('Path','Machine') + ';' + [System.Environment]::GetEnvironmentVariable('Path','User') >> install_jq.ps1
" echo jq --version >> install_jq.ps1
:: 执行 PowerShell 脚本
powershell -NoProfile -ExecutionPolicy Bypass -File install_jq.ps1
if %ERRORLEVEL% neq 0 ( if %ERRORLEVEL% neq 0 (
echo ❌ jq 安装失败 echo ❌ jq 安装失败
del install_jq.ps1
exit /b 1 exit /b 1
) )
:: 清理临时文件
del install_jq.ps1
echo ✅ jq 安装成功 echo ✅ jq 安装成功
goto :verify goto :verify