Initial project

This commit is contained in:
Cody
2026-03-06 14:56:17 +08:00
parent 977b627b15
commit bf9e099747
1180 changed files with 50973 additions and 0 deletions

48
scripts/build_windows.sh Normal file
View File

@@ -0,0 +1,48 @@
#!/usr/bin/env bash
# Windows Release 打包脚本
#
# Usage:
# bash scripts/build_windows.sh # 使用默认 configdev 配置)
# bash scripts/build_windows.sh prod # 写入 prod 配置后打包CI 使用)
#
# Via melos:
# melos run build:windows
#
# 产物路径:
# EXE → apps/im_app/build/windows/x64/runner/Release/
# 符号表 → apps/im_app/build/debug-info/windows/
#
# 注意:需在 Windows 环境下运行(或 Windows CI Runner
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
APP_DIR="$ROOT_DIR/apps/im_app"
CONFIG_FILE="$APP_DIR/config/config.json"
DEBUG_INFO_DIR="$APP_DIR/build/debug-info/windows"
# ── 可选:写入 prod 配置 ────────────────────────────────────────────────────
if [ "${1:-}" = "prod" ]; then
echo "==> Writing prod config..."
cat > "$CONFIG_FILE" <<EOF
{
"IS_DEV": false,
"API_BASE_URL": "${PROD_API_BASE_URL:?PROD_API_BASE_URL is not set}"
}
EOF
fi
# ── 打包 ────────────────────────────────────────────────────────────────────
echo "==> Building Windows release..."
cd "$APP_DIR"
flutter build windows \
--release \
--dart-define-from-file=config/config.json \
--split-debug-info="$DEBUG_INFO_DIR" \
--obfuscate
echo ""
echo "✓ EXE: $APP_DIR/build/windows/x64/runner/Release/"
echo "✓ 符号表: $DEBUG_INFO_DIR(请妥善保存,用于线上崩溃堆栈还原)"