name: Moltbot
options:
  bundleIdPrefix: bot.molt
  deploymentTarget:
    iOS: "18.0"
  xcodeVersion: "16.0"

settings:
  base:
    SWIFT_VERSION: "6.0"

packages:
  MoltbotKit:
    path: ../shared/MoltbotKit
  Swabble:
    path: ../../Swabble

schemes:
  Moltbot:
    shared: true
    build:
      targets:
        Moltbot: all
    test:
      targets:
        - MoltbotTests

targets:
  Moltbot:
    type: application
    platform: iOS
    sources:
      - path: Sources
    dependencies:
      - package: MoltbotKit
      - package: MoltbotKit
        product: MoltbotChatUI
      - package: MoltbotKit
        product: MoltbotProtocol
      - package: Swabble
        product: SwabbleKit
      - sdk: AppIntents.framework
    preBuildScripts:
      - name: SwiftFormat (lint)
        basedOnDependencyAnalysis: false
        inputFileLists:
          - $(SRCROOT)/SwiftSources.input.xcfilelist
        script: |
          set -euo pipefail
          export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
          if ! command -v swiftformat >/dev/null 2>&1; then
            echo "error: swiftformat not found (brew install swiftformat)" >&2
            exit 1
          fi
          swiftformat --lint --config "$SRCROOT/../../.swiftformat" \
            --filelist "$SRCROOT/SwiftSources.input.xcfilelist"
      - name: SwiftLint
        basedOnDependencyAnalysis: false
        inputFileLists:
          - $(SRCROOT)/SwiftSources.input.xcfilelist
        script: |
          set -euo pipefail
          export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
          if ! command -v swiftlint >/dev/null 2>&1; then
            echo "error: swiftlint not found (brew install swiftlint)" >&2
            exit 1
          fi
          swiftlint lint --config "$SRCROOT/.swiftlint.yml" --use-script-input-file-lists
    settings:
      base:
        CODE_SIGN_IDENTITY: "Apple Development"
        CODE_SIGN_STYLE: Manual
        DEVELOPMENT_TEAM: Y5PE65HELJ
        PRODUCT_BUNDLE_IDENTIFIER: bot.molt.ios
        PROVISIONING_PROFILE_SPECIFIER: "bot.molt.ios Development"
        SWIFT_VERSION: "6.0"
        SWIFT_STRICT_CONCURRENCY: complete
        ENABLE_APPINTENTS_METADATA: NO
    info:
      path: Sources/Info.plist
      properties:
        CFBundleDisplayName: Moltbot
        CFBundleIconName: AppIcon
        CFBundleShortVersionString: "2026.1.26"
        CFBundleVersion: "20260126"
        UILaunchScreen: {}
        UIApplicationSceneManifest:
          UIApplicationSupportsMultipleScenes: false
        UIBackgroundModes:
          - audio
        NSLocalNetworkUsageDescription: Moltbot discovers and connects to your Moltbot gateway on the local network.
        NSAppTransportSecurity:
          NSAllowsArbitraryLoadsInWebContent: true
        NSBonjourServices:
          - _moltbot-gw._tcp
        NSCameraUsageDescription: Moltbot can capture photos or short video clips when requested via the gateway.
        NSLocationWhenInUseUsageDescription: Moltbot uses your location when you allow location sharing.
        NSLocationAlwaysAndWhenInUseUsageDescription: Moltbot can share your location in the background when you enable Always.
        NSMicrophoneUsageDescription: Moltbot needs microphone access for voice wake.
        NSSpeechRecognitionUsageDescription: Moltbot uses on-device speech recognition for voice wake.
        UISupportedInterfaceOrientations:
          - UIInterfaceOrientationPortrait
          - UIInterfaceOrientationPortraitUpsideDown
          - UIInterfaceOrientationLandscapeLeft
          - UIInterfaceOrientationLandscapeRight
        UISupportedInterfaceOrientations~ipad:
          - UIInterfaceOrientationPortrait
          - UIInterfaceOrientationPortraitUpsideDown
          - UIInterfaceOrientationLandscapeLeft
          - UIInterfaceOrientationLandscapeRight

  MoltbotTests:
    type: bundle.unit-test
    platform: iOS
    sources:
      - path: Tests
    dependencies:
      - target: Moltbot
      - package: Swabble
        product: SwabbleKit
      - sdk: AppIntents.framework
    settings:
      base:
        PRODUCT_BUNDLE_IDENTIFIER: bot.molt.ios.tests
        SWIFT_VERSION: "6.0"
        SWIFT_STRICT_CONCURRENCY: complete
        TEST_HOST: "$(BUILT_PRODUCTS_DIR)/Moltbot.app/Moltbot"
        BUNDLE_LOADER: "$(TEST_HOST)"
    info:
      path: Tests/Info.plist
      properties:
        CFBundleDisplayName: MoltbotTests
        CFBundleShortVersionString: "2026.1.26"
        CFBundleVersion: "20260126"
