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

Thanks. After a few days of attemption with the setting, the situation improve a lot , but sometimes some modify also can cause Xcode recompiling all file source. The answer not the best and final solution.

This seems to help me as well, even if from time to time it doesn't seem to work. Anyway a huge improvement.

I'm still seeing this problem with Xcode 8.1 and even after adding aforementioned build settings. I've filled 28998073 for this, hopefully folks at Apple will take a look soon as this has seriously affected performance of our team.

Hello,

Our team is still having those issues too.

You can't imagine the daily frustration of having to wait 5 minutes for the project to compile just because I changed 4 lines of code (or less) ...

Sadly I can't share the sourcecode of the project ... did somebody provide that so you can investigate ?

thanks and good luck!

Same Problem for object-C! It will waste about 10 min to compile 850 files everytime.....

Add USer-Defined Setting "SWIFT_WHOLE_MODULE_OPTIMIZATION = YES "" in your Project Building Settings may help you, But every time build have to spend about 120s

After filing a radar back in Swift 1.0 that was resolved in 1.2 with the incremental compilation I'm sad to see this is back i.e. regression


A colleague reported this earlier this week with an existing project (~35,000 loc)so I did a test with a brand new Xcode 8 project: https://github.com/madhikarma/incremental-compile-demo


What I noticed here is that the second compilation without any changes it compiles significantly faster though ttheh logs show all files being evaluated still which didn't happen before.


When we do make a change to code e.g. a private method then a compilation that takes longer but not full clean compile


Using HEADER_MAP_USES_VFS or deactiving the "Find implicit dependencies" setting in the scheme seem to help a little but not got


Without pre-compiling and linking Pod based libraries (going to this next) as Dynamic Frameworks instead I spent 1.5 days "optimzing" the app codebase to make it quicker to compile (down from 90 secs to 61 secs) via targeting the slow compiling files because of how often full recompilation is likely to occur.


It's going to be a big productivity drain and we have quite a few Swift projects either now on 2.3 or 3.0 that are of similar size (~35,000 lines of code)


Hoping the radars are resolved in time for Xcode 8.2...

i found a solution that works on my computer.

Before building restart Xcode. It compile only the needed files.

If you dont close xcode, it will try to compile the whole thing again.

Not only Swift, but my Objective-C project has same issue. Sometimes like add a NSLog into singleton object's method or edit storyboard file for just change a boolean properity to a view will cause whole project to recompille.

This popped up after updating to Sierra and xCode 8.1.


Absolutely brutal.. better hope you write it correct the first time!

It's crazy, but this worked for me: go to keychain access and delete your certificates with search "com.apple.idms.appleid". I only had one, but the source is from here: https://forums.developer.apple.com/thread/67063 and they had a ton.


EDIT: nevermind, its back..

Exaactly same situation here.

I just downloaded Xcode 8.2 Beta, I saw the next thing in the release notes: "Xcode will not rebuild an entire target when only small changes have occurred. (28892475)" but still is happening for me. Is this beta fixing the problem for someone at least?, we are a team of more than 10 developers and we are all suffering this painful issue. It's not serious...

Todays' Xcode 8.2 b3 build 8C30a's release notes claim this is fixed.

Xcode 8.2 Beta 2 haven't solve this problem either.


Sad.