Thread
#build-tools
    Eugen Martynov

    Eugen Martynov

    4 years ago
    Does kapt support incremental builds?
    gildor

    gildor

    4 years ago
    Annotation Processing is not incremental, not only with Kapt. Same sitation with apt and Java. Kapt have some incremental steps (like stubs generation), but in general AP is not incremental
    There is a project from Gradle and Google that wants to priovide api for AP authors to support incremental annotation processinghttps://github.com/gradle/incap Detailed description of Milestone 1https://docs.google.com/document/d/1CXNfKmPx9hqfnGWic3F9sKHQ6T8ImDVxnXfkvWYqwxg/edit
    Under the hood AP still can have own incremental code generation, but without integration with build system it’s hard to support and it’s not flexible enough
    Eugen Martynov

    Eugen Martynov

    4 years ago
    I completely missed that annotation processing is not incremental with gradle https://github.com/gradle/gradle/issues/1320
    Thanks for pointing out
    gildor

    gildor

    4 years ago
    Not only with Gradle. Java JSR-269 provides nothing for support of incremental AP, so it’s completely build system feature that should be integrated to AP library.
    Eugen Martynov

    Eugen Martynov

    4 years ago
    ok, so I consider annotation processing an developer evil 🙂
    gildor

    gildor

    4 years ago
    The Good, the Bad and the Ugly 🙂
    Eugen Martynov

    Eugen Martynov

    4 years ago
    Why it was never on the radar? AP is standard since java6
    gildor

    gildor

    4 years ago
    I suppose nobody used this so intensive as today.
    also java compilation was not incremental (it’s build tools feature, not javac itself)
    Also I think Android developers pushed that a lot, because AP is super popular on Android because of many reasons
    Eugen Martynov

    Eugen Martynov

    4 years ago
    Thanks!
    Thanks for the discussion and pointing out to the problem and reference for the solution
    gildor

    gildor

    4 years ago
    No solution yet unfortunately but I want to believe 👽
    Eugen Martynov

    Eugen Martynov

    4 years ago
    Looks like we can already try something
    gildor

    gildor

    4 years ago
    Yes, it’s proof of concept. Problem that to achieve incremental AP all your AP should support that. In my Android case two biggest thing is Databinding and Dagger
    Eugen Martynov

    Eugen Martynov

    4 years ago
    We also use them, but at least Butterknife and autovalue are incremental
    so some small gain in build speed
    or it will re-run everything in this case?
    gildor

    gildor

    4 years ago
    you should get some gain I suppose, just because AP generates less code, but think it’s minor part, biggest one is incremental java/kotlin compilation that cannot be achieved without incremental AP
    Eugen Martynov

    Eugen Martynov

    4 years ago
    Ok, I need to read how incremental java compilation in gradle is implemented
    I was thinking it can detect what file is changed
    so if less files are re-generated then less compile time is needed
    gildor

    gildor

    4 years ago
    Java incremental compilation disabled if you have AP
    s

    stepango

    4 years ago
    Only way of getting incremental AP is breaking app into small modules, since AP would be running only inside changed module build speed would be much faster👍
    gildor

    gildor

    4 years ago
    @stepango Unfortunately doesn’t work with Dagger Subcomponents and Data Bindings And it’s not incremental, but yeah, at least you can compile only one module and modules that use it
    btw Incap Milestone 1 already have PR to Gradle - https://github.com/gradle/gradle/pull/3434