How can I use the legacy build system with Xcode 10's `xcodebuild`?

DarkDust picture DarkDust · Jul 6, 2018 · Viewed 51.1k times · Source

I'd like to use the new build system of Xcode 10 for development, but our build in our continuous integration system fails since the xcarchive produced has an issue: the Info.plist in the xcarchive is missing the ApplicationProperties key and the information therein!

It turns out switching back to the legacy build system fixes this. This can be done in the workspace settings (File > Workspace Settings… > Build System). But I would prefer to keep the new build system for development and only use the legacy build system for CI builds.

Is there a way to make xcodebuild use the legacy build system without modifying the workspace?

Answer

DarkDust picture DarkDust · Jul 6, 2018

There is an (as of yet undocumented) flag in xcodebuild: -UseModernBuildSystem=<value>. The value can be either 0 or NO to use the legacy ("original") build system, or 1 or YES to use the new build system.

For example:

xcodebuild -workspace Foo.xcworkspace -scheme Bar -configuration Release -archivePath /path/to/Foo.xcarchive clean archive -UseModernBuildSystem=NO

(-UseNewBuildSystem=<value> seems to work as well; this flags was introduced in Xcode 9 but I suspect UseModernBuildSystem is going to be the "official" flag for this.)