name: OpenClaw
options:
  bundleIdPrefix: ai.openclaw
  deploymentTarget:
    iOS: "18.0"
  xcodeVersion: "16.0"

settings:
  base:
    SWIFT_VERSION: "6.0"
    ENABLE_APP_INTENTS_METADATA_GENERATION: NO

packages:
  OpenClawKit:
    path: ../shared/OpenClawKit
  Swabble:
    path: ../swabble
  WebRTC:
    url: https://github.com/stasel/WebRTC.git
    exactVersion: 147.0.0

schemes:
  OpenClaw:
    shared: true
    build:
      targets:
        OpenClaw: all
    test:
      targets:
        - OpenClawTests
        - OpenClawLogicTests
  OpenClawLogicTests:
    shared: true
    build:
      targets:
        OpenClawLogicTests: all
    test:
      targets:
        - OpenClawLogicTests

targets:
  OpenClaw:
    type: application
    platform: iOS
    configFiles:
      Debug: Signing.xcconfig
      Release: Signing.xcconfig
    sources:
      - path: Sources
    dependencies:
      - target: OpenClawShareExtension
        embed: true
      - target: OpenClawActivityWidget
        embed: true
      - target: OpenClawWatchApp
      - package: OpenClawKit
      - package: OpenClawKit
        product: OpenClawChatUI
      - package: OpenClawKit
        product: OpenClawProtocol
      - package: Swabble
        product: SwabbleKit
      - package: WebRTC
      - 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/../../config/swiftformat" \
            --unexclude "$SRCROOT/Sources,$SRCROOT/ShareExtension,$SRCROOT/ActivityWidget,$SRCROOT/WatchExtension,$SRCROOT/../shared/OpenClawKit,$SRCROOT/../swabble" \
            --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_ENTITLEMENTS: Sources/OpenClaw.entitlements
        CODE_SIGN_STYLE: "$(OPENCLAW_CODE_SIGN_STYLE)"
        DEVELOPMENT_TEAM: "$(OPENCLAW_DEVELOPMENT_TEAM)"
        PRODUCT_BUNDLE_IDENTIFIER: "$(OPENCLAW_APP_BUNDLE_ID)"
        PROVISIONING_PROFILE_SPECIFIER: "$(OPENCLAW_APP_PROFILE)"
        TARGETED_DEVICE_FAMILY: "1"
        SWIFT_VERSION: "6.0"
        SWIFT_STRICT_CONCURRENCY: complete
        SUPPORTS_LIVE_ACTIVITIES: YES
        ENABLE_APPINTENTS_METADATA: NO
        ENABLE_APP_INTENTS_METADATA_GENERATION: NO
      configs:
        Debug:
          OPENCLAW_PUSH_TRANSPORT: direct
          OPENCLAW_PUSH_DISTRIBUTION: local
          OPENCLAW_PUSH_RELAY_BASE_URL: ""
          OPENCLAW_PUSH_APNS_ENVIRONMENT: sandbox
        Release:
          OPENCLAW_PUSH_TRANSPORT: direct
          OPENCLAW_PUSH_DISTRIBUTION: local
          OPENCLAW_PUSH_RELAY_BASE_URL: ""
          OPENCLAW_PUSH_APNS_ENVIRONMENT: production
    info:
      path: Sources/Info.plist
      properties:
        CFBundleDisplayName: OpenClaw
        CFBundleIconName: AppIcon
        CFBundleURLTypes:
          - CFBundleURLName: ai.openclaw.ios
            CFBundleURLSchemes:
              - openclaw
        CFBundleShortVersionString: "$(OPENCLAW_MARKETING_VERSION)"
        OpenClawCanonicalVersion: "$(OPENCLAW_IOS_VERSION)"
        CFBundleVersion: "$(OPENCLAW_BUILD_VERSION)"
        UILaunchScreen: {}
        UIApplicationSceneManifest:
          UIApplicationSupportsMultipleScenes: false
        UIBackgroundModes:
          - audio
          - remote-notification
        BGTaskSchedulerPermittedIdentifiers:
          - ai.openclaw.ios.bgrefresh
        NSLocalNetworkUsageDescription: OpenClaw discovers and connects to your OpenClaw gateway on the local network.
        NSAppTransportSecurity:
          NSAllowsArbitraryLoadsInWebContent: true
          NSAllowsLocalNetworking: true
        NSBonjourServices:
          - _openclaw-gw._tcp
        NSCameraUsageDescription: OpenClaw can capture photos or short video clips when requested via the gateway.
        NSCalendarsUsageDescription: OpenClaw uses your calendars to show events and scheduling context when you enable calendar access.
        NSCalendarsFullAccessUsageDescription: OpenClaw uses your calendars to show events and scheduling context when you enable calendar access.
        NSCalendarsWriteOnlyAccessUsageDescription: OpenClaw uses your calendars to add events when you enable calendar access.
        NSContactsUsageDescription: OpenClaw uses your contacts so you can search and reference people while using the assistant.
        NSLocationWhenInUseUsageDescription: OpenClaw uses your location when you allow location sharing.
        NSLocationAlwaysAndWhenInUseUsageDescription: OpenClaw can share your location in the background when you enable Always.
        NSMicrophoneUsageDescription: OpenClaw uses the microphone for realtime chat, voice wake, and push-to-talk.
        NSMotionUsageDescription: OpenClaw may use motion data to support device-aware interactions and automations.
        NSPhotoLibraryUsageDescription: OpenClaw needs photo library access when you choose existing photos to share with your assistant.
        NSRemindersFullAccessUsageDescription: OpenClaw uses your reminders to list, add, and complete tasks when you enable reminders access.
        NSSpeechRecognitionUsageDescription: OpenClaw uses on-device speech recognition for talk mode and voice wake.
        NSSupportsLiveActivities: true
        ITSAppUsesNonExemptEncryption: false
        OpenClawPushTransport: "$(OPENCLAW_PUSH_TRANSPORT)"
        OpenClawPushDistribution: "$(OPENCLAW_PUSH_DISTRIBUTION)"
        OpenClawPushRelayBaseURL: "$(OPENCLAW_PUSH_RELAY_BASE_URL)"
        OpenClawPushAPNsEnvironment: "$(OPENCLAW_PUSH_APNS_ENVIRONMENT)"
        UISupportedInterfaceOrientations:
          - UIInterfaceOrientationPortrait
          - UIInterfaceOrientationPortraitUpsideDown
          - UIInterfaceOrientationLandscapeLeft
          - UIInterfaceOrientationLandscapeRight
        UISupportedInterfaceOrientations~ipad:
          - UIInterfaceOrientationPortrait
          - UIInterfaceOrientationPortraitUpsideDown
          - UIInterfaceOrientationLandscapeLeft
          - UIInterfaceOrientationLandscapeRight

  OpenClawShareExtension:
    type: app-extension
    platform: iOS
    configFiles:
      Debug: Signing.xcconfig
      Release: Signing.xcconfig
    sources:
      - path: ShareExtension
    dependencies:
      - package: OpenClawKit
      - sdk: AppIntents.framework
    settings:
      base:
        CODE_SIGN_IDENTITY: "Apple Development"
        CODE_SIGN_STYLE: "$(OPENCLAW_CODE_SIGN_STYLE)"
        DEVELOPMENT_TEAM: "$(OPENCLAW_DEVELOPMENT_TEAM)"
        ENABLE_APPINTENTS_METADATA: NO
        ENABLE_APP_INTENTS_METADATA_GENERATION: NO
        PRODUCT_BUNDLE_IDENTIFIER: "$(OPENCLAW_SHARE_BUNDLE_ID)"
        PROVISIONING_PROFILE_SPECIFIER: "$(OPENCLAW_SHARE_PROFILE)"
        SWIFT_VERSION: "6.0"
        SWIFT_STRICT_CONCURRENCY: complete
    info:
      path: ShareExtension/Info.plist
      properties:
        CFBundleDisplayName: OpenClaw Share
        CFBundleShortVersionString: "$(OPENCLAW_MARKETING_VERSION)"
        CFBundleVersion: "$(OPENCLAW_BUILD_VERSION)"
        NSExtension:
          NSExtensionPointIdentifier: com.apple.share-services
          NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).ShareViewController"
          NSExtensionAttributes:
            NSExtensionActivationRule:
              NSExtensionActivationSupportsText: true
              NSExtensionActivationSupportsWebURLWithMaxCount: 1
              NSExtensionActivationSupportsImageWithMaxCount: 10
              NSExtensionActivationSupportsMovieWithMaxCount: 1

  OpenClawActivityWidget:
    type: app-extension
    platform: iOS
    configFiles:
      Debug: Signing.xcconfig
      Release: Signing.xcconfig
    sources:
      - path: ActivityWidget
      - path: Sources/LiveActivity/OpenClawActivityAttributes.swift
    dependencies:
      - sdk: WidgetKit.framework
      - sdk: ActivityKit.framework
    settings:
      base:
        CODE_SIGN_IDENTITY: "Apple Development"
        CODE_SIGN_STYLE: "$(OPENCLAW_CODE_SIGN_STYLE)"
        DEVELOPMENT_TEAM: "$(OPENCLAW_DEVELOPMENT_TEAM)"
        PRODUCT_BUNDLE_IDENTIFIER: "$(OPENCLAW_ACTIVITY_WIDGET_BUNDLE_ID)"
        SWIFT_VERSION: "6.0"
        SWIFT_STRICT_CONCURRENCY: complete
        SUPPORTS_LIVE_ACTIVITIES: YES
    info:
      path: ActivityWidget/Info.plist
      properties:
        CFBundleDisplayName: OpenClaw Activity
        CFBundleShortVersionString: "$(OPENCLAW_MARKETING_VERSION)"
        CFBundleVersion: "$(OPENCLAW_BUILD_VERSION)"
        NSSupportsLiveActivities: true
        NSExtension:
          NSExtensionPointIdentifier: com.apple.widgetkit-extension

  OpenClawWatchApp:
    type: application.watchapp2
    platform: watchOS
    deploymentTarget: "11.0"
    sources:
      - path: WatchApp
    dependencies:
      - target: OpenClawWatchExtension
    configFiles:
      Debug: Config/Signing.xcconfig
      Release: Config/Signing.xcconfig
    attributes:
      DevelopmentTeam: "$(OPENCLAW_DEVELOPMENT_TEAM)"
      ProvisioningStyle: "$(OPENCLAW_CODE_SIGN_STYLE)"
    settings:
      base:
        ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon
        CODE_SIGN_IDENTITY: "Apple Development"
        CODE_SIGN_STYLE: "$(OPENCLAW_CODE_SIGN_STYLE)"
        DEVELOPMENT_TEAM: "$(OPENCLAW_DEVELOPMENT_TEAM)"
        ENABLE_APPINTENTS_METADATA: NO
        ENABLE_APP_INTENTS_METADATA_GENERATION: NO
        PRODUCT_BUNDLE_IDENTIFIER: "$(OPENCLAW_WATCH_APP_BUNDLE_ID)"
        PROVISIONING_PROFILE_SPECIFIER: "$(OPENCLAW_WATCH_APP_PROFILE)"
    info:
      path: WatchApp/Info.plist
      properties:
        CFBundleDisplayName: OpenClaw
        CFBundleShortVersionString: "$(OPENCLAW_MARKETING_VERSION)"
        CFBundleVersion: "$(OPENCLAW_BUILD_VERSION)"
        WKCompanionAppBundleIdentifier: "$(OPENCLAW_APP_BUNDLE_ID)"
        WKWatchKitApp: true

  OpenClawWatchExtension:
    type: watchkit2-extension
    platform: watchOS
    deploymentTarget: "11.0"
    sources:
      - path: WatchExtension/Sources
    dependencies:
      - sdk: AppIntents.framework
      - sdk: WatchConnectivity.framework
      - sdk: UserNotifications.framework
    configFiles:
      Debug: Config/Signing.xcconfig
      Release: Config/Signing.xcconfig
    attributes:
      DevelopmentTeam: "$(OPENCLAW_DEVELOPMENT_TEAM)"
      ProvisioningStyle: "$(OPENCLAW_CODE_SIGN_STYLE)"
    settings:
      base:
        CODE_SIGN_IDENTITY: "Apple Development"
        CODE_SIGN_STYLE: "$(OPENCLAW_CODE_SIGN_STYLE)"
        DEVELOPMENT_TEAM: "$(OPENCLAW_DEVELOPMENT_TEAM)"
        PRODUCT_BUNDLE_IDENTIFIER: "$(OPENCLAW_WATCH_EXTENSION_BUNDLE_ID)"
        PROVISIONING_PROFILE_SPECIFIER: "$(OPENCLAW_WATCH_EXTENSION_PROFILE)"
    info:
      path: WatchExtension/Info.plist
      properties:
        CFBundleDisplayName: OpenClaw
        CFBundleShortVersionString: "$(OPENCLAW_MARKETING_VERSION)"
        CFBundleVersion: "$(OPENCLAW_BUILD_VERSION)"
        NSExtension:
          NSExtensionAttributes:
            WKAppBundleIdentifier: "$(OPENCLAW_WATCH_APP_BUNDLE_ID)"
          NSExtensionPointIdentifier: com.apple.watchkit

  OpenClawTests:
    type: bundle.unit-test
    platform: iOS
    configFiles:
      Debug: Signing.xcconfig
      Release: Signing.xcconfig
    sources:
      - path: Tests
        excludes:
          - Logic
    dependencies:
      - target: OpenClaw
      - package: Swabble
        product: SwabbleKit
      - sdk: AppIntents.framework
    settings:
      base:
        CODE_SIGN_IDENTITY: "Apple Development"
        CODE_SIGN_STYLE: "$(OPENCLAW_CODE_SIGN_STYLE)"
        DEVELOPMENT_TEAM: "$(OPENCLAW_DEVELOPMENT_TEAM)"
        PRODUCT_BUNDLE_IDENTIFIER: ai.openclaw.ios.tests
        ENABLE_APP_INTENTS_METADATA_GENERATION: NO
        SWIFT_VERSION: "6.0"
        SWIFT_STRICT_CONCURRENCY: complete
        TEST_HOST: "$(BUILT_PRODUCTS_DIR)/OpenClaw.app/OpenClaw"
        BUNDLE_LOADER: "$(TEST_HOST)"
    info:
      path: Tests/Info.plist
      properties:
        CFBundleDisplayName: OpenClawTests
        CFBundleShortVersionString: "$(OPENCLAW_MARKETING_VERSION)"
        CFBundleVersion: "$(OPENCLAW_BUILD_VERSION)"

  OpenClawLogicTests:
    type: bundle.unit-test
    platform: iOS
    configFiles:
      Debug: Signing.xcconfig
      Release: Signing.xcconfig
    sources:
      - path: Tests/Logic
    dependencies:
      - package: OpenClawKit
    settings:
      base:
        CODE_SIGN_IDENTITY: "Apple Development"
        CODE_SIGN_STYLE: "$(OPENCLAW_CODE_SIGN_STYLE)"
        DEVELOPMENT_TEAM: "$(OPENCLAW_DEVELOPMENT_TEAM)"
        PRODUCT_BUNDLE_IDENTIFIER: ai.openclaw.ios.logic-tests
        ENABLE_APP_INTENTS_METADATA_GENERATION: NO
        SWIFT_EMIT_CONST_VALUE_PROTOCOLS: ""
        SWIFT_VERSION: "6.0"
        SWIFT_STRICT_CONCURRENCY: complete
    info:
      path: Tests/Info.plist
      properties:
        CFBundleDisplayName: OpenClawLogicTests
        CFBundleShortVersionString: "$(OPENCLAW_MARKETING_VERSION)"
        CFBundleVersion: "$(OPENCLAW_BUILD_VERSION)"
