Xcodegen: Ability to generate plists and entitlements files.

Created on 20 Sep 2018  路  6Comments  路  Source: yonaskolb/XcodeGen

I'm looking at using XcodeGen to simplify our CI for a white-label project.

Including existing plists and entitlement files works at the moment but it would be nicer to keep the setup for these in the same place as the rest of the project/target config as yaml/json.

Has this been considered before, if not why? and is there a better way to do this that I've not found yet?

Cheers.

feature

Most helpful comment

@lukewakeford Added in #415! Let me know what you think. This will be useful in combination with targetTemplates, as you can define an iOS_app template and put all the common attributes in there

All 6 comments

Hi @lukewakeford. I'm not totally clear on what you mean. Could you explain your use-case a bit more?
From what I understand a possible solution would be a project init command. That would be what issue #18 is about. If there is support for this it could be looked at. If you'd like to work on something like that, even better 馃槃

273 also touches on this.

Also, I haven't work on it in a while but I was in the process of creating a generated starter xcodegen project to https://github.com/yonaskolb/Genesis as a customisable template

Hey @yonaskolb 馃憢

It looks like I could benefit from some of the other suggestions.

18 - Generating a basic Xcode project would require a basic Info.plist and .entitlements files?

273 - Generating new project specs based on a template would definitely benefit our white label setup.

Our white-label app has this structure:

  • Main App

    • Today Extension

    • Watch App

I've managed to re-produce our Xcode project using XcodeGen with a spec for each target which are kept generic. Each instance of our white-label app can then include these and override the configuration, provisioning, entitlements and plists as below:

include: 
  - ../app.yml
  - ../today.yml
  - ../watch.yml
name: Demo
settings:
  base:
    PRODUCT_BUNDLE_IDENTIFIER: xxxx
    GROUP_IDENTIFIER: xxxx
targets:
  App:
    sources:
      - path: Config
    settings:
      base:
        PRODUCT_BUNDLE_IDENTIFIER: com.xxxx
        INFOPLIST_FILE: Config/Production.plist
        CODE_SIGN_ENTITLEMENTS: Config/Production.entitlements
      configs:
        debug:
          PROVISIONING_PROFILE_SPECIFIER: match Development com.xxxx
        beta:
          PROVISIONING_PROFILE_SPECIFIER: match InHouse com.xxxx
        release:
          PROVISIONING_PROFILE_SPECIFIER: match AppStore com.xxxx
    dependencies:
      - target: Today
      - target: Watch

.. repeated for Today, Watch targets...

The entitlements and plist files already exist since Xcode made them for me and each white-label instance has these, but it would be nice to delete them and keep all this configuration in one spec file.

The .plist files are mostly identical across each white-label instance so I'd like to be able to include a template .plist file and then override/add just the values that change. the entitlements files are not massive (yet) but the same applies - maybe something like this:

targets: 
  App: 
    plist: 
      path: info.plist
      attributes: 
        - CFBundleName: MyAppName
        - UIStatusBarStyle: UIStatusBarStyleDefault
        - UIBackgroundModes: 
            - fetch
    entitlements: 
      path: app.entitlements
      attributes: 
        - com.apple.security.application-groups: group.xxxx.xxxx

If a path is not provided then generating an xml file with the given attributes would be sweet 馃憤

Thats where I'm at anyway. Let me know if you think this could be helpful for others or if mine is quite a specific use case.

I think something like info and entitlements could be useful and wouldn't be that hard to add.

Another level would be that if you specified an info it could even create some default values based on the type and platform, but that would be harder and require more maintenance going forward

@lukewakeford Added in #415! Let me know what you think. This will be useful in combination with targetTemplates, as you can define an iOS_app template and put all the common attributes in there

This looks excellent. Thanks so much! i'll be using this asap.

Released in 2.0.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ImLaufderZeit picture ImLaufderZeit  路  5Comments

ismetanin picture ismetanin  路  3Comments

vlozko picture vlozko  路  4Comments

thecb4 picture thecb4  路  3Comments

TheInkedEngineer picture TheInkedEngineer  路  4Comments