We are in the process of migrating from Java to Kotlin.
In the process, we ran into a problem where even a single Kotlin file in a module noticeably slows down the compilation process for that module.
For demonstration purposes, we created a simple multi-Maven module project that looks like this:
- Module a
- Module b
- Module c
With 100 Java files and 0 Kotlin files in module a, the following result is obtained:
[INFO] a … SUCCESS [ 2.069 s ]
[INFO] b … SUCCESS [ 0.350 s]
[INFO] c … SUCCESS [ 0.118 s]
[INFO] Parent POM … SUCCESS [ 0.071 s].
Adding only 1 Kotlin file to module a results in the following:
[INFO] a … SUCCESS [ 4.757 s]
[INFO] b … SUCCESS [ 0.121 s]
[INFO] c … SUCCESS [ 0.104 s]
[INFO] Parent POM … SUCCESS [ 0.066 s]
It does not seem to matter how many Kotlin files we add to the module. With 100 Kotlin files in the same module, the compile time increases to 5.582 seconds. The problem seems to be the call to the Kotlin compiler, which must be called for each module.
Since we are dealing with a project that contains almost 600 Maven modules, this issue will drastically increase our CI time.
Is there anything we can do about it?
Will the Kotlin 2.0 Compiler address this Issue?