yonaskolb / XcodeGen

A Swift command line tool for generating your Xcode project
MIT License
7.03k stars 818 forks source link

Generate default shared schemes? #215

Open yonaskolb opened 6 years ago

yonaskolb commented 6 years ago

At the moment shared schemes are only generated if they are defined in target.scheme or schemes. The problem is if someone wants to generate a simple shared scheme with no special options, the best way is to specify a target scheme with no options which looks a bit weird.

targets:
  MyTarget:
    scheme: {}

This issue is highlighted here https://github.com/yonaskolb/XcodeGen/issues/57

When Xcode opens a project it creates default private schemes for each target if they don't exist already. What we could do is generate a default shared scheme for each target, possibly just app targets. You could still provide options for this via target.scheme, and if a top level scheme with the same name was created, it would override this default scheme. Possibly this could even live behind an option. Thoughts?

pepicrft commented 6 years ago

Given that developers using XcodeGen will very likely not include the Xcode project in the repository, I'd default a shared scheme for each target. I think it's better than having to define an empty dictionary in the yaml. I can't think of a case where you don't want a shared scheme to be generated.

LinusU commented 6 years ago

I would love to have XcodeGen generate shared schemes so that I can use it together with libraries installable via Carthage.

My plan is to have the project.yml file committed, and then have a release process which would generate the Xcode config, commit it to a separate branch and tag the release. That way I would get all the benefits of not having Xcode-projects checked in, but it would still work together with Carthage!

LinusU commented 6 years ago

If anyone else is interested in this, here is the project.yml that I'm currently using: https://github.com/LinusU/BioPass/blob/acab045b72041dee3289830a6215f7ac9be8a479/project.yml

toshi0383 commented 6 years ago

Xcode does not generate shared schemes automatically, so I think we should stick with that behavior. Which schemes to generate is up to each member of the project, so I would add --shared-targets option. (as mentioned in #57 ) xcodegen --shared-targets "App AppTests Lib LibTests" This would generate additional xcscheme if ones are not specified in project.yml. This way one can generate missing xcschemes on the fly (e.g. on CI server).

yonaskolb commented 6 years ago

@LinusU The spec you linked to has a scheme: {} so will generate a shared scheme for your purposes.

@toshi0383 making it configurable via the command line is an interesting option, but I don't see any cases where you'd only sometimes want that, so it seems it's better to define it in the project.yml

yonaskolb commented 6 years ago

Perhaps an option called generateDefaultSchemes?

pm-dev commented 4 months ago

@yonaskolb I'd like to be able to turn off the "Autocreate Schemes" option. (Also discussed here) At the time this issue was opened, xcodeproj didn't support this, but it looks like it now does.

https://github.com/tuist/XcodeProj/pull/399