https://kotlinlang.org logo
#kapt
Title
# kapt
s

Sha Sha Chu

05/11/2021, 10:24 PM
Is there any way in 1.4+ to figure out why kapt is non-incremental for a build? I searched previous messages and people suggest downgrading to 1.3x which is basically impossible in our app
e

ephemient

05/11/2021, 10:34 PM
./gradlew -Pkapt.verbose=true
(or the equivalent in gradle.properties) should print out some information about that
s

Sha Sha Chu

05/11/2021, 11:20 PM
yes i see
Incremental annotation processing (apt mode): false
but it doesn’t tell me why it didn’t run incrementally
in this blog post from 2019 https://medium.com/@daniel_novak/making-incremental-kapt-work-speed-up-your-kotlin-projects-539db1a771cf it says that it should log the processors that aren’t incremental but it doesn’t appear to anymore
e

ephemient

05/11/2021, 11:58 PM
and you haven't turned off incremental kapt
kapt.incremental.apt=false
or incremental compilation
kapt.incremental=false
? hmm.
s

Sha Sha Chu

05/12/2021, 12:32 AM
no
i’m looking into the
kapt
source code and it looks like there are some other cases when it will turn off incremental kapt
Copy code
if (logger.isInfoEnabled) {
            val time = "Took ${System.currentTimeMillis() - startTime}ms."
            when {
                previousSnapshot == UnknownSnapshot ->
                    <http://logger.info|logger.info>("Initializing classpath information for KAPT. $time")
                classpathChanges == KaptClasspathChanges.Unknown ->
                    <http://logger.info|logger.info>("Unable to use existing data, re-initializing classpath information for KAPT. $time")
                else -> {
                    classpathChanges as KaptClasspathChanges.Known
                    <http://logger.info|logger.info>("Full list of impacted classpath names: ${classpathChanges.names}. $time")
                }
            }
        }
that’s from
KaptTask
so i wonder if i’m hitting one of those cases where the classpath changes unexpectedely
e

ephemient

05/12/2021, 4:02 AM
./gradlew --info
(or
-i
) would show those (and a lot of other stuff)
👍 1
s

Sha Sha Chu

05/12/2021, 5:23 PM
i do see this in the logs:
Unable to use existing data, re-initializing classpath information for KAPT. Took 781ms.
i guess if any files get added to the classpath
kapt
can’t run incrementally? earlier in the logs i see:
Copy code
Task ':xxxxxx:kaptDebugKotlin' is not up-to-date because:
  Input property 'classpathStructure$kotlin_gradle_plugin' file /Users/shasha/.gradle/caches/transforms-3/c10f7f9ca3457239899004135492aca1/transformed/output.bin has been added.
  Input property 'classpathStructure$kotlin_gradle_plugin' file /Users/shasha/.gradle/caches/transforms-3/418b18a8eb2bb12415828065185d47c2/transformed/output.bin has been added.
  Input property 'classpathStructure$kotlin_gradle_plugin' file /Users/shasha/.gradle/caches/transforms-3/0e350fdc77bcd8b6930cec8da974a4e2/transformed/output.bin has been added.
i don’t actually know what those transformed files are
a

Andrey Zinovyev

05/17/2021, 9:37 AM
xxxxxx:kaptDebugKotlin shouldn’t be up-to-date if you changed something in your sources. You changed something right? Or you see it every time you run the task?
@gavra maybe you can help? At least point to some direction what should be checked first
3 Views