#!/bin/bash # build.sh - Build for simulator and device # Usage: ./build.sh [simulator|device] [Debug|Release] set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_DIR="$SCRIPT_DIR/MovieMapper-iOS" SCHEME="MovieMapper-iOS" # Default values BUILD_TARGET="${1:-simulator}" BUILD_CONFIG="${2:-Debug}" # Validate configuration if [[ "$BUILD_CONFIG" != "Debug" && "$BUILD_CONFIG" != "Release" ]]; then echo "Error: Build configuration must be 'Debug' or 'Release'" exit 1 fi echo "=== MovieMapper iOS Build Script ===" echo "Target: $BUILD_TARGET" echo "Configuration: $BUILD_CONFIG" echo "" cd "$PROJECT_DIR" if [[ "$BUILD_TARGET" == "simulator" ]]; then echo "Building for iOS Simulator..." xcodebuild -scheme "$SCHEME" \ -configuration "$BUILD_CONFIG" \ -sdk iphonesimulator \ -destination 'platform=iOS Simulator,name=iPad Pro (12.9-inch) (17th generation)' \ clean build echo "" echo "✓ Build completed for iOS Simulator" elif [[ "$BUILD_TARGET" == "device" ]]; then echo "Building for iOS Device..." xcodebuild -scheme "$SCHEME" \ -configuration "$BUILD_CONFIG" \ -sdk iphoneos \ -destination 'generic/platform=iOS' \ clean build echo "" echo "✓ Build completed for iOS Device" else echo "Error: Target must be 'simulator' or 'device'" exit 1 fi