https://kotlinlang.org logo
#gradle
Title
# gradle
i

ianbrandt

11/30/2023, 1:18 AM
Does the Kotlin Gradle Plugin impact the container architecture (in C4 Model terms, i.e. the runtime process architecture) of how Java sources are compiled by Gradle? I know the KGP adds a single
KotlinCompileDaemon
process to the mix. Does that exclusively handle the compilation of Kotlin sources, or are
compileJava
tasks executed by that as well (instead of the usual Gradle Daemon/Worker processes)? I'm trying to understand whether the standard Gradle suggestions and features for optimizing Java compilation, such as forking `JavaCompile` tasks, and the new persistent Java compiler daemon feature, apply any differently when the Kotlin Gradle Plugin is used. Just as background, I work primarily on a sizable project that mixes Java and Kotlin, and optimizing build times is a constant challenge. I currently apply the KGP to all my Gradle subprojects via a convention plugin, regardless of whether they contain only Java, only Kotlin, or a mix of both.
e

ephemient

11/30/2023, 1:30 AM
the Kotlin compiler does read Java sources so that it can build Kotlin code that uses it in the same module before the Java compiler is run, but it does not build them
👍 1
i

ianbrandt

11/30/2023, 4:39 AM
That makes sense. Thank you.
t

tapchicoma

11/30/2023, 8:06 AM
there is also in-process compilation mode that does not spawn separate Kotlin daemon. But it could be slower then compilation via Kotlin daemon
👍 1
i

ianbrandt

12/05/2023, 6:45 PM
Ah, I see. We're after build performance, so the loss of incremental build probably isn't what we'd want, but good to know the option is there for troubleshooting purposes. For example, I'm about to go see if it has any impact on https://youtrack.jetbrains.com/issue/KT-50545/IOException-Unable-to-delete-directory-Anvil-compiler-extension-fails-gradlew-clean-on-Windows-only.
4 Views