Search code examples
xcodeautomationxcodegen

Custom configurations with XcodeGen


I'm trying to automate the process of setting up a new app with XcodeGen. How can I achieve custom Project Configurations like in the screenshot with a YML file?

enter image description here

I expected to be able to do it like this, like the docs say:

name: Test1
settings:
  configs:
    Alpha: alpha-com.company.Test1
    Beta: beta-com.company.Test1
    Debug: debug-com.company.Test1
    Release: com.company.Test1
options:
  bundleIdPrefix: com.company
targets:
  Test1:
    type: application
    platform: iOS
    sources: Test1
  Test1Tests:
    type: bundle.unit-test
    platform: iOS
    schemetestTargets: Test1Tests
    sources: Test1Tests

But this doesn't work. I have tried several options, like removing the settings Level above it, placing it in the target setting with & without config level. Any help would be much appreciated


Solution

  • This is what achieves the desired result:

    configs:
      Alpha: release
      Beta: release
      Debug: debug
      Release: release
    targets:
      Test1:
        settings:
          configs:
            Alpha:
              PRODUCT_BUNDLE_IDENTIFIER: alpha-com.company.Test1
            Beta:
              PRODUCT_BUNDLE_IDENTIFIER: beta-com.company.Test1
            ...