Hi, I found sth interesting in the Gradle build lo...
# android
m
Hi, I found sth interesting in the Gradle build log. It seems like every time I make a change in
*.kt
file (even single line), and therefore Kotlin compiler runs, my Gradle’s
javac
task is considered as out-of-date. For large project with ~5k java files it has a significant impact on build time.
Copy code
Executing task ':app:compileStdMin21X86DevKotlin' (up-to-date check took 0.051 secs) due to:
  Input property 'source' file /[path]/NumberPicker.kt has changed.
:app:compileStdMin21X86DevKotlin (Thread[Daemon worker Thread 8,5,main]) completed. Took 2.018 secs.
:app:compileStdMin21X86DevJavaWithJavac (Thread[Daemon worker Thread 8,5,main]) started.
:app:compileStdMin21X86DevJavaWithJavac
Marking task ':app:compileStdMin21X86DevJavaWithJavac' out of date, because kotlin classes are changed
Executing task ':app:compileStdMin21X86DevJavaWithJavac' (up-to-date check took 0.0 secs) due to:
  Task.upToDateWhen is false.
--
All input files are considered out-of-date for incremental task ':app:compileStdMin21X86DevJavaWithJavac'.
:app:compileStdMin21X86DevJavaWithJavac (Thread[Daemon worker Thread 8,5,main]) completed. Took 20.621 secs.
I found the source of it here: https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinPlugin.kt#L522 Honestly, I don’t get it. Why we need to mark
javac
task as out-of-date every single time when Kotlin compiler runs?
➕ 2