title: xcodebuild not doing incremental builds
body: <p>I recently checked out a fresh version of our iOS app from git and built from command line via <code>xcodebuild</code>. I then built a second time using the exact same command, <strong>while making no changes to files in the repo whatsoever (not even opening them).</strong></p>
  
  <p>I expected the second build to take no time at all, but it actually took longer than the first:</p>
  
  <pre><code>user$ time xcodebuild -sdk 'iphonesimulator' -scheme 'DemoApp' -configuration 'Debug' -target 'DemoApp' build &gt; /dev/null
  
  real    5m45.849s
  user    0m15.270s
  sys     0m5.640s
  
  user$ time xcodebuild -sdk 'iphonesimulator' -scheme 'DemoApp' -configuration 'Debug' -target 'DemoApp' build &gt; /dev/null
  
  real    6m8.858s
  user    0m12.904s
  sys     0m4.198s
  </code></pre>
  
  <p><strong>If I do builds in xcode with no changes, it builds and runs in a matter of seconds.</strong></p>
  
  <p>Here are things I've tried to get incremental builds on command line:</p>
  
  <ul>
  <li>I tried adding <code>-derivedDataPath ~/Library/Developer/Xcode/DerivedData</code>, but got the same results.</li>
  <li>I've added the <code>-incremental</code> flag to other Swift arguments.</li>
  <li>I've turned off all shell scripts and ensured no files have changed between builds</li>
  </ul>
  
  <p><strong>Does <code>xcodebuild</code> not support incremental builds? Is there a way to figure out why this is happening?</strong></p>
  
  <p>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.</p>
  
  <p><strong>Edit: changing back to the old build system builds incrementally via <code>xcodebuild</code> in under 30 seconds.</strong></p>
  
  <hr>
  
  <p>Update:</p>
  
  <p>The way I'm testing this: I have a Jenkins job that will clone the repo and do a hard clean: running xcodebuild clean and deleting the build directory and and derived data directory by hand just in case. Then it does a build. Then it makes no changes and does a build again. The second build is the one I'm timing.</p>