build-mobile.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/bash
  2. # KirinCode Mobile Build Script
  3. # Builds all three mobile platforms
  4. set -e
  5. RED='\033[0;31m'
  6. GOLD='\033[0;33m'
  7. NC='\033[0m'
  8. DIR="$(cd "$(dirname "$0")" && pwd)"
  9. echo -e "${RED}${DIR}/packages/mobile${NC}"
  10. echo ""
  11. case "${1:-all}" in
  12. ios)
  13. echo -e "${GOLD}Building iOS...${NC}"
  14. cd "$DIR/packages/mobile"
  15. npx expo prebuild --platform ios --clean
  16. cd ios
  17. pod install
  18. xcodebuild -workspace KirinCode.xcworkspace -scheme KirinCode \
  19. -configuration Release -sdk iphoneos \
  20. -archivePath build/KirinCode.xcarchive archive
  21. xcodebuild -exportArchive -archivePath build/KirinCode.xcarchive \
  22. -exportPath build -exportOptionsPlist ExportOptions.plist
  23. echo -e "${RED}✅ iOS build complete: packages/mobile/ios/build/KirinCode.ipa${NC}"
  24. ;;
  25. android)
  26. echo -e "${GOLD}Building Android...${NC}"
  27. cd "$DIR/packages/mobile"
  28. npx expo prebuild --platform android --clean
  29. cd android
  30. ./gradlew assembleRelease
  31. APK=$(find app/build/outputs/apk/release -name "*.apk" | head -1)
  32. echo -e "${RED}✅ Android build complete: $APK${NC}"
  33. ;;
  34. harmonyos)
  35. echo -e "${GOLD}HarmonyOS build requires DevEco Studio.${NC}"
  36. echo " 1. Open DevEco Studio"
  37. echo " 2. File → Open → $DIR/packages/kirincode-ohos"
  38. echo " 3. Build → Build Hap(s)"
  39. echo " 4. Output: entry/build/default/outputs/default/entry-default-signed.hap"
  40. ;;
  41. all)
  42. bash "$0" ios
  43. bash "$0" android
  44. bash "$0" harmonyos
  45. ;;
  46. *)
  47. echo "Usage: build-mobile.sh [ios|android|harmonyos|all]"
  48. ;;
  49. esac