yonaskolb / XcodeGen

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

[Feature] Support for multiple deployment targets with Xcode 14 #1335

Closed amatig closed 1 year ago

amatig commented 1 year ago

Hi, I am Giovanni Amati. I am new, I have never contributed to this project but because we are using in my company XcodeGen, and we are starting a new app, it was good to have this new feature to support iOS and AppleTV in one single target.

I am starting with a minimal thing that works but need a lot of improvements and new unit tests.

Basically I changed the code to be able to filter sources (, resources) and dependencies by the array platformFilters and at the moment you need to use these settings in your app spec.

targets:
  MyApp:
    type: application
    platform: iOS
    settings:
      base:
        SUPPORTED_PLATFORMS: "appletvos appletvsimulator iphoneos iphonesimulator"
        SUPPORTS_MACCATALYST: NO
        SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD: YES
        TARGETED_DEVICE_FAMILY: "1,2,3"
    sources:
      - path: ../Project/GLEAP/Sources/Common
      - path: ../Project/GLEAP/Sources/iOS
        platformFilters: [iOS]
      - path: ../Project/GLEAP/Sources/tvOS
        platformFilters: [tvOS]
      - path: ../Project/GLEAP/Storyboards
        platformFilters: [iOS]
    dependencies:
      - package: Yams
        product: Yams
        platformFilters: [tvOS]

That becomes:

Screenshot 2023-03-15 at 18 36 22

I know, It's the first stage, but I posted this here if someone with more experice could give me an hand/guide to complete everything in the proper way.

As I said this works fine but my idea is to:

  1. change the behaviour of platform, then this is an array and we are on Xcode14 we could probably apply directly those settings without specify them and don't create anymore multiple targets with _${platform}
  2. don't add platformFilters if you are not on Xcode14
  3. probably put platformFilters in another places that I am missing
  4. add unit tests

Thanks