#!/bin/bash # iOS 项目编译脚本 set -e echo "=== 检查 Xcode 路径 ===" if ! xcode-select -p | grep -q "Xcode.app"; then echo "❌ 错误: 需要设置 Xcode 路径" echo "请运行: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer" exit 1 fi echo "✅ Xcode 路径正确" echo "" echo "=== 编译 BaseCore 模块 ===" cd BaseCore swift build -c debug 2>&1 | grep -E "(error|warning|Compiling|Building)" || echo "✅ BaseCore 编译成功" cd .. echo "" echo "=== 编译 BaseCommon 模块 ===" cd BaseCommon swift build -c debug 2>&1 | grep -E "(error|warning|Compiling|Building)" || echo "✅ BaseCommon 编译成功" cd .. echo "" echo "=== 编译主应用项目 ===" xcodebuild -project xdz/xdz.xcodeproj \ -scheme xdz \ -sdk iphonesimulator \ -destination 'platform=iOS Simulator,name=iPhone 15' \ clean build 2>&1 | grep -E "(error|warning|BUILD SUCCEEDED|BUILD FAILED)" || true echo "" echo "✅ 编译完成"