Files
arcrun-collector/cmd/arcrun-app/build-mac.sh
T
Leo 133bfdbc84 修 Info.plist 版本永遠是 1.0.0+skill 補「用戶視角驗收」
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>
2026-08-05 16:52:34 +08:00

50 lines
2.3 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# build-mac.sh — 打包 Arcrun.appWails 版,t194
#
# 與 fyne 版最重要的差別:**要把 collector 同綑進 .app**。
# daemon 的本體是 `collector direct`(監看/萃卡/上傳),App 只是它的門面;
# 沒同綑 ⇒ 裝了也不會同步。
set -euo pipefail
cd "$(dirname "$0")"
VERSION="${VERSION:-$(git describe --tags --always --dirty 2>/dev/null || echo dev)}"
export PATH="$PATH:$(go env GOPATH)/bin"
echo "🏷 版本:${VERSION}"
echo "① 編 collector(同綑執行檔,純 stdlib、CGO_ENABLED=0"
( cd ../.. && CGO_ENABLED=0 go build -ldflags "-s -w" -o "cmd/arcrun-app/arcrun-collector" . )
# 🔴 2026-08-05leo 開 DMG 檢查時抓到):Info.plist 的 CFBundleShortVersionString
# 是 **1.0.0**(Wails 預設),不是我們的版本號——因為 wails.json 沒有 info.productVersion
# 而 `wails build` **沒有** CLI 旗標可指定。
# ⇒ 建置前把版本寫進 wails.json 的 info,建完還原(不污染版控)。
# 為什麼要修:使用者「關於」看到的、以及 Finder 顯示的版本都讀這個欄位;
# 永遠顯示 1.0.0 ⇒ 用戶無從判斷自己是不是新版(同 leo「版本號是唯一驗收介面」的病)。
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"
wails build -clean -ldflags "-X main.version=${VERSION}"
APP="build/bin/Arcrun.app"
[ -d "build/bin/arcrun-app.app" ] && { rm -rf "$APP"; mv "build/bin/arcrun-app.app" "$APP"; }
echo "③ 同綑 collector 進 .appApp 用 os.Executable() 找同層)"
cp arcrun-collector "$APP/Contents/MacOS/arcrun-collector"
echo "④ ad-hoc 重簽(改過 bundle 內容必重簽,否則 launchd 拒開)"
codesign --force --deep --sign - "$APP" 2>/dev/null || true
rm -f arcrun-collector
echo "✅ 完成:$APP"
echo " 驗法:open '$APP' → 選單列出現 icon、Dock **不出現** icon"
echo " 點 icon → 立刻展開視窗;右鍵 → 只有「結束 Arcrun」"