project.yml

name: Restless
options:
  bundleIdPrefix: me.kainoa
  deploymentTarget:
    macOS: "26.0"
  createIntermediateGroups: true
  groupSortPosition: top

settings:
  base:
    MARKETING_VERSION: "1.0"
    CURRENT_PROJECT_VERSION: "1"
    SWIFT_VERSION: "5.0"
    # Ad-hoc sign for local builds. For a working helper + a shippable build,
    # set DEVELOPMENT_TEAM and a "Developer ID Application" identity (see README).
    CODE_SIGN_IDENTITY: "-"
    CODE_SIGN_STYLE: Manual
    DEVELOPMENT_TEAM: "VW9NDM428H"

packages:
  Sparkle:
    url: https://github.com/sparkle-project/Sparkle
    from: 2.9.4

targets:
  Restless:
    type: application
    platform: macOS
    sources:
      - path: Sources
      - path: Shared
      # The Icon Composer icon, with light, dark and tinted appearances.
      - path: icon/AppIcon.icon
      # Amped's and OpenUsage's MIT notices have to ship with the app, not just sit in the repo.
      - path: LICENSE
        buildPhase: resources
      - path: THIRD_PARTY_NOTICES.md
        buildPhase: resources
      - path: RestlessControl/ControlIntents.swift
    dependencies:
      - package: Sparkle
      - target: RestlessControl
        embed: true
      - target: RestlessHelper
        copy:
          destination: executables
          # Don't re-sign on copy — that clobbers the helper's own Developer ID
          # signature with ad-hoc. The helper is signed by its target; the app's
          # final signing seals it.
          codeSign: false
    postBuildScripts:
      - name: Embed LaunchDaemon plist
        basedOnDependencyAnalysis: false
        script: |
          set -e
          DEST="${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/Library/LaunchDaemons"
          mkdir -p "$DEST"
          cp "${SRCROOT}/Helper/me.kainoa.Restless.Helper.plist" "$DEST/"
    entitlements:
      path: Resources/Restless.entitlements
      properties:
        com.apple.security.application-groups:
          - VW9NDM428H.me.kainoa.Restless
    settings:
      base:
        PRODUCT_NAME: Restless
        PRODUCT_BUNDLE_IDENTIFIER: me.kainoa.Restless
        ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon
        ENABLE_HARDENED_RUNTIME: YES
        COMBINE_HIDPI_IMAGES: YES
    info:
      path: Resources/Info.plist
      properties:
        CFBundleDisplayName: Restless
        CFBundleShortVersionString: "$(MARKETING_VERSION)"
        CFBundleVersion: "$(CURRENT_PROJECT_VERSION)"
        LSMinimumSystemVersion: "26.0"
        LSUIElement: true
        NSHumanReadableCopyright: "Copyright © 2026 Kainoa Newton"
        # Sparkle reads the appcast that each release attaches; only updates signed with this key install.
        SUFeedURL: https://github.com/notkainoa/restless/releases/latest/download/appcast.xml
        SUPublicEDKey: D56TIcKaeoVqewuYpc6Yy7dBcVkdtTrNsakrHVK4930=
        # Check in the background from the first launch instead of asking first; Settings can turn it off.
        SUEnableAutomaticChecks: true

  RestlessControl:
    type: app-extension
    platform: macOS
    sources:
      - path: RestlessControl
      - path: Shared/RestlessDefaults.swift
    entitlements:
      path: RestlessControl/RestlessControl.entitlements
      properties:
        com.apple.security.app-sandbox: true
        com.apple.security.application-groups:
          - VW9NDM428H.me.kainoa.Restless
    settings:
      base:
        PRODUCT_NAME: RestlessControl
        PRODUCT_BUNDLE_IDENTIFIER: me.kainoa.Restless.RestlessControl
        ENABLE_HARDENED_RUNTIME: YES
        SKIP_INSTALL: YES
        SWIFT_ACTIVE_COMPILATION_CONDITIONS: "$(inherited) RESTLESS_CONTROL_EXTENSION"
    info:
      path: RestlessControl/Info.plist
      properties:
        CFBundleDisplayName: Restless
        CFBundleShortVersionString: "$(MARKETING_VERSION)"
        CFBundleVersion: "$(CURRENT_PROJECT_VERSION)"
        NSExtension:
          NSExtensionPointIdentifier: com.apple.widgetkit-extension

  RestlessHelper:
    type: tool
    platform: macOS
    sources:
      - path: Helper
        excludes:
          - "*.plist"
      - path: Shared
    settings:
      base:
        PRODUCT_NAME: RestlessHelper
        PRODUCT_BUNDLE_IDENTIFIER: me.kainoa.Restless.Helper
        GENERATE_INFOPLIST_FILE: YES
        CREATE_INFOPLIST_SECTION_IN_BINARY: YES
        SKIP_INSTALL: YES
        ENABLE_HARDENED_RUNTIME: YES