Wednesday, 17 April 2019

xcodebuild not doing incremental builds

I recently checked out a fresh version of our iOS app from git and built from command line via xcodebuild. I then built a second time using the exact same command, while making no changes to files in the repo whatsoever (not even opening them).

I expected the second build to take no time at all, but it actually took longer than the first:

user$ time xcodebuild -sdk 'iphonesimulator' -scheme 'DemoApp' -configuration 'Debug' -target 'DemoApp' build > /dev/null

real    5m45.849s
user    0m15.270s
sys     0m5.640s

user$ time xcodebuild -sdk 'iphonesimulator' -scheme 'DemoApp' -configuration 'Debug' -target 'DemoApp' build > /dev/null

real    6m8.858s
user    0m12.904s
sys     0m4.198s

If I do builds in xcode with no changes, it builds and runs in a matter of seconds.

Here are things I've tried to get incremental builds on command line:

  • I tried adding -derivedDataPath ~/Library/Developer/Xcode/DerivedData, but got the same results.
  • I've added the -incremental flag to other Swift arguments.
  • I've turned off all shell scripts and ensured no files have changed between builds

Does xcodebuild not support incremental builds? Is there a way to figure out why this is happening?

I'm using the latest Xcode and the new Xcode 10 build system. Most of the code is in swift if that makes any difference.

Edit: changing back to the old build system builds incrementally via xcodebuild in under 30 seconds.



from xcodebuild not doing incremental builds

No comments:

Post a Comment