Is there any way in 1.4+ to figure out why kapt is...
# kapt
s
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
./gradlew -Pkapt.verbose=true
(or the equivalent in gradle.properties) should print out some information about that
s
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
and you haven't turned off incremental kapt
kapt.incremental.apt=false
or incremental compilation
kapt.incremental=false
? hmm.
s
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
./gradlew --info
(or
-i
) would show those (and a lot of other stuff)
👍 1
s
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
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