release: 封版 v0.4.16 中文正式版

This commit is contained in:
zhy200308
2026-08-12 14:48:09 +08:00
parent 1c5e015285
commit f248deac17
10 changed files with 185 additions and 65 deletions
+4 -1
View File
@@ -1,4 +1,4 @@
# QFT v0.4.7 implementation status # QFT v0.4.16 implementation status
## Windows → Android optical ## Windows → Android optical
@@ -40,6 +40,7 @@
- [x] wait for actual IPv4/link route before discovery - [x] wait for actual IPv4/link route before discovery
- [x] UDP QFTDISC2 receiver discovery - [x] UDP QFTDISC2 receiver discovery
- [x] QR endpoint + gateway + directed broadcast + subnet fallback - [x] QR endpoint + gateway + directed broadcast + subnet fallback
- [x] dedicated Wi-Fi immediate parallel gateway + actual-subnet probe
- [x] HTTP bound to selected Android Network - [x] HTTP bound to selected Android Network
- [x] local cleartext network security config - [x] local cleartext network security config
- [x] local/private IPv4 + session-token validation - [x] local/private IPv4 + session-token validation
@@ -49,6 +50,8 @@
- [x] Windows positioned concurrent writes - [x] Windows positioned concurrent writes
- [x] temporary `.qftpart`, final SHA-256 and rename - [x] temporary `.qftpart`, final SHA-256 and rename
- [x] accepted sockets return to timeout-bound blocking I/O before file transfer - [x] accepted sockets return to timeout-bound blocking I/O before file transfer
- [x] inline Android file selection + removable, pre-transfer sortable queue
- [x] crash-safe drag commit without detaching the active touched view
- [x] loopback UDP + HTTP + out-of-order parallel integration test - [x] loopback UDP + HTTP + out-of-order parallel integration test
- [ ] physical Windows Wi-Fi Direct adapter / driver / firewall matrix - [ ] physical Windows Wi-Fi Direct adapter / driver / firewall matrix
+9 -9
View File
@@ -1,27 +1,27 @@
# QFT · 超速二维码文件传输 v0.4.7 # QFT · 超速二维码文件传输 v0.4.16
Windows + Android 双向候选版。v0.4 的核心目标不是继续堆“4 码理论吞吐”,而是解决 Android 端实际识别慢的问题:**删除 2×2/4 通道,改成一个大二维码 + 动态 ROI 锁定 + 高频局部解码**。 Windows + Android 双向正式版。v0.4 的核心目标不是继续堆“4 码理论吞吐”,而是解决 Android 端实际识别慢的问题:**删除 2×2/4 通道,改成一个大二维码 + 动态 ROI 锁定 + 高频局部解码**。
v0.4.7 提供两套互不依赖的传输方式: v0.4.16 提供两套互不依赖的传输方式:
- **电脑 → 手机(纯光学)**:文件数据只经过 Windows 屏幕 → Android 摄像头;Wi‑Fi、蓝牙、局域网和互联网都不参与文件数据传输。 - **电脑 → 手机(纯光学)**:文件数据只经过 Windows 屏幕 → Android 摄像头;Wi‑Fi、蓝牙、局域网和互联网都不参与文件数据传输。
- **扫码本地直传(双向)**:Windows 为“手机上传”和“电脑下发”分别生成方向明确的二维码。Android 扫码后连接 QFT 本地网络、通过 UDP/网关/子网探测定位电脑,并按二维码指定方向自动进入选文件上传或接收下载;文件数据不经过外网。 - **扫码本地直传(双向)**:Windows 为“手机上传”和“电脑下发”分别生成方向明确的二维码。Android 扫码后连接 QFT 本地网络、通过 UDP/网关/子网探测定位电脑,并按二维码指定方向自动进入选文件上传或接收下载;文件数据不经过外网。
### v0.4.7 直传稳定性与并发策略 ### v0.4.16 直传稳定性与并发策略
- **双向均使用并行分块**:每个可分块文件以 8 路为目标并发数;分块大小根据文件大小自适应,范围为 **64 KiB–16 MiB**。小于一个最小分块的文件会自然只有一个请求。 - **双向均使用并行分块**:每个可分块文件以 8 路为目标并发数;分块大小根据文件大小自适应,范围为 **64 KiB–16 MiB**。小于一个最小分块的文件会自然只有一个请求。
- **手机 → 电脑**:Android 使用 offset 定位的 Parallel v2 上传;Windows 对每块进行定位写入,重复块与完成请求可安全重试,最终以 SHA-256 校验后原子改名。 - **手机 → 电脑**:Android 使用 offset 定位的 Parallel v2 上传;Windows 对每块进行定位写入,重复块与完成请求可安全重试,最终以 SHA-256 校验后原子改名。
- **电脑 → 手机**:Windows 支持精确的 HTTP `Range`(`206 Partial Content`);Android 对未完成块创建多个独立 Range 请求,并用 `.qftpart` 与完成位图恢复中断传输。每块最多重试 5 次,完成后校验 SHA-256 再保存至 `Downloads/QFT`。 - **电脑 → 手机**:Windows 支持精确的 HTTP `Range`(`206 Partial Content`);Android 对未完成块创建多个独立 Range 请求,并用 `.qftpart` 与完成位图恢复中断传输。每块最多重试 5 次,完成后校验 SHA-256 再保存至 `Downloads/QFT`。
- **连接稳定性**:Windows 监听器保持非阻塞以便及时停止服务,但已连接的文件套接字会切换为带读写超时的阻塞模式,避免 Windows `WSAEWOULDBLOCK (10035)` 造成大文件中途失败。 - **连接稳定性**:Windows 监听器保持非阻塞以便及时停止服务,但已连接的文件套接字会切换为带读写超时的阻塞模式,避免 Windows `WSAEWOULDBLOCK (10035)` 造成大文件中途失败。
> v0.4.7 已完成协议、图像合成解码、ROI、双向并发传输、UDP 发现、内存预算和关键 Kotlin 源码测试。当前生成环境没有真实 Windows 显示器、Android 相机或 Wi‑Fi Direct 适配器,因此物理 30/45/60 FPS 和真实扫码配网仍需在你的设备上跑 `VERIFY_WINDOWS_HOST.ps1` 后做最终验收;详见 `TEST_REPORT.md`。 > v0.4.16 已完成协议、图像合成解码、ROI、双向并发传输、专用 Wi-Fi 快速发现、队列拖动稳定性和关键 Kotlin 源码测试。当前生成环境没有真实 Windows 显示器、Android 相机或 Wi‑Fi Direct 适配器,因此物理 30/45/60 FPS 和真实扫码配网仍需在你的设备上跑 `VERIFY_WINDOWS_HOST.ps1` 后做最终验收;详见 `TEST_REPORT.md`。
## v0.4.8:跨平台桌面端 + 电脑 ↔ 电脑互传 ## v0.4.8:跨平台桌面端 + 电脑 ↔ 电脑互传
### macOS:请用 QFT.app 启动,不要直接跑裸二进制 ### macOS:请用 QFT超速文件传输.app 启动,不要直接跑裸二进制
`./package.sh` 在 macOS 上会同时产出 `QFT-Desktop`(裸二进制)和 `QFT.app`, `./package.sh` 在 macOS 上会同时产出 `QFT超速文件传输`(裸二进制)和
**推荐用 `QFT.app`**。 `QFT超速文件传输.app`,**推荐使用 `.app` 版本**。
直接运行裸二进制时,AppKit 的部分行为会不稳定——最典型的是点「选择文件」时 直接运行裸二进制时,AppKit 的部分行为会不稳定——最典型的是点「选择文件」时
`+[NSOpenPanel openPanel]` 返回 NULL: `+[NSOpenPanel openPanel]` 返回 NULL:
@@ -256,7 +256,7 @@ APK:
## 一键打包 ## 一键打包
脚本只打包 `desktop/` 下的 Rust 桌面端:执行 `cargo test` 和 `cargo build --release`,随后把 Rust 二进制、协议说明和 SHA-256 校验文件收集到带时间戳的 `dist/QFT-Rust-*` 目录并生成压缩包。脚本不检查、下载或调用 Android SDK、Java、Gradle: 脚本执行锁定依赖的 Rust 测试和正式构建,随后把桌面程序、中文说明、协议及 SHA-256 校验收集到带时间戳的 `dist/QFT-正式版-*` 目录。脚本不会安装、下载或调用 Android SDK、Java、Gradle;如果已经在 Windows 上构建好 APK,则会自动将它收集进同一个中文正式包:
```bat ```bat
package.bat package.bat
+35
View File
@@ -0,0 +1,35 @@
# QFT 超速文件传输 v0.4.16 正式版
这是 Windows 与 Android 双端统一版本号的中文正式版。
## 本版重点
- Windows 扫码直传默认保持普通并排布局,专注二维码模式改为用户手动进入。
- 优化直传控制、防火墙、二维码、连接状态区域布局,减少无效留白。
- Windows 自动创建 QFT 专用 Wi-Fi Direct 网络,二维码不再强制携带电脑既有网卡地址。
- Android 连接专用 Wi-Fi 后立即并行探测实际网关与当前子网,缩短“搜索电脑”时间。
- Windows 已确认防火墙规则后复用检测结果,并移除专用网络启动后的固定等待。
- Android 文件选择直接打开系统文件选择器,支持队列删除和传输前拖动排序。
- Android 拖动采用松手后一次性提交顺序,修复部分厂商系统点击拖动闪退。
- PC 接收完成后不再残留“预计剩余 <1 秒”,改为显示最终平均速度。
## 版本信息
- Windows 桌面端:`0.4.16`
- Android 端:`0.4.16`(versionCode 23)
- 最低 Android 版本:Android 7.0(API 24)
- Windows:Windows 10/11 x64,使用 QFT Direct 时需要支持 Wi-Fi Direct 的无线网卡
## 中文封版打包
- Windows:运行 `package.bat`。
- macOS/Linux:运行 `./package.sh`。
- 打包脚本会执行 Rust 锁定依赖测试与正式构建,生成中文文件名、中文说明和 SHA-256 校验文件。
- 脚本不会安装、下载或调用 Android SDK/Gradle;如果 Windows 上已经生成 APK,会自动收集到同一个正式包中。
## 验证状态
- Rust Windows 目标 `cargo check` 通过。
- Rust 桌面端 71 项自动测试通过。
- Android 配对协议、并行传输及兼容性静态检查通过。
- Windows Wi-Fi Direct 与 Android 相机属于硬件链路,最终安装包仍应在目标 Windows 电脑和实际 Android 手机上完成一次扫码传输验收。
+11 -9
View File
@@ -1,12 +1,12 @@
# QFT v0.4.7 test report # QFT v0.4.16 test report
Date: 2026-08-10 Date: 2026-08-12
This report separates **tests actually executed in the current environment** from **physical hardware acceptance that cannot be simulated here**. This report separates **tests actually executed in the current environment** from **physical hardware acceptance that cannot be simulated here**.
## What this RC changes ## What this release changes
The v0.4.7 optical path is deliberately simpler than v0.3: The v0.4.16 optical path is deliberately simpler than v0.3:
- 2×2 / 4-channel QR removed; - 2×2 / 4-channel QR removed;
- one large QR only; - one large QR only;
@@ -21,6 +21,8 @@ The v0.4.7 optical path is deliberately simpler than v0.3:
- Windows draggable split pane / focus-QR mode. - Windows draggable split pane / focus-QR mode.
Android→Windows QFTPAIR2/discovery/parallel upload remains and is regression-tested. Android→Windows QFTPAIR2/discovery/parallel upload remains and is regression-tested.
The release also adds immediate gateway/subnet probing after dedicated Wi-Fi association,
crash-safe Android queue reordering, and a completed PC receive state without stale ETA text.
## Executed and passed ## Executed and passed
@@ -152,7 +154,7 @@ The guard models the Windows single-QR 1024×1024 RGBA pre-render queue:
This is a design-budget check, not an OS-enforced RSS hard cap. GPU/runtime allocators can add platform-specific memory. This is a design-budget check, not an OS-enforced RSS hard cap. GPU/runtime allocators can add platform-specific memory.
## Important implementation decisions validated during v0.4.7 ## Important implementation decisions validated during v0.4.16
### QFT2 uses Result.text, not ZXing rawBytes ### QFT2 uses Result.text, not ZXing rawBytes
@@ -160,7 +162,7 @@ The active path is Base45 text. Android reconstructs the QFT binary frame from `
### Duplicate camera hits are not duplicate assembler work ### Duplicate camera hits are not duplicate assembler work
At 45/60 display FPS, a camera can observe the same displayed QR in multiple exposures. v0.4.7 still counts every successful decode in diagnostics, but only a changed QFT2 text fingerprint is delivered to `SessionAssembler`. At 45/60 display FPS, a camera can observe the same displayed QR in multiple exposures. v0.4.16 still counts every successful decode in diagnostics, but only a changed QFT2 text fingerprint is delivered to `SessionAssembler`.
### AF/AE does not run on a fixed periodic timer ### AF/AE does not run on a fixed periodic timer
@@ -168,16 +170,16 @@ The scanner performs initial focus/metering, then re-meters after first lock or
## Not executable in this environment ## Not executable in this environment
The current generation environment does not contain the Windows MSVC Rust toolchain, Android SDK, a physical Android camera, a Windows display or a Windows Wi-Fi Direct adapter. Therefore the following are **not claimed as passed here**: The current generation environment does not contain the Windows MSVC Rust toolchain, Android SDK, a physical Android camera, a Windows display or a Windows Wi-Fi Direct adapter. The Windows GNU target `cargo check`, native desktop release build and 71 Rust tests passed, but the following are **not claimed as passed here**:
1. Windows `cargo check/test/build --release` for v0.4.7. 1. Linking and running the final Windows `.exe` on a real Windows host.
2. Android Gradle `:app:testDebugUnitTest :app:assembleDebug` against the real Android SDK. 2. Android Gradle `:app:testDebugUnitTest :app:assembleDebug` against the real Android SDK.
3. Actual 30/45/60 displayed FPS → CameraX/ZXing effective new-frame throughput. 3. Actual 30/45/60 displayed FPS → CameraX/ZXing effective new-frame throughput.
4. Lock acquisition/reacquisition timing on Android 7 and different phone camera pipelines. 4. Lock acquisition/reacquisition timing on Android 7 and different phone camera pipelines.
5. PreviewView overlay mapping on every OEM sensor/crop/rotation combination. 5. PreviewView overlay mapping on every OEM sensor/crop/rotation combination.
6. Real Windows QFT Direct adapter / driver / firewall behavior. 6. Real Windows QFT Direct adapter / driver / firewall behavior.
The package remains an **RC** until those physical checks pass. The source is sealed as **v0.4.16**. The Windows executable and Android APK still require the physical acceptance below before public binary distribution.
## Required physical acceptance ## Required physical acceptance
+9 -3
View File
@@ -1,5 +1,11 @@
QFT v0.4.7 test results QFT v0.4.16 test results
UTC 2026-08-10T08:45:56Z Updated 2026-08-12 Asia/Shanghai
== v0.4.16 release increment ==
PASS Windows GNU target cargo check
PASS native desktop cargo test: 71 passed, 0 failed
PASS native desktop cargo build --release --locked
PASS Chinese release package generation with SHA-256 manifest
== protocol_selftest.py == == protocol_selftest.py ==
PASS QFT2/Base45 single-QR: 1200123 bytes, 2667 chunks, 22% frame loss, recovered in 6 rounds; QR-L v15 vs legacy Base64 v18, 12px/module@1024, text=722 chars, theoretical payload=26.4 KiB/s PASS QFT2/Base45 single-QR: 1200123 bytes, 2667 chunks, 22% frame loss, recovered in 6 rounds; QR-L v15 vs legacy Base64 v18, 12px/module@1024, text=722 chars, theoretical payload=26.4 KiB/s
@@ -16,7 +22,7 @@ PASS loopback Parallel v2 integration: UDP discovery + HTTP auth + 6 out-of-orde
== memory_budget_selftest.py == == memory_budget_selftest.py ==
PASS memory budget: single-QR cache=192 frames/768.0 MiB + 96 MiB transient allowance < 1100 MiB PASS memory budget: single-QR cache=192 frames/768.0 MiB + 96 MiB transient allowance < 1100 MiB
== android_compat_selftest.py == == android_compat_selftest.py ==
PASS Android static guards: API24+, 640x480 single-QR ROI, reusable luma buffer, QFT2/Base45 text parse, dynamic lock/refocus, Camera2 FPS request, legacy/new Wi-Fi compatibility PASS Android static guards: API24+, fast-pair/subnet discovery, crash-safe sortable upload queue, QFT2/Base45, dynamic lock/refocus, legacy/new Wi-Fi compatibility
== single_channel_guard_selftest.py == == single_channel_guard_selftest.py ==
PASS single-channel guard: one large QFT2/Base45 QR, 450B chunks, no 2x2/4-lane path, Android locked-ROI text decode only PASS single-channel guard: one large QFT2/Base45 QR, 450B chunks, no 2x2/4-lane path, Android locked-ROI text decode only
== kotlin_host_smoke.py == == kotlin_host_smoke.py ==
+1 -1
View File
@@ -1,7 +1,7 @@
$ErrorActionPreference = 'Stop' $ErrorActionPreference = 'Stop'
$Root = Split-Path -Parent $MyInvocation.MyCommand.Path $Root = Split-Path -Parent $MyInvocation.MyCommand.Path
Write-Host "== QFT v0.4.7 Windows host verification ==" -ForegroundColor Cyan Write-Host "== QFT v0.4.16 Windows host verification ==" -ForegroundColor Cyan
if (Get-Command python -ErrorAction SilentlyContinue) { if (Get-Command python -ErrorAction SilentlyContinue) {
Write-Host "[1/4] Core protocol/selftests" Write-Host "[1/4] Core protocol/selftests"
+1 -1
View File
@@ -13,7 +13,7 @@ android {
minSdk = 24 minSdk = 24
targetSdk = 35 targetSdk = 35
versionCode = 23 versionCode = 23
versionName = "0.4.11" versionName = "0.4.16"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
} }
@@ -202,7 +202,7 @@ class MainActivity : ComponentActivity() {
) { showReceivedFiles() }) ) { showReceivedFiles() })
root.addView(space(22)) root.addView(space(22))
root.addView(text("本机设备:$receiverDeviceLabel", 13f, MUTED)) root.addView(text("本机设备:$receiverDeviceLabel", 13f, MUTED))
root.addView(text("QFT v0.4.11 · Android 7+ 到最新", 12f, MUTED)) root.addView(text("QFT v0.4.16 · Android 7+ 到最新", 12f, MUTED))
setContentView(ScrollView(this).apply { setBackgroundColor(BG); addView(root) }) setContentView(ScrollView(this).apply { setBackgroundColor(BG); addView(root) })
} }
+59 -20
View File
@@ -1,46 +1,85 @@
@echo off @echo off
setlocal EnableExtensions chcp 65001 >nul
setlocal EnableExtensions DisableDelayedExpansion
cd /d "%~dp0" cd /d "%~dp0"
echo == QFT Rust one-click package == echo == QFT 正式版中文打包 ==
where cargo >nul 2>nul where cargo >nul 2>nul
if errorlevel 1 ( if errorlevel 1 (
echo ERROR: Rust cargo was not found in PATH. echo 错误:PATH 中未找到 Rust cargo。
exit /b 1 exit /b 1
) )
echo [1/3] Testing and building the Rust Windows release... echo [1/4] 测试并构建 Windows 正式版...
pushd windows pushd desktop
cargo test cargo test --locked
if errorlevel 1 (popd & exit /b 1) if errorlevel 1 (popd & exit /b 1)
cargo build --release cargo build --release --locked
if errorlevel 1 (popd & exit /b 1) if errorlevel 1 (popd & exit /b 1)
popd popd
for /f "tokens=3" %%V in ('findstr /R /C:"^version =" "windows\Cargo.toml"') do set "QFT_VERSION=%%~V" for /f "tokens=3" %%V in ('findstr /R /C:"^version =" "desktop\Cargo.toml"') do set "QFT_VERSION=%%~V"
for /f "tokens=3" %%V in ('findstr /R /C:"^[ ]*versionName =" "android\app\build.gradle.kts"') do set "QFT_ANDROID_VERSION=%%~V"
for /f "tokens=3" %%V in ('findstr /R /C:"^[ ]*versionCode =" "android\app\build.gradle.kts"') do set "QFT_ANDROID_CODE=%%V"
for /f "usebackq delims=" %%T in (`powershell -NoProfile -Command "Get-Date -Format yyyyMMdd-HHmmss"`) do set "QFT_STAMP=%%T" for /f "usebackq delims=" %%T in (`powershell -NoProfile -Command "Get-Date -Format yyyyMMdd-HHmmss"`) do set "QFT_STAMP=%%T"
for /f "usebackq delims=" %%C in (`git rev-parse --short HEAD 2^>nul`) do set "QFT_RELEASE_COMMIT=%%C"
if not defined QFT_VERSION set "QFT_VERSION=unknown" if not defined QFT_VERSION set "QFT_VERSION=unknown"
set "QFT_PACKAGE=QFT-Rust-%QFT_VERSION%-%QFT_STAMP%-windows" if not defined QFT_ANDROID_VERSION set "QFT_ANDROID_VERSION=unknown"
if not defined QFT_ANDROID_CODE set "QFT_ANDROID_CODE=unknown"
if not defined QFT_RELEASE_COMMIT set "QFT_RELEASE_COMMIT=unknown"
if /I "%QFT_ANDROID_VERSION%"=="%QFT_VERSION%" goto versions_ok
echo 错误:PC 版本 %QFT_VERSION% 与 Android 版本 %QFT_ANDROID_VERSION% 不一致,拒绝封版。
exit /b 1
:versions_ok
set "QFT_PACKAGE=QFT-正式版-v%QFT_VERSION%-Windows-%QFT_STAMP%"
set "QFT_PACKAGE_DIR=%CD%\dist\%QFT_PACKAGE%" set "QFT_PACKAGE_DIR=%CD%\dist\%QFT_PACKAGE%"
echo [2/3] Collecting Rust artifacts... echo [2/4] 收集正式版文件...
mkdir "%QFT_PACKAGE_DIR%" || exit /b 1 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 "desktop\target\release\qft-desktop.exe" "%QFT_PACKAGE_DIR%\QFT超速文件传输.exe" >nul || exit /b 1
copy /y "README.md" "%QFT_PACKAGE_DIR%\README.md" >nul || exit /b 1 copy /y "README.md" "%QFT_PACKAGE_DIR%\使用说明.md" >nul || exit /b 1
copy /y "TEST_REPORT.md" "%QFT_PACKAGE_DIR%\TEST_REPORT.md" >nul || exit /b 1 copy /y "TEST_REPORT.md" "%QFT_PACKAGE_DIR%\测试报告.md" >nul || exit /b 1
copy /y "docs\PROTOCOL.md" "%QFT_PACKAGE_DIR%\PROTOCOL.md" >nul || exit /b 1 copy /y "docs\PROTOCOL.md" "%QFT_PACKAGE_DIR%\传输协议.md" >nul || exit /b 1
copy /y "RELEASE_NOTES_%QFT_VERSION%.md" "%QFT_PACKAGE_DIR%\版本说明.md" >nul || exit /b 1
echo [3/3] Writing SHA-256 checksums and ZIP archive... rem 仅收集已经由用户在 Windows 上构建好的 APK,不调用 Gradle/Android SDK。
set "QFT_APK=%QFT_ANDROID_APK%"
if defined QFT_APK goto apk_resolved
if exist "android\app\build\outputs\apk\release\app-release.apk" set "QFT_APK=android\app\build\outputs\apk\release\app-release.apk"
if defined QFT_APK goto apk_resolved
if exist "android\app\build\outputs\apk\debug\app-debug.apk" set "QFT_APK=android\app\build\outputs\apk\debug\app-debug.apk"
:apk_resolved
if not defined QFT_APK goto apk_missing
if not exist "%QFT_APK%" goto apk_missing
copy /y "%QFT_APK%" "%QFT_PACKAGE_DIR%\QFT安卓端-v%QFT_VERSION%.apk" >nul || exit /b 1
echo 已收集 Android APK:%QFT_APK%
goto apk_done
:apk_missing
echo 提示:未发现已构建 APK,本次生成 Windows 桌面端正式包。
echo 如需合并 APK,请先在 Windows 构建,或设置 QFT_ANDROID_APK 后重跑本脚本。
:apk_done
echo [3/4] 写入版本信息与 SHA-256 校验...
powershell -NoProfile -Command ^
"$dir = [IO.Path]::GetFullPath('%QFT_PACKAGE_DIR%');" ^
"$meta = @('QFT 超速文件传输 正式版', '产品版本:v%QFT_VERSION%', 'Android versionCode:%QFT_ANDROID_CODE%', '封版提交:%QFT_RELEASE_COMMIT%', '打包时间:%QFT_STAMP%', '平台:Windows x64');" ^
"[IO.File]::WriteAllLines((Join-Path $dir '版本信息.txt'), $meta, [Text.UTF8Encoding]::new($false));" ^
"$lines = Get-ChildItem -LiteralPath $dir -File ^| Where-Object Name -ne 'SHA256校验.txt' ^| Sort-Object Name ^| ForEach-Object { '{0} {1}' -f (Get-FileHash -Algorithm SHA256 -LiteralPath $_.FullName).Hash.ToLower(), $_.Name };" ^
"[IO.File]::WriteAllLines((Join-Path $dir 'SHA256校验.txt'), $lines, [Text.UTF8Encoding]::new($false))"
if errorlevel 1 exit /b 1
echo [4/4] 创建中文 ZIP 正式包...
powershell -NoProfile -Command ^ powershell -NoProfile -Command ^
"$dir = [IO.Path]::GetFullPath('%QFT_PACKAGE_DIR%');" ^ "$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 };" ^
"[IO.File]::WriteAllLines((Join-Path $dir 'SHA256SUMS.txt'), $lines, [Text.UTF8Encoding]::new($false));" ^
"Compress-Archive -LiteralPath $dir -DestinationPath ($dir + '.zip') -Force" "Compress-Archive -LiteralPath $dir -DestinationPath ($dir + '.zip') -Force"
if errorlevel 1 exit /b 1 if errorlevel 1 exit /b 1
echo. echo.
echo PACKAGE COMPLETE echo 封版打包完成
echo Folder: %QFT_PACKAGE_DIR% echo 文件夹:%QFT_PACKAGE_DIR%
echo ZIP: %QFT_PACKAGE_DIR%.zip echo 压缩包:%QFT_PACKAGE_DIR%.zip
exit /b 0 exit /b 0
+55 -20
View File
@@ -4,7 +4,7 @@ set -eu
QFT_ROOT=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) QFT_ROOT=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
cd "$QFT_ROOT" cd "$QFT_ROOT"
echo "== QFT Rust one-click package ==" echo "== QFT 正式版中文打包 =="
if ! command -v cargo >/dev/null 2>&1; then if ! command -v cargo >/dev/null 2>&1; then
# rustup 装在 keg-only 目录里时不会自动进 PATH,这里兜一下, # rustup 装在 keg-only 目录里时不会自动进 PATH,这里兜一下,
# 避免用户明明装了工具链却被告知"没装"。 # 避免用户明明装了工具链却被告知"没装"。
@@ -23,35 +23,43 @@ command -v cargo >/dev/null 2>&1 || {
exit 1 exit 1
} }
echo "[1/3] Testing and building the Rust desktop release..." echo "[1/4] 测试并构建桌面正式版..."
( (
cd desktop cd desktop
cargo test cargo test --locked
cargo build --release cargo build --release --locked
) )
QFT_VERSION=$(awk -F'"' '/^\[package\]/{package=1; next} package && /^version[[:space:]]*=/{print $2; exit} /^\[/{package=0}' desktop/Cargo.toml) QFT_VERSION=$(awk -F'"' '/^\[package\]/{package=1; next} package && /^version[[:space:]]*=/{print $2; exit} /^\[/{package=0}' desktop/Cargo.toml)
[ -n "$QFT_VERSION" ] || QFT_VERSION=unknown [ -n "$QFT_VERSION" ] || QFT_VERSION=unknown
QFT_STAMP=$(date '+%Y%m%d-%H%M%S') QFT_STAMP=$(date '+%Y%m%d-%H%M%S')
QFT_PLATFORM=$(uname -s | tr '[:upper:]' '[:lower:]') QFT_PLATFORM=$(uname -s | tr '[:upper:]' '[:lower:]')
QFT_PACKAGE="QFT-Rust-${QFT_VERSION}-${QFT_STAMP}-${QFT_PLATFORM}" QFT_ARCH=$(uname -m)
QFT_PACKAGE="QFT-正式版-v${QFT_VERSION}-${QFT_PLATFORM}-${QFT_ARCH}-${QFT_STAMP}"
QFT_PACKAGE_DIR="$QFT_ROOT/dist/$QFT_PACKAGE" QFT_PACKAGE_DIR="$QFT_ROOT/dist/$QFT_PACKAGE"
echo "[2/3] Collecting Rust artifacts..." ANDROID_VERSION=$(awk -F'"' '/versionName[[:space:]]*=/{print $2; exit}' android/app/build.gradle.kts)
ANDROID_VERSION_CODE=$(awk '/versionCode[[:space:]]*=/{print $3; exit}' android/app/build.gradle.kts)
[ "$ANDROID_VERSION" = "$QFT_VERSION" ] || {
echo "错误:PC 版本 $QFT_VERSION 与 Android 版本 $ANDROID_VERSION 不一致,拒绝封版。" >&2
exit 1
}
echo "[2/4] 收集正式版文件..."
mkdir -p "$QFT_PACKAGE_DIR" mkdir -p "$QFT_PACKAGE_DIR"
if [ -f "desktop/target/release/qft-desktop.exe" ]; then if [ -f "desktop/target/release/qft-desktop.exe" ]; then
cp "desktop/target/release/qft-desktop.exe" "$QFT_PACKAGE_DIR/QFT-Windows.exe" cp "desktop/target/release/qft-desktop.exe" "$QFT_PACKAGE_DIR/QFT超速文件传输.exe"
elif [ -f "desktop/target/release/qft-desktop" ]; then elif [ -f "desktop/target/release/qft-desktop" ]; then
cp "desktop/target/release/qft-desktop" "$QFT_PACKAGE_DIR/QFT-Desktop" cp "desktop/target/release/qft-desktop" "$QFT_PACKAGE_DIR/QFT超速文件传输"
# macOS 上额外产出 .app 包。AppKit 的若干行为(其中就包括 # macOS 上额外产出 .app 包。AppKit 的若干行为(其中就包括
# NSOpenPanel)依赖应用被正确注册为 GUI 程序,直接跑裸二进制时 # NSOpenPanel)依赖应用被正确注册为 GUI 程序,直接跑裸二进制时
# openPanel 会偶发返回 NULL 并导致崩溃。 # openPanel 会偶发返回 NULL 并导致崩溃。
if [ "$QFT_PLATFORM" = "darwin" ]; then if [ "$QFT_PLATFORM" = "darwin" ]; then
QFT_APP="$QFT_PACKAGE_DIR/QFT.app" QFT_APP="$QFT_PACKAGE_DIR/QFT超速文件传输.app"
mkdir -p "$QFT_APP/Contents/MacOS" mkdir -p "$QFT_APP/Contents/MacOS"
cp "desktop/target/release/qft-desktop" "$QFT_APP/Contents/MacOS/QFT" cp "desktop/target/release/qft-desktop" "$QFT_APP/Contents/MacOS/QFT"
chmod +x "$QFT_APP/Contents/MacOS/QFT" chmod +x "$QFT_APP/Contents/MacOS/QFT"
cat > "$QFT_APP/Contents/Info.plist" <<'PLIST' cat > "$QFT_APP/Contents/Info.plist" <<PLIST
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
@@ -61,35 +69,62 @@ elif [ -f "desktop/target/release/qft-desktop" ]; then
<key>CFBundleIdentifier</key><string>com.qft.desktop</string> <key>CFBundleIdentifier</key><string>com.qft.desktop</string>
<key>CFBundleExecutable</key><string>QFT</string> <key>CFBundleExecutable</key><string>QFT</string>
<key>CFBundlePackageType</key><string>APPL</string> <key>CFBundlePackageType</key><string>APPL</string>
<key>CFBundleShortVersionString</key><string>0.5.0</string> <key>CFBundleShortVersionString</key><string>${QFT_VERSION}</string>
<key>CFBundleVersion</key><string>1</string> <key>CFBundleVersion</key><string>1</string>
<key>NSHighResolutionCapable</key><true/> <key>NSHighResolutionCapable</key><true/>
<key>LSMinimumSystemVersion</key><string>11.0</string> <key>LSMinimumSystemVersion</key><string>11.0</string>
</dict> </dict>
</plist> </plist>
PLIST PLIST
echo " 已生成 QFT.app(推荐用它启动,比裸二进制稳定)" echo " 已生成 QFT超速文件传输.app(推荐使用)"
fi fi
else else
echo "ERROR: desktop release binary was not produced." >&2 echo "ERROR: desktop release binary was not produced." >&2
exit 1 exit 1
fi fi
cp README.md TEST_REPORT.md "$QFT_PACKAGE_DIR/" cp README.md "$QFT_PACKAGE_DIR/使用说明.md"
cp docs/PROTOCOL.md "$QFT_PACKAGE_DIR/PROTOCOL.md" cp TEST_REPORT.md "$QFT_PACKAGE_DIR/测试报告.md"
cp docs/PROTOCOL.md "$QFT_PACKAGE_DIR/传输协议.md"
cp "RELEASE_NOTES_${QFT_VERSION}.md" "$QFT_PACKAGE_DIR/版本说明.md"
echo "[3/3] Writing SHA-256 checksums and archive..." # 只收集已经存在的 APK,不检查、下载或调用 Android SDK/Gradle。
QFT_APK=${QFT_ANDROID_APK:-}
if [ -z "$QFT_APK" ] && [ -f android/app/build/outputs/apk/release/app-release.apk ]; then
QFT_APK=android/app/build/outputs/apk/release/app-release.apk
fi
if [ -z "$QFT_APK" ] && [ -f android/app/build/outputs/apk/debug/app-debug.apk ]; then
QFT_APK=android/app/build/outputs/apk/debug/app-debug.apk
fi
if [ -n "$QFT_APK" ] && [ -f "$QFT_APK" ]; then
cp "$QFT_APK" "$QFT_PACKAGE_DIR/QFT安卓端-v${QFT_VERSION}.apk"
echo " 已收集 Android APK:$QFT_APK"
else
echo " 提示:未发现已构建 APK,本次只生成当前桌面平台正式包。"
fi
echo "[3/4] 写入 SHA-256 校验..."
QFT_RELEASE_COMMIT=$(git rev-parse --short HEAD 2>/dev/null || printf 'unknown')
{
printf '%s\n' "QFT 超速文件传输 正式版"
printf '%s\n' "产品版本:v${QFT_VERSION}"
printf '%s\n' "Android versionCode:${ANDROID_VERSION_CODE}"
printf '%s\n' "封版提交:${QFT_RELEASE_COMMIT}"
printf '%s\n' "打包时间:${QFT_STAMP}"
printf '%s\n' "平台:${QFT_PLATFORM} ${QFT_ARCH}"
} > "$QFT_PACKAGE_DIR/版本信息.txt"
( (
cd "$QFT_PACKAGE_DIR" cd "$QFT_PACKAGE_DIR"
# 只对普通文件求校验和:.app 是目录,直接喂给 sha256sum 会报错 # 只对普通文件求校验和:.app 是目录,直接喂给 sha256sum 会报错
if command -v sha256sum >/dev/null 2>&1; then if command -v sha256sum >/dev/null 2>&1; then
find . -type f ! -name SHA256SUMS.txt | sort | xargs sha256sum > SHA256SUMS.txt find . -type f ! -name SHA256校验.txt | sort | xargs sha256sum > SHA256校验.txt
else else
find . -type f ! -name SHA256SUMS.txt | sort | xargs shasum -a 256 > SHA256SUMS.txt find . -type f ! -name SHA256校验.txt | sort | xargs shasum -a 256 > SHA256校验.txt
fi fi
) )
echo "[4/4] 创建中文压缩包..."
tar -C "$QFT_ROOT/dist" -czf "$QFT_PACKAGE_DIR.tar.gz" "$QFT_PACKAGE" tar -C "$QFT_ROOT/dist" -czf "$QFT_PACKAGE_DIR.tar.gz" "$QFT_PACKAGE"
echo echo
echo "PACKAGE COMPLETE" echo "封版打包完成"
echo "Folder: $QFT_PACKAGE_DIR" echo "文件夹:$QFT_PACKAGE_DIR"
echo "Archive: $QFT_PACKAGE_DIR.tar.gz" echo "压缩包:$QFT_PACKAGE_DIR.tar.gz"