133bfdbc84
leo 開 DMG 檢查時抓到:CFBundleShortVersionString = **1.0.0**(Wails 預設), 不是 v0.18.4 ⇒ 使用者在 Finder/「關於」看到的版本永遠不變 ⇒ 無從判斷自己是不是新版(同「版本號是唯一驗收介面」的病)。 真因:wails.json 沒有 info.productVersion,而 wails build **沒有 CLI 旗標**可指定。 修:build-mac.sh/build-win.sh 建置前把版本寫進 wails.json 的 info, 建完用 trap 還原(不污染版控)。 驗:重打後 Info.plist = 0.18.4 ✅、wails.json 無殘留 ✅ DMG 用戶視角實測(掛載後看): 剛好兩項 Arcrun.app + Applications 捷徑 ✅(拖進去的標準畫面) MacOS/ 內含 arcrun-app + arcrun-collector ✅(沒同綑=裝了不會同步) LSUIElement=true ✅(不佔 Dock)|codesign -v 通過 ✅ skill 補兩段: · 3.5「把 DMG/zip 真的打開,用使用者第一次看到的樣子檢查」(含五項判準與漏掉的後果) · 開頭「這支 skill 自己的失效模式」——leo:「你寫完一個 skill 然後每個我要提醒你, 表示這個 skill 無效」。根因是憑印象列步驟沒走過使用者的路; 訂三條鐵律(每條要有可貼的實測輸出/使用者看得到的東西一律真的打開/ 被 leo 問出來的缺口當場補進 skill)。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
77 lines
3.4 KiB
Bash
Executable File
77 lines
3.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
# build-win.sh — 打包 Arcrun Windows 版(Wails,t196/2026-08-05)
|
||
#
|
||
# leo 08-05:「Windows 版一定要重編,因為我只有 Mac,我需要人家測試,
|
||
# 要做到最完善不要給人家找麻煩」
|
||
#
|
||
# 🎯 **在 Mac 上就能交叉編譯**,不需要 Windows 機器/Docker。
|
||
# 條件只有一個:`brew install mingw-w64`(提供 x86_64-w64-mingw32-gcc)。
|
||
# Wails 的 Windows 版要 CGo(WebView2 綁定),所以 CGO_ENABLED=1 + mingw。
|
||
#
|
||
# 與 build-mac.sh 同一個要點:**必須把 collector 同綑進去**。
|
||
# daemon 的本體是 `collector direct`(監看/萃卡/上傳),App 只是門面;
|
||
# 沒同綑 ⇒ 使用者裝了也不會同步(t194 在 Mac 版就漏過一次)。
|
||
#
|
||
# ⚠️ 誠實界定(沿用 build-windows.sh 的自陳):
|
||
# 本腳本只證明「**編得出來**」,不證明「**跑起來對**」。
|
||
# 托盤圖示會不會出現、WebView2 有沒有裝、SmartScreen 攔截行為,
|
||
# **只有真的在 Windows 上跑才驗得到**——那一步歸 leo/封測者真機。
|
||
set -euo pipefail
|
||
cd "$(dirname "$0")"
|
||
export PATH="$PATH:$(go env GOPATH)/bin"
|
||
|
||
VERSION="${VERSION:-$(git describe --tags --always --dirty 2>/dev/null || echo dev)}"
|
||
BUILD_TIME="$(date '+%Y%m%d-%H%M')"
|
||
echo "🏷 版本:${VERSION}(build ${BUILD_TIME})"
|
||
|
||
command -v x86_64-w64-mingw32-gcc >/dev/null 2>&1 || {
|
||
echo "❌ 缺 mingw-w64(Wails Windows 版需要 CGo 交叉編譯器)"
|
||
echo " 裝一次就好:brew install mingw-w64"
|
||
exit 1
|
||
}
|
||
|
||
echo "① 編 collector.exe(同綑執行檔,純 stdlib、CGO_ENABLED=0)"
|
||
( cd ../.. && GOOS=windows GOARCH=amd64 CGO_ENABLED=0 \
|
||
go build -ldflags "-s -w" -o "cmd/arcrun-app/arcrun-collector.exe" . )
|
||
|
||
# 🔴 同 build-mac.sh:wails.json 沒 info.productVersion ⇒ exe 內容資訊永遠是 1.0.0。
|
||
# Windows 使用者在「內容→詳細資料」看到的版本讀這個欄位;MSIX 送審也會對照。
|
||
PLIST_VER="${VERSION#v}"
|
||
cp wails.json wails.json.bak
|
||
python3 - "$PLIST_VER" <<'PY'
|
||
import json, sys
|
||
c = json.load(open('wails.json'))
|
||
c.setdefault('info', {})
|
||
c['info']['productVersion'] = sys.argv[1]
|
||
c['info']['productName'] = 'Arcrun'
|
||
json.dump(c, open('wails.json', 'w'), indent=2, ensure_ascii=False)
|
||
PY
|
||
trap 'mv -f wails.json.bak wails.json 2>/dev/null || true' EXIT
|
||
|
||
echo "② wails build(windows/amd64,CGo 走 mingw)"
|
||
CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc \
|
||
wails build -platform windows/amd64 -clean \
|
||
-ldflags "-X main.version=${VERSION} -X main.buildTime=${BUILD_TIME}"
|
||
|
||
OUT="dist"; mkdir -p "$OUT"
|
||
STAGE="$(mktemp -d)/Arcrun"
|
||
mkdir -p "$STAGE"
|
||
|
||
echo "③ 同綑 collector.exe(App 用 os.Executable() 找同層,見 supervise.go)"
|
||
cp build/bin/arcrun-app.exe "$STAGE/Arcrun.exe"
|
||
cp arcrun-collector.exe "$STAGE/arcrun-collector.exe"
|
||
|
||
echo "④ 打包 zip"
|
||
# 用絕對路徑:下面會 cd 進暫存目錄打包,相對路徑會找不到(實撞:zip I/O error)。
|
||
ZIP="$(cd "$OUT" && pwd)/ArcrunRAG-win-unsigned-${VERSION}.zip"
|
||
rm -f "$ZIP"
|
||
( cd "$(dirname "$STAGE")" && zip -qr "$ZIP" "Arcrun" )
|
||
rm -rf "$(dirname "$STAGE")"
|
||
|
||
SIZE=$(ls -lh "$ZIP" | awk '{print $5}')
|
||
echo "✅ 完成:${ZIP}(${SIZE})"
|
||
echo
|
||
echo "🔬 使用者流程:解壓縮 → 執行 Arcrun.exe"
|
||
echo " ⚠️ 未簽章 ⇒ SmartScreen 會攔(「更多資訊」→「仍要執行」)。"
|
||
echo " 要免除這一步=上 MS Store(見 build-msix.sh)或買 EV 憑證。"
|