修正为仅打包Rust桌面端

This commit is contained in:
zhy200308
2026-08-11 11:48:09 +08:00
parent dffee5365d
commit cb92397300
3 changed files with 13 additions and 58 deletions
+6 -32
View File
@@ -2,7 +2,7 @@
setlocal EnableExtensions
cd /d "%~dp0"
echo == QFT one-click package ==
echo == QFT Rust one-click package ==
where cargo >nul 2>nul
if errorlevel 1 (
@@ -10,26 +10,7 @@ if errorlevel 1 (
exit /b 1
)
where java >nul 2>nul
if errorlevel 1 (
echo ERROR: JDK 17 was not found in PATH.
exit /b 1
)
if not exist "android\local.properties" if not defined ANDROID_HOME if not defined ANDROID_SDK_ROOT (
echo ERROR: Android SDK was not found. Set ANDROID_HOME or create android\local.properties with sdk.dir.
exit /b 1
)
if not exist "android\gradle\wrapper\gradle-wrapper.jar" (
echo [1/5] Bootstrapping the Gradle wrapper...
powershell -NoProfile -ExecutionPolicy Bypass -File "android\bootstrap-wrapper.ps1"
if errorlevel 1 exit /b 1
) else (
echo [1/5] Gradle wrapper is ready.
)
echo [2/5] Testing and building the Windows release...
echo [1/3] Testing and building the Rust Windows release...
pushd windows
cargo test
if errorlevel 1 (popd & exit /b 1)
@@ -37,27 +18,20 @@ cargo build --release
if errorlevel 1 (popd & exit /b 1)
popd
echo [3/5] Testing and building the installable Android APK...
pushd android
call gradlew.bat :app:testDebugUnitTest :app:assembleDebug --stacktrace
if errorlevel 1 (popd & exit /b 1)
popd
for /f "tokens=3" %%V in ('findstr /R /C:"versionName *=" "android\app\build.gradle.kts"') do set "QFT_VERSION=%%~V"
for /f "tokens=3" %%V in ('findstr /R /C:"^version =" "windows\Cargo.toml"') do set "QFT_VERSION=%%~V"
for /f "usebackq delims=" %%T in (`powershell -NoProfile -Command "Get-Date -Format yyyyMMdd-HHmmss"`) do set "QFT_STAMP=%%T"
if not defined QFT_VERSION set "QFT_VERSION=unknown"
set "QFT_PACKAGE=QFT-%QFT_VERSION%-%QFT_STAMP%-windows"
set "QFT_PACKAGE=QFT-Rust-%QFT_VERSION%-%QFT_STAMP%-windows"
set "QFT_PACKAGE_DIR=%CD%\dist\%QFT_PACKAGE%"
echo [4/5] Collecting artifacts...
echo [2/3] Collecting Rust artifacts...
mkdir "%QFT_PACKAGE_DIR%" || exit /b 1
copy /y "windows\target\release\qft-windows.exe" "%QFT_PACKAGE_DIR%\QFT-Windows.exe" >nul || exit /b 1
copy /y "android\app\build\outputs\apk\debug\app-debug.apk" "%QFT_PACKAGE_DIR%\QFT-Android-%QFT_VERSION%.apk" >nul || exit /b 1
copy /y "README.md" "%QFT_PACKAGE_DIR%\README.md" >nul || exit /b 1
copy /y "TEST_REPORT.md" "%QFT_PACKAGE_DIR%\TEST_REPORT.md" >nul || exit /b 1
copy /y "docs\PROTOCOL.md" "%QFT_PACKAGE_DIR%\PROTOCOL.md" >nul || exit /b 1
echo [5/5] Writing SHA-256 checksums and ZIP archive...
echo [3/3] Writing SHA-256 checksums and ZIP archive...
powershell -NoProfile -Command ^
"$dir = [IO.Path]::GetFullPath('%QFT_PACKAGE_DIR%');" ^
"$lines = Get-ChildItem -LiteralPath $dir -File ^| Sort-Object Name ^| ForEach-Object { '{0} {1}' -f (Get-FileHash -Algorithm SHA256 -LiteralPath $_.FullName).Hash.ToLower(), $_.Name };" ^