build_ios.sh 973 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash
  2. # iOS 项目编译脚本
  3. set -e
  4. echo "=== 检查 Xcode 路径 ==="
  5. if ! xcode-select -p | grep -q "Xcode.app"; then
  6. echo "❌ 错误: 需要设置 Xcode 路径"
  7. echo "请运行: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer"
  8. exit 1
  9. fi
  10. echo "✅ Xcode 路径正确"
  11. echo ""
  12. echo "=== 编译 BaseCore 模块 ==="
  13. cd BaseCore
  14. swift build -c debug 2>&1 | grep -E "(error|warning|Compiling|Building)" || echo "✅ BaseCore 编译成功"
  15. cd ..
  16. echo ""
  17. echo "=== 编译 BaseCommon 模块 ==="
  18. cd BaseCommon
  19. swift build -c debug 2>&1 | grep -E "(error|warning|Compiling|Building)" || echo "✅ BaseCommon 编译成功"
  20. cd ..
  21. echo ""
  22. echo "=== 编译主应用项目 ==="
  23. xcodebuild -project xdz/xdz.xcodeproj \
  24. -scheme xdz \
  25. -sdk iphonesimulator \
  26. -destination 'platform=iOS Simulator,name=iPhone 15' \
  27. clean build 2>&1 | grep -E "(error|warning|BUILD SUCCEEDED|BUILD FAILED)" || true
  28. echo ""
  29. echo "✅ 编译完成"