# announcements


03/01/2017, 3:19 PM
@ilya.chernikov I would expect that making incremental compilation possible by an external took (Gradle) was already more effort than doing it internally so I'm a bit confused
But either way, the sooner incremental compilation is in the compiler, the more users will automatically benefit from it, even ant users ;)


03/01/2017, 3:30 PM
Well, as it usually happens, the implementation was pulled by some urgent demands at places where people are used to the incremental compilation, first in IDEA and then in gradle. Ant users are not that picky yet 😉 But yes, we’re well aware of the benefits, and will do it sooner or later. But in particular for kobalt needs, if there are any, we can think about some intermediate solution.


03/01/2017, 3:39 PM
Last time I tried to implement incremental compilation for Kobalt was pretty tough, very little documentation, had to go through the Gradle sources and eventually gave up. Is it easier to set up now?
Unfortunately we cannot yet guarantee the stability of this API.
Compiling on the daemon requires some additional handling, but I’m ready to help you with that as well, if you decide to go that way.


03/01/2017, 4:56 PM
IC in the compiler is half-done. It can be used without daemon through more or less simple API, but it is not polished yet: 1. It does not handle changes in compile-classpath (it should at least perform full rebuild in this case). 2. API can be changed slighly. 3. No CLI support. 4. No multi-module IC. The API can be used starting from 1.1, it requires kotlin-compiler-embeddable.jar. The API entry point is here It can be used as so:
Copy code
// Trivial imports are omitted 
import org.jetbrains.kotlin.incremental.makeIncrementally

// This dir will be used for as IC caches' root,
// so it should persist between builds; 
// Removing this dir forces rebuild
val chachesDir = File("build/ic-caches")

// Iterable of Java and Kotlin source roots
val sourceRoots = listOf(File("src/kotlin"), File("src/java"))

val args = K2JVMCompilerArguments()
// Output dir
args.destination = "build/classes"
args.moduleName = "someModule"
// Compile-classpath
args.classpath = compileClasspath
// Some other collector should probably be used
val messageCollector = MessageCollector.NONE

makeIncrementally(cachesDir, sourceRoots, args, messageCollector)
That should handle all cases our Gradle IC handles except classpath changes and multi-module IC. The underlying implementation is the same and the same tests are used.