How to ensure that incremental compilation works for me


#1

I have warnings that are located in 4 files of my project. And every build of the project, after a minor change in 5th file (like a change <= to > in the body of non-inline method), I see all these warnings during “compileDevDebugKotlin” step of the gradle.

Is that mean that the incremental compilation doesn’t work for me?
And maybe there is an option to see all files that are compiling, and files that skipped due to the incremental compilation.


#2

First of all, make sure if IC is on. To do so check that your build log contains the line:

Using experimental kotlin incremental compilation

If IC is on, but you suspect that your build was not performed incrementally, for now your only option is to take debug log and analyze it:

  1. add -d to gradle command-line options (for android studio: File|Settings|Compiler|Command-line options)
  2. then you can use regex to find all compiled files. An example code from our tests:
// lets assume that LOG is build log
val kotlinSourcesListRegex = Regex("\\[KOTLIN\\] compile iteration: ([^\\r\\n]*)")
val compiledKotlinSources = kotlinSourcesListRegex.findAll(LOG).asIterable().flatMap { it.groups[1]!!.value.split(", ") } 

I think this is not a convenient, and some kind of option to generate IC status report is needed. So I’ve created an issue you can use to track progress on this (hopefully it will be done in 1.0.3).


#3

Thanks Alexey! Your pointing to the log message gave me a dash to check all this stuff. And finally I found out that I had 1.0.0 version of Kotlin specified in build.gradle while using 1.0.3 EAP of plugin :disappointed_relieved: Yeah, some warning about that would helped me to avoid a nerve cells genocide :smile:
Holy moly, it’s lightning fast now!
Thanks a lot!