Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify additional build/run targets for target-scheme #1456

Open
Uki19 opened this issue Feb 27, 2024 · 2 comments
Open

Specify additional build/run targets for target-scheme #1456

Uki19 opened this issue Feb 27, 2024 · 2 comments

Comments

@Uki19
Copy link

Uki19 commented Feb 27, 2024

Similarly to testTargets, it would be useful to be able to define additional targets within target-scheme.

For example, Widgets target scheme should have AppTarget added as build target, but currently it doesn't seem possible.

targets:
  AppTarget:
     ...
     
  Widgets:
      type: app-extension
      subtype: widgetkit-extension
      platform: iOS
      deploymentTarget: 15.0
      configFiles:
        DEV Debug: some-dev.xcconfig
        DEV Release: some-dev.xcconfig
        PROD Debug: some-prod.xcconfig
        PROD Release: some-prod.xcconfig
      scheme:
        configVariants:
          - DEV
          - PROD

It is possible to do using top level scheme, but since we have 3+ configVariants in 3+ app "flavours" (whitelabel app), we'd like to rely on using configVariants and avoid manually specifying scheme for each target/config/flavour combination

@Uki19 Uki19 changed the title Specify additional build targets for target-scheme Specify additional build/run targets for target-scheme Feb 27, 2024
@yonaskolb
Copy link
Owner

@Uki19 do you have a proposal for how this would look? Also if using the more fully featured schemes is difficult, there are also scheme templates that may cut down on the boilerplate required for you, if you weren't aware of them https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#scheme-template

@Uki19
Copy link
Author

Uki19 commented Apr 8, 2024

for example, there could be buildTargets or additionalTargets, like there's testTargets option:

targets:
  AppTarget:
     ...
     
  Widgets:
      type: app-extension
      subtype: widgetkit-extension
      platform: iOS
      deploymentTarget: 15.0
      configFiles:
        DEV Debug: some-dev.xcconfig
        DEV Release: some-dev.xcconfig
        PROD Debug: some-prod.xcconfig
        PROD Release: some-prod.xcconfig
      scheme:
        configVariants:
          - DEV
          - PROD
        buildTargets: <-- here
           - AppTarget: all
           - AppIntentsExtension: all
           ...

AppTarget name could be derived via target_name variable, or passed in as templateAttributes:

// templates:
Widgets:
    ...
    buildTargets: <-- here
      - ${mainTargetName}: all
      - ${mainTargetName}ntentsExtension: all

// actual targets:
targets:
    AppWidgets:
       templates:
         - Widgets
       templateAttributes:
         mainTargetName: App

We ended up using schemeTemplates for now which did reduce the boilerplate, but this could help us improve it even further 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants