Swift 1.2 Incremental build tree is not optimised

Originator:johan.attali
Number:rdar://19795785 Date Originated:11-Feb-2015 02:53 PM
Status:Open Resolved:
Product:Developer Tools Product Version:XCode 6.3Beta - Swift 1.2
Classification: Reproducible:
 
The graph solver used by Swift 1.2 to make the builds incremental is not very well optimised yet.

Indeed first, it doesn't look at function signature changes so if you add a space in the block of one method, all files depending on that class will be recompiled.

Second, it seems to create the tree based on the files that were recompiled even if a change doesn't affect them. For example, If you move these 3 classes into different files

class FileA: NSObject {
    var foo:String?
}
class FileB: NSObject {
    var bar:FileA?
}
class FileC: NSObject {
    var baz:FileB?
}

Now if you modify FileA the compiler will obviously mark FileA to be recompiled. It will also recompile FileB (that would be ok based on the changes to FileA) but also FileC because FileB is recompiled, and that is pretty bad because FileC never uses FileA here.

The equivalent ObjC code for FileC would not have an #import "FileA" directive (because it doesn't use it), and therefore, the compiler would not recompile it.

The same behaviour is expected here in Swift, so the graph solver needs to take those changes into account.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!