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

Hi,


We still have the same problem with the new beta version of Xcode.

We have tried every possible fix (like HEADER_MAP_USES_VFS or deactivating the "Find implicit dependencies") but with no success...


I hope Apple will fix this issue because it is really slows our development 😟


Thanks.

I hope Apple will fix this issue because it is really slows our development

If the current Xcode 8.2 beta doesn’t help, I encourage you to follow the instructions I posted to this thread on 30 Sep. It seems like there is more than one underlying cause here, and good quality bug reports from folks being affected by this problem are key to resolving them all.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I have a case with two frameworks that might be of interest. Let's call the frameworks A and B. Framework A is rather large and suffers from repeated indexing and recompiling when under development. Project B is smaller and does not suffer from these problems. If I include the large framework, A, as a subproject of the smaller framework B then the A no longer suffers from the recompiling/reindexing issue. Why this is so I do not understand.


Maybe this is a clue?


Good luck. This is a very bad problem in any case when trying to work on framework A independently of work on B.

Xcode 8.2 beta doesn’t help!

please fix this problem as soon as possible!!!

I've created a bug report with screen recording + dummy project: 29353725

Hope this will help.

We are having the same issue. Our project has few hundred Swift files. Since we upgraded to Swift3 / Xcode 8 this is happening. Even a single line change causes the entire project to build. Takes about 2-3 minutes. Our productivity has gone way down. This is not sustainable. Please help. THIS IS A VERY URGENT ISSUE.

Did you find any solution? Its Dec 2016 and problem is still there 😟

I encountered the problem when my macOS was in El Capitan. But it seems that the situation eases or even resolves after I upgraded to Sierra.

Thanks for responding and participating on this forum.


>> It seems like there is more than one underlying cause here, and good quality bug reports from folks being affected by this problem are key to resolving them all.


Even better would be some improved testing and quality control from Apple.


This bug is wasting huge amounts of time that we will never get back.


We don't all live in the vast monied lands of Apple - this is really hurting.

XCode 8.2 beta release note says.


Build System

• Xcode will not rebuild an entire target when only small changes have occurred. (28892475)

But it didn't work.


XCode 8.2 released but it still recompiles every files.


Hey, Apple developers could you focus and fix this issue?


Stop wasting our time.

Hi there,


has there been some progress with this problem? We didn't see any improvements using Xcode 8.2.


For us the problem started to manifest itself about two weeks ago: we migrated our iOS app from Swift 2.3 to Swift 3 using Xcode 8.1 (which took us about 1 week). Firstly we didn't realize what the problem was while we workend on the transition itself - probably due to having warnings and errors to fix, upgrading external frameworks, adapting code, etc. - and we believed it would all be fine when the transition was done. Unfortunatly the problem persisted even after migration finished. And continues to do so with Xcode 8.2.


We tried all kinds of suggestions in this thread and elsewhere, also in combination, but to no avail.


We have about 50K lines of code and about 30 external frameworks (integrated via CocoaPods).


The same code base before migration using Xcode 8.1/Swift 2.3 didn't have this problem. So we asked ourselves what had changed during the transition (besides code fixes, small code adaptions, we refrained from major refactorings).


One suspicious element: we moved a lot of frameworks, developed by the community, that had been integrated directly into our code base into external frameworks managed via CocoaPods (just putting the source codes directly into our code base was a mistake in the first place). Probably 1/3 of of external code was integrated directly which are now a pod framework. I can't yet confirm this yet, but I will try to undo this change and move the source code of these pods back into our own source tree and see if this makes a difference.


If that's the case, this would be a regression for code maintenance but the current situation is even worse.


This has become our main concern with Xcode and an unprecedented case of drop in productivity I've ever seen, iterative work is throttled nearly to a halt. This is a very frustating situation which I've never encountered with Xcode ever before. Feels like being back in the 90s.

I hope Apple can allocate some more smart people on tracking down this issue. For us this is more important than any new features we would see down the road.Thanks for listening,

Kaweh

Xcode 8.2 and the problem is still there - reeeaaaalllyyyyy slow compilation and incremental compilation times, with small code changes that trigger complete recompile. We are using big mixed project of Objective-C and Swift 3. It was the same way when we were using Xcode 7 and Swift 2. Reallllly slow. Please Apple developers, I hope someone is working on a fix already.

Hello everyone,


I found solution and yes it's worked for me.


I created new project in XCode 8.2 and moved all source codes from my old project to new project.

After that Xcode doesn't compile every file in single build when I change single file. Build time became ~90s to 5-6s.


I think some horrible hidden settings or something slows build time after swift 2.3 to swift 3 migration or xcode upgrade.


I hope this will help you guys,


Happy coding 🙂

Hi,


I've been folowing this thread hoping for a workaround but unfortunatelly none of the suggested solutions worked reliable. Our team has become unproductive and demotivated due to the time we have to wait compiling our mixed Obj-C and Swift project. We conveinced our management to start using Swift and now we have to keep explaining that our productivity dropped because of Swift. We are almost at the point to start writing new code in Obj-C again. We have stopped writing Unit tests and our Android colleagues are laughing at us.


We hope Apple can tackle this problem so all of us can start enjoying our jobs again.

Let me through my 5 cents in.


Our project is recently moved to Swift 3 entirely. It has containing app and the appex. It links agains several libraries managed by CocoaPods.


The relationships with Xcode 8.2, however, have never been easy...😟


1. Even after changing one characted, Xcode 8.2 builds more than one object file. The build takes 1+ minute. Every time

2. SourceKit keeps crashing, presumably bumping agains some wrong sintax in the process of wresting the iOS SDK & Swift 3 API. Without SourceKit Xcode becomes Vim, highlighting only symbols it (I think) could resolve via RegExp. It does not suggest the API, of course.

3. Every time it builds Swift libraries, why? 😠 Everytime it COPIES those binaries to the device.

4. Every time it copies some stuff to iPhone. Definatelly more than just a binary. In the same time, I am sure, Xcode knows what's alredy installed on the device. So, why waste time copying same files?