name: Project
include: [environments.yml, AnotherProject/project.yml]
options:
  bundleIdPrefix: com.project
  usesTabs: false
  indentWidth: 2
  tabWidth: 2
  transitivelyLinkDependencies: true
  deploymentTarget:
    watchOS: 4.0
  groupSortPosition: top
  preGenCommand: echo "This is a pre-gen command"
  postGenCommand: scripts/script.sh
  fileTypes:
    abc:
      buildPhase: none
    abcd:
      buildPhase: none
fileGroups:
  - Configs
  - FileGroup
  - SomeFile
  - Utilities
  - App_iOS/Configuration.storekit
projectReferences:
  AnotherProject:
    path: ./AnotherProject/AnotherProject.xcodeproj
configFiles:
  Test Debug: Configs/config.xcconfig
packages:
  Swinject:
    url: https://github.com/Swinject/Swinject
    version: 2.8.0
breakpoints:
  - type: File
    path: App_iOS/AppDelegate.swift
    line: 7
    condition: launchOptions == nil
    actions:
      - type: Log
        message: message
        conveyanceType: speak
  - type: File
    path: App_iOS/AppDelegate.swift
    line: 11
    column: 13
  - type: Exception
    scope: All
    stopOnStype: Catch
    actions:
      - type: DebuggerCommand
        command: po $arg1
      - type: AppleScript
        script: display alert "Exception happened!"
      - type: Sound
        sound: Blow
  - type: SwiftError
    enabled: false
  - type: OpenGLError
    ignoreCount: 2
    actions:
      - type: ShellCommand
        path: script.sh
        arguments: argument1, argument2
        waitUntilDone: true
  - type: Symbolic
    symbol: UIViewAlertForUnsatisfiableConstraints
    module: UIKitCore
    actions:
      - type: GraphicsTrace
  - type: IDEConstraintError
    continueAfterRunningActions: true
  - type: IDETestFailure
  - type: RuntimeIssue
targets:
  Legacy:
    type: ""
    platform: iOS
    legacy:
      toolPath: /usr/bin/true
      passSettings: true

  App_macOS:
    type: application
    platform: macOS
    scheme: {}
    info:
      path: App_macOS/App-Info.plist
      properties:
        LSMinimumSystemVersion: $(MACOSX_DEPLOYMENT_TARGET)
        NSMainStoryboardFile: Main
        NSPrincipalClass: NSApplication
        CFBundleIconFile: ""
        CustomSetting: $CUSTOM_SETTING
    attributes:
      ProvisioningStyle: Automatic
    sources:
      - path: App_macOS
      - path: StandaloneFiles/Standalone.swift
      - path: Vendor/SomeXPCService.xpc
      - path: NonExisting
        optional: true
    dependencies:
      - target: Framework_macOS
        copy:
            destination: plugins
            subpath: "test"
      - target: XPC Service
      - target: NetworkSystemExtension
      - target: EndpointSecuritySystemExtension
      - target: DriverKitDriver
      - sdk: Contacts.framework
      - sdk: libc++.tbd
      - sdk: libz.dylib
    putResourcesBeforeSourcesBuildPhase: true

  App_iOS:
    type: application
    platform: iOS
    attributes:
      ProvisioningStyle: Automatic
    sources:
      - StandaloneFiles/StandaloneAssets.xcassets
      - path: App_iOS
        name: App
        compilerFlags:
          - "-Werror"
        excludes:
          - "**/excluded-file"
          - "excluded-file"
          - "Model.xcmappingmodel"
          - "Configuration.storekit"
      - path: App_iOS
        name: App
        includes:
          - "Model.xcmappingmodel"
      - path: StandaloneFiles/Standalone.swift
      - FileGroup/UnderFileGroup
      - Resources/MyBundle.bundle
      - Resources/SceneKitCatalog.scnassets
      - Resources/GoogleService-Info.plist
      - path: Resources/ResourceFolder
        type: folder
      - path: Folder
        type: folder
        buildPhase: none
        group: CustomGroup
      - path: Mintfile
        type: file
        buildPhase: none
        group: CustomGroup
      - path: Group/File1.swift
        group: CustomGroup
      - path: Group2/File2.swift
        group: CustomGroup
      - path: CopyFiles
        buildPhase:
          copyFiles:
            destination: productsDirectory
            subpath: include/$(PRODUCT_NAME)
      - path: Resources/example.mp4
        buildPhase: resources
        resourceTags:
          - tag1
          - tag2
      - String Catalogs/LocalizableStrings.xcstrings
      - path: SyncedFolder
        type: syncedFolder
        excludes:
          - ExcludedFile.swift
          - Info.plist
        explicitFolders:
          - Resources
          - "**/*Tests"
      - path: SyncedParent/SyncedChild
        type: syncedFolder
        createIntermediateGroups: true
    settings:
      INFOPLIST_FILE: App_iOS/Info.plist
      PRODUCT_BUNDLE_IDENTIFIER: com.project.app
    dependencies:
      - target: Framework_iOS
        platformFilter: all
      - target: StaticLibrary_ObjC_iOS
      - target: Framework2_iOS
        weak: true
        platformFilter: iOS
      - target: App_watchOS
      - target: iMessageApp
      - sdk: Contacts.framework
      - bundle: BundleX.bundle
      - { bundle: BundleY.bundle, codeSign: false }
      - target: AnotherProject/ExternalTarget
      - target: App_Clip
      - package: Swinject
        product: Swinject
        platformFilter: iOS
# https://github.com/yonaskolb/XcodeGen/issues/1232
# After GitHub Actions start supporting Xcode 14, an example for extensionKit should be added.
#      - target: ExtensionKitExtension
    onlyCopyFilesOnInstall: true
    scheme:
      testTargets:
        - App_iOS_Tests
        - App_iOS_UITests
      gatherCoverageData: true
      coverageTargets:
        - App_iOS
      disableMainThreadChecker: true
      stopOnEveryMainThreadCheckerIssue: true
      configVariants:
        - Test
        - Staging
        - Production
      commandLineArguments:
          MyEnabledArgument: true
          MyDisabledArgument: false
      storeKitConfiguration: "App_iOS/Configuration.storekit"
    postbuildScripts:
      - path: scripts/strip-frameworks.sh
        name: Strip Unused Architectures from Frameworks
        runOnlyWhenInstalling: true
        basedOnDependencyAnalysis: false
      - name: MyScript
        script: |
          echo "You ran a script!"
          touch "${DERIVED_FILE_DIR}/target.d"
        inputFileLists:
          - App_iOS/inputList.xcfilelist
        outputFileLists:
          - App_iOS/outputList.xcfilelist
        discoveredDependencyFile: $(DERIVED_FILE_DIR)/target.d

  EntitledApp:
    type: application
    platform: iOS
    entitlements:
      path: App_iOS/App.entitlements
      properties:
        com.apple.security.application-groups: group.com.app

  App_supportedDestinations:
    type: application
    supportedDestinations: [iOS, tvOS]
    info:
      path: App_supportedDestinations/Info.generated.plist
      properties:
        CFBundleDisplayName: "TestApp"
        CFBundleVersion: "1.0.0"
    settings:
      base:
        PRODUCT_BUNDLE_IDENTIFIER: com.test.TestApp
    sources:
      - path: App_supportedDestinations/Sources
        group: App_supportedDestinations
        inferDestinationFiltersByPath: true
      - path: App_supportedDestinations/Storyboards
        group: App_supportedDestinations
        destinationFilters: [iOS]
    dependencies:
      - package: Swinject
        product: Swinject
        destinationFilters: [tvOS]

  App_watchOS:
      type: application.watchapp2
      platform: watchOS
      deploymentTarget: 4.0
      sources:
        App_watchOS
      settings:
        PRODUCT_BUNDLE_IDENTIFIER: com.project.app.watch
      dependencies:
        - target: App_watchOS Extension
      templates: [MyTemplate]

  App_watchOS Extension:
      type: watchkit2-extension
      platform: watchOS
      sources:
        App_watchOS Extension
      settings:
        PRODUCT_BUNDLE_IDENTIFIER: com.project.app.watch.extension

  iMessageApp:
    type: application.messages
    platform: iOS
    sources: iMessageApp
    scheme: {}
    dependencies:
      - target: iMessageExtension

  iMessageExtension:
    type: app-extension.messages
    platform: iOS
    sources: iMessageExtension
    settings:
      PRODUCT_BUNDLE_IDENTIFIER: com.project.iMessageApp.extension
    scheme: {}

  iMessageStickersExtension:
    type: app-extension.messages-sticker-pack
    platform: iOS
    sources:
      - path: iMessageStickers

  DriverKitDriver:
    platform: macOS
    type: driver-extension
    sources:
      - DriverKit Driver
    settings:
      PRODUCT_BUNDLE_IDENTIFIER: com.project.App-macOS.Driver
      CODE_SIGN_ENTITLEMENTS: DriverKit Driver/Driver.entitlements
      SDKROOT: driverkit
      DRIVERKIT_DEPLOYMENT_TARGET: 20.4
    scheme: {}
    dependencies:
      - sdk: DriverKit.framework

  NetworkSystemExtension:
    platform: macOS
    type: system-extension
    sources:
      - Network Extension
    settings:
      PRODUCT_BUNDLE_IDENTIFIER: com.project.App-macOS.NetworkExtension
      CODE_SIGN_ENTITLEMENTS: Network Extension/NetworkExtension.entitlements
    scheme: {}
    dependencies:
      - sdk: NetworkExtension.framework

  EndpointSecuritySystemExtension:
    platform: macOS
    type: system-extension
    sources:
      - EndpointSecurity Extension
    settings:
      PRODUCT_BUNDLE_IDENTIFIER: com.project.App-macOS.EndpointSecurity
      CODE_SIGN_ENTITLEMENTS: EndpointSecurity Extension/EndpointSecurity.entitlements
    scheme: {}
    dependencies:
      - sdk: libEndpointSecurity.tbd

  StaticLibrary_ObjC:
    type: library.static
    platform: [iOS, tvOS, watchOS, macOS]
    sources: StaticLibrary_ObjC

  StaticLibrary_Swift:
    type: library.static
    platform: iOS
    sources: StaticLibrary_Swift

  Framework:
    type: framework
    platform: [iOS, tvOS, watchOS, macOS]
    sources:
      - path: Framework
        excludes:
          - "*.xcodeproj"
      - path: Headers
        buildPhase: headers
        type: folder
        headerVisibility: public
    postbuildScripts:
      - name: MyScript
        path: scripts/script.sh
    dependencies:
      - target: StaticLibrary_ObjC_${platform}
      - target: Framework2_${platform}
        platforms: [tvOS, watchOS]

  Framework2:
    type: framework
    platform: [iOS, tvOS, watchOS, macOS]
    sources:
      - path: Framework
        excludes:
          - "*.xcodeproj"
  TestFramework:
    type: framework
    platform: iOS
    sources:
      - path: Framework
        excludes:
          - "*.xcodeproj"
    dependencies:
      - sdk: Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework
        root: DEVELOPER_DIR

  CrossOverlayFramework:
    type: framework
    platform: [iOS, tvOS, watchOS, macOS]
    sources:
      - path: CrossOverlayFramework
        excludes:
          - "*.xcodeproj"

  App_iOS_Tests:
    type: bundle.unit-test
    platform: iOS
    sources: App_iOS_Tests
    dependencies:
      - target: App_iOS
      - target: TestFramework
  App_iOS_UITests:
    type: bundle.ui-testing
    platform: iOS
    sources: App_iOS_UITests
    dependencies:
      - target: App_iOS

  App_macOS_Tests:
    type: bundle.unit-test
    platform: macOS
    sources: App_macOS_Tests
    dependencies:
      - target: App_macOS

  XPC Service:
    type: xpc-service
    platform: macOS
    sources:
      - path: XPC Service

  Tool:
    type: tool
    platform: macOS
    sources: [Tool]
    scheme: {}

  App_Clip:
    type: application.on-demand-install-capable
    platform: iOS
    entitlements:
      path: App_Clip/Clip.entitlements
      properties:
        com.apple.developer.parent-application-identifiers: [$(AppIdentifierPrefix)com.project.appwithclip]
        com.apple.security.application-groups: group.com.app
    sources:
      App_Clip
    settings:
      INFOPLIST_FILE: App_Clip/Info.plist
      PRODUCT_BUNDLE_IDENTIFIER: com.project.app.clip
    dependencies:
      - target: Framework_iOS
      - target: StaticLibrary_ObjC_iOS
      - target: AnotherProject/ExternalTarget
    scheme:
      testTargets:
        - App_Clip_Tests
        - App_Clip_UITests

  App_Clip_Tests:
    type: bundle.unit-test
    platform: iOS
    sources: App_iOS_Tests
    dependencies:
      - target: App_Clip
      - target: TestFramework

  App_Clip_UITests:
    type: bundle.ui-testing
    platform: iOS
    sources: App_Clip_UITests
    dependencies:
      - target: App_Clip
# https://github.com/yonaskolb/XcodeGen/issues/1232
# After GitHub Actions start supporting Xcode 14, an example for extensionKit should be added.
#  ExtensionKitExtension:
#    type: extensionkit-extension
#    platform: iOS
#    sources: ExtensionKit Extension

schemes:
  Framework:
    build:
      parallelizeBuild: false
      buildImplicitDependencies: false
      targets:
        Framework_iOS: all
      preActions:
        - script: echo Starting Framework Build
          settingsTarget: Framework_iOS
      runPostActionsOnFailure: true
    run:
      commandLineArguments:
        argument: YES
        argument.with.dot: YES
    test:
      gatherCoverageData: true
      language: ja
      region: en
  App_Scheme:
    build:
      targets:
        App_iOS: all
    run:
      simulateLocation:
        allow: true
        defaultLocation: Honolulu, HI, USA
      customLLDBInit: ${SRCROOT}/.lldbinit
      enableGPUFrameCaptureMode: "disabled"
      enableGPUValidationMode: false
      storeKitConfiguration: "App_iOS/Configuration.storekit"
      macroExpansion: App_iOS
    test:
      gatherCoverageData: true
      targets:
        - App_iOS_UITests
        - name: App_iOS_Tests
          parallelizable: true
          randomExecutionOrder: true
          location: New York, NY, USA
      customLLDBInit: ${SRCROOT}/.lldbinit
      testPlans:
        - path: App_iOS/App_iOS.xctestplan
targetTemplates:
  MyTemplate:
    scheme: {}
aggregateTargets:
  SuperTarget:
    attributes:
      CUSTOM: value
    targets:
      - App_iOS
      - Framework_iOS
    settings:
      MY_SETTING: hello
    buildScripts:
      - name: MyScript
        script: echo "do the thing"
