0

I'm invoking xcodebuild (Xcode 12.5) specifying an xcconfig file using the -xcconfig parameter. If the xcconfig file contains a conditional variable assignment based on build configuration (for example SWIFT_OPTIMIZATION_LEVEL[config=Debug] = -Onone), I get the following error:

FIXME: Implement XCBuild support for macros in overriding parameters with condition sets:

    SWIFT_OPTIMIZATION_LEVEL[config=Debug] = -Onone

and xcodebuild fails whatever action was performing.

Note that this also happens when building using fastlane gym and passing the xcconfig file using gym's xcconfig parameter (it makes sense since gym is simply invoking xcodebuild under the hood and using the same xcconfig parameter...)

francybiga
  • 960
  • 1
  • 8
  • 16

1 Answers1

0

After several attempts at understanding the problem I found some workarounds:

  1. Update to Xcode 13

    The problem has been fixed in Xcode 13, and the Release Notes explicitly list this issue as solved:

When you pass xcconfig files to xcodebuild using the -xcconfig command-line flag and XCODE_XCCONFIG_FILE environment variable, Xcode parses them using New Build System semantics, which also supports condition parameters. (25001734)

  1. Don't explicitly pass the xcconfig file but rely on Xcode to use it to resolve build configurations

    I found out that in my case it wasn't actually needed to explicitly specify the xcconfig file to xcode build but the settings were correctly resolved if xcconfig file was specified in Xcode as source of build configurations for a given target / build configuration.

  2. Split settings into separate files for each build configuration and specify each one in Xcode for that specific build configuration

    It's possible to tell Xcode to use a specific xcconfig file for a given build configuration (es. one for Debug and one for Release), thus removing the need to use conditional assignments. Also, by using the #include directive, we can have a "shared" xcconfig file for all common settings which can be included by the debug and release config files, to avoid duplicating shared settings values.

More info on xcconfig files can be found in The Unofficial Guide to xcconfig files.

francybiga
  • 960
  • 1
  • 8
  • 16