Slow compilation starting with Kotlin 1.5.20

I am working on a Kotlin library nta.kt that provides extensions for the Java image processing library ImgLib2. Compilation time with Kotlin version 1.4.32 is 20-40 seconds on my laptop depending on gradle daemon and cache availability. For reproducible results, I compile without cache and daemon:

./gradlew --no-daemon --no-build-cache clean build publishToMavenLocal

I tried upgrading to the latest Kotlin but compilation time is extremely slow now (5+ minutes). I identified version 1.5.20 to be the first release with slow compilation time for my project. I am currently stuck and have no idea how to debug and identify potential causes for the slow compilation time myself. If there are any tools or techniques that I could use to dig into compilation in more detail, I would greatly appreciate this.

The underlying Java library makes heavy use of recursive generics that is also reflected in the extensions that I provide in nta.kt. I suspect that this might be a possible cause for the slow compilation times that I observe. ImgLib2 was slow to use in IntelliJ in the past, but I don’t know if this is related.

1 Like

I get No license file found at 'LICENSE'. during gradle build (the License file is in root). What I have to add/change to solve this issue?

1 Like

Thank you for looking into this, I really appreciate it. I just made a fresh checkout of the repo to make sure I don’t have any additional files in my local copy and I can build successfully. Are you using the gradle wrapper in the repo or gradle executable from your laptop? In the latter case, can you try the gradle wrapper, i.e. this is what works for me from within the root of the source directory:

./gradlew clean build

Maybe it is also an issue with the OS. I have only built it on Linux (Manjaro on my laptop, Ubuntu on GitHub Actions CI). What OS are you using?

Thank you! I reproduced the problem on Mac -
My first attempt was on Windows.

1 Like

Thank you, I really appreciate you following up with an issue and identifying a build problem of my project on Windows.