#!/bin/bash # KirinCode Mobile Build Script # Builds all three mobile platforms set -e RED='\033[0;31m' GOLD='\033[0;33m' NC='\033[0m' DIR="$(cd "$(dirname "$0")" && pwd)" echo -e "${RED}${DIR}/packages/mobile${NC}" echo "" case "${1:-all}" in ios) echo -e "${GOLD}Building iOS...${NC}" cd "$DIR/packages/mobile" npx expo prebuild --platform ios --clean cd ios pod install xcodebuild -workspace KirinCode.xcworkspace -scheme KirinCode \ -configuration Release -sdk iphoneos \ -archivePath build/KirinCode.xcarchive archive xcodebuild -exportArchive -archivePath build/KirinCode.xcarchive \ -exportPath build -exportOptionsPlist ExportOptions.plist echo -e "${RED}✅ iOS build complete: packages/mobile/ios/build/KirinCode.ipa${NC}" ;; android) echo -e "${GOLD}Building Android...${NC}" cd "$DIR/packages/mobile" npx expo prebuild --platform android --clean cd android ./gradlew assembleRelease APK=$(find app/build/outputs/apk/release -name "*.apk" | head -1) echo -e "${RED}✅ Android build complete: $APK${NC}" ;; harmonyos) echo -e "${GOLD}HarmonyOS build requires DevEco Studio.${NC}" echo " 1. Open DevEco Studio" echo " 2. File → Open → $DIR/packages/kirincode-ohos" echo " 3. Build → Build Hap(s)" echo " 4. Output: entry/build/default/outputs/default/entry-default-signed.hap" ;; all) bash "$0" ios bash "$0" android bash "$0" harmonyos ;; *) echo "Usage: build-mobile.sh [ios|android|harmonyos|all]" ;; esac