63 lines
1.6 KiB
Bash
Raw Permalink 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.

#!/bin/bash
# Mobile EDA 构建脚本
# 用法: ./scripts/build.sh [debug|release] [android|ios]
set -e
BUILD_TYPE="${1:-debug}"
PLATFORM="${2:-android}"
echo "🔨 开始构建 Mobile EDA"
echo " 类型:$BUILD_TYPE"
echo " 平台:$PLATFORM"
# 检查 Flutter 环境
if ! command -v flutter &> /dev/null; then
echo "❌ 错误:未找到 Flutter请先安装 Flutter SDK"
exit 1
fi
flutter doctor
# 安装依赖
echo "📦 安装依赖..."
flutter pub get
# 生成代码Isar
echo "🔧 生成代码..."
flutter pub run build_runner build --delete-conflicting-outputs
# 构建
case "$PLATFORM" in
android)
if [ "$BUILD_TYPE" = "release" ]; then
echo "📱 构建 Android Release..."
flutter build apk --release
echo "✅ APK 路径build/app/outputs/flutter-apk/app-release.apk"
else
echo "📱 构建 Android Debug..."
flutter build apk --debug
echo "✅ APK 路径build/app/outputs/flutter-apk/app-debug.apk"
fi
;;
ios)
if [ "$BUILD_TYPE" = "release" ]; then
echo "🍎 构建 iOS Release..."
flutter build ios --release
echo "✅ iOS 构建完成"
else
echo "🍎 构建 iOS Debug..."
flutter build ios --debug --no-codesign
echo "✅ iOS 构建完成"
fi
;;
*)
echo "❌ 错误:不支持的平台 $PLATFORM"
echo " 支持的平台android, ios"
exit 1
;;
esac
echo "🎉 构建完成!"