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

50
scripts/build_ios.sh Normal file
View File

@@ -0,0 +1,50 @@
#!/usr/bin/env bash
# iOS Release IPA 打包脚本
#
# Usage:
# bash scripts/build_ios.sh # 使用默认 configdev 配置)
# bash scripts/build_ios.sh prod # 写入 prod 配置后打包CI 使用)
#
# Via melos:
# melos run build:ios
#
# 产物路径:
# IPA → apps/im_app/build/ios/ipa/im_app.ipa
# 符号表 → apps/im_app/build/debug-info/ios/(保留用于线上崩溃还原堆栈)
#
# 前置条件:
# - macOS 环境,已安装 Xcode
# - 已配置签名证书Release scheme 需绑定正式 Provisioning Profile
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/ios"
# ── 可选:写入 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 iOS release IPA..."
cd "$APP_DIR"
flutter build ipa \
--release \
--dart-define-from-file=config/config.json \
--split-debug-info="$DEBUG_INFO_DIR" \
--obfuscate
echo ""
echo "✓ IPA: $APP_DIR/build/ios/ipa/im_app.ipa"
echo "✓ 符号表: $DEBUG_INFO_DIR(请妥善保存,用于线上崩溃堆栈还原)"