Xcode 8 recompiles every file every build

Whenever I make a change to a file, like add a new property or create a new class, Xcode recompiles every single file on a build, and it takes quite some time. I've got this happening on the GM on two different computers (one running 10.12 one running 10.11).


I've tried:

  • copying every file to a new Xcode project created in Xcode 8 GM
  • removing every "Other swift flag" flag
  • removing all third party libraries
  • comparing my project's build settings to a new project's build settings
  • remove all test targets leaving just the one target I need
  • removing all ObjC code
  • removing all ObjC related flags


Really the kicker is that moving all my code to a new project shows that it's something in my code.

Any ideas? My productivity is way down having to wait ~ 1.5 minutes for every build / auto complete / syntax highlighting to work. And yes, I've cleared derived data 🙂



UPDATE:

One more peice of information, I found this information https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20160411/001693.html


which tells us about a "-driver-show-incremental" flag, which will cause queued dependancies to be listed in the build log. Sure enough I see what I think is every single swift file I have listed in the output. Trying to figure out if there's a way to make sense of what the dependancies are...


Output is something like:


...

Queuing Form.swift because of dependencies discovered later

Queuing SignInViewController.swift because of dependencies discovered later

Queuing EditProfileViewController.swift because of dependencies discovered later

Queuing ChangePasswordViewController.swift because of dependencies discovered later

Queuing JoinViewController.swift because of dependencies discovered later

...

Post not yet marked as solved Up vote post of aandrewc Down vote post of aandrewc
83k views

Replies

Mine (28645028) has been marked as a dupe of 28292226


And yes, currently still using

HEADERMAP_USES_VFS = YES

It's made a slight difference

And Xcode8 crash frequently, I don't know whether it related to this bug. BTW, Xcode recompiling all source files every time and it make The storage space of Macintosh HD comsume very fast


Update:

And when I reboot my mac pro, the project compiling very fast. As I use for a period of time, Xcode compiling files become slow and slow and crash frequently.


SO, I GUESS the bug that Xcode recompiling all source files if cause by "DerivedData“ cache in mac.

Thank you ddunbar!

This workaround seems to be working for us so our team is now writing code more than waiting 🙂

Hi ddunbar,


Where we have to set to true this setting? I can't find it in the build settings of my project


Thanks

Where is this setting ?

I added as a User-Defined Setting in my Project Build Settings and it seems to be helping.


Update: It seemed to help for a few builds then my project started recompiling all files on even single line changes.

This issue is also causing us a lot of wated times.

For us, the incremental builds are working only if we change something INSIDE a function.

Incremental builds don't work if we:

1) change a function name

2) add a new class

3) add a new var to a class


I have filed RADAR

28848000


Which contain a small swift project with 2 classes, unrelated to each other to show the problem.

  1. Go to Product -> Scheme -> Edit Scheme. Select Build in left side column and uncheck "Find implicit dependencies"
  2. But this flag should remain checked when you are building the project for first time.


This worked for me. It no longer recompiles the entire project. The only side effect I have noticed so far is that I have to turn it back on for the first build if i clean the project and/or purge DerivedData.

I haven't been able to replicate this issue in a new dummy project, that I would be able to share. I have noticed it only in larger project for customers, all of which have started as Xcode 7.x projects with a bunch of Cocoapods dependencies.

This didn't change anything for us. Even with this flag on, changing a single line of code results in a non-incremental build (about 7 minutes). The current situation is getting us in big trouble holding an important deadline and lets us reconsider our decision for using Swift in future projects. I've been an early adopter working with Swift since 1.0 and was a big fan but this experience destroys my trust in Swift. How can we be sure that such a show stopper issue won't happen in future anymore. I think a big part of the problem is that Apple doesn't eat it's own dog food (e.g. like eskimo wrote "I generally work on small sample code projects and I wouldn’t notice this problem even if it did crop up.").

Hi ddunbar,


Your workaround seems to work for bug 28799303.


Without your workaround we can easily reproduce the bug, but with your workaround we haven't had the compilation issue for two business days and we haven't been able to reproduce it since then.


Many thanks. Hope the issue will be solved soon.

Filed one more bug (28908050) with small example project there.


Simply adding/removing ": Equatable" to a separate class that is not related to any others triggers full rebuild in my case.

The issue still persist in the Xcode 8.1 GM.

it recompiles everything due to " (running because command line arguments are different from the last time)"

"Find implicit dependencies" continues to be the solution (don't forget to turn it back on after a project clean).

This setting fixed my issue with whole target recompilation. Thanks for help, but I'm expecting for this issue to be fixed in a future xcode 8.1 release without any custom setting configuration required

Can you tell me where to set the setting: HEADERMAP_USES_VFS = YES, thanks in advance .

.

At Build Settings, find the + button (top left after Levels filter). Tap this and add HEADERMAP_USES_VFS as Key and YES as value.