yonaskolb / XcodeGen

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

How to have a build settings defined in "base", while customising it further in "config/Release"? #1371

Open acecilia opened 1 year ago

acecilia commented 1 year ago

Hi πŸ‘‹

I have the following spec:

...
settings:
  base:
    OTHER_SWIFT_FLAGS:
      - -Xfrontend
      - -warn-long-expression-type-checking=500
      - -Xfrontend
      - -warn-long-function-bodies=1000

  configs:
    Release:
      OTHER_SWIFT_FLAGS:
        - -Xfrontend 
        - -internalize-at-link
...

The intended behaviour is that:

The reality (which is somewhat expected) is that:

Is there any way to achieve the intended behaviour?

Thanks! πŸ™

yonaskolb commented 1 year ago

Build settings are currently merged by simply replacing the keys, so this isn't possible right now as far as I'm aware. include specs however are merged by appending arrays to each other as you can read about here https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#include, so this could technically be ported over to build settings, though it would be a breaking change so would probably need an explicit :APPEND specifier similar to the :REPLACE specifier in included specs.

Alternatively you could lean on YAML's anchors and aliases to achieve some level of sharing.