#!/bin/bash # Development build script that creates a proper .app bundle for easier permission management set -e PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" BUILD_DIR="$PROJECT_DIR/.build" DEV_APP_DIR="$BUILD_DIR/MenuWhisper-Dev.app" echo "🔨 Building MenuWhisper for development..." # Clean previous dev build rm -rf "$DEV_APP_DIR" # Build the executable swift build -c debug # Create app bundle structure mkdir -p "$DEV_APP_DIR/Contents/MacOS" mkdir -p "$DEV_APP_DIR/Contents/Resources" # Copy executable cp "$BUILD_DIR/arm64-apple-macosx/debug/MenuWhisper" "$DEV_APP_DIR/Contents/MacOS/MenuWhisper" # Create Info.plist cat > "$DEV_APP_DIR/Contents/Info.plist" << EOF CFBundleExecutable MenuWhisper CFBundleIdentifier com.menuwhisper.dev CFBundleName MenuWhisper Dev CFBundlePackageType APPL CFBundleVersion 1.0.0-dev CFBundleShortVersionString 1.0.0-dev NSHighResolutionCapable LSUIElement NSMicrophoneUsageDescription MenuWhisper needs microphone access to capture speech for transcription. EOF # Copy resources if they exist if [ -d "$PROJECT_DIR/Sources/App/Resources" ]; then cp -r "$PROJECT_DIR/Sources/App/Resources/"* "$DEV_APP_DIR/Contents/Resources/" 2>/dev/null || true fi echo "✅ Development app bundle created at: $DEV_APP_DIR" echo "" echo "To run with proper permissions:" echo "1. open '$DEV_APP_DIR'" echo "2. Grant permissions in System Settings" echo "3. Or run: '$DEV_APP_DIR/Contents/MacOS/MenuWhisper'" echo "" echo "The app bundle makes it easier to grant permissions in System Settings."