https://kotlinlang.org logo
#k2-early-adopters
Title
# k2-early-adopters
j

Jilles van Gurp

09/15/2023, 7:04 AM
I built rankquest.jillesvangurp.com (which I announced yesterday) with kotlin-js and k2. There are still some rough edges with this but I'm loving the rapid edit compile browse cycle. Compared to the 30seconds plus I was experiencing not so long ago doing kotlin-js projects, 1-3 seconds is a massive improvement. One issue I noticed in the past weeks working on that is that the gradle daemon seems to get confused switching between k2 projects and non k2 projects. The only way to resolve this seems to be killing the daemon. Everytime I switch from a k2 project to a non k2 project, Intellij freaks out and marks the entirity of build.gradle.kts as invalid until I do that. Is this a known issue? In general the support for kts files in intellij continues to be super flaky for me. So, I assume there are already loads of open issues for that.
d

dmitriy.novozhilov

09/15/2023, 8:53 AM
Great news
Everytime I switch from a k2 project to a non k2 project, Intellij freaks out and marks the entirity of build.gradle.kts as invalid until I do that.
It sounds very suspicious, because right now IDE always uses K1 under the hood (and not reuses daemons AFAIK) Please report an issue
a

Adam S

09/15/2023, 9:51 AM
what's the Gradle script error? I'd wager you're getting
AssertionError: Can't find built-in class kotlin.Cloneable
? https://youtrack.jetbrains.com/issue/KTIJ-25236
j

Jilles van Gurp

09/15/2023, 11:34 AM
exactly that
e

Edoardo Luppi

09/15/2023, 2:23 PM
That cloneable issue is finally fixed it seems. I had to restart the IDE multiple times a day
👀 1
c

christophsturm

09/22/2023, 3:10 PM
1-3s turnaround time for a js project, that sounds great, how do you do that?
j

Jilles van Gurp

09/22/2023, 3:11 PM
Incremental compilation
c

christophsturm

09/22/2023, 3:41 PM
is it just a normal kotlin-multiplatform project with js and k2?
i assumed that webpack takes up most time in js projects
j

Jilles van Gurp

09/22/2023, 3:42 PM
Yeah, try it out.
e

Edoardo Luppi

09/22/2023, 3:44 PM
@Jilles van Gurp do you build manually or do you keep Gradle running and let it do it on each file change?
j

Jilles van Gurp

09/24/2023, 9:33 AM
As explained in the Readme, simply run
./gradlew jsBrowserDevelopmentRun -t
that monitors the file system triggers incremental builds. Then you simply reload the app when it is done. Only takes a few seconds with k2 typically. A full build is a bit slower obviously. About 40 seconds for a production build.
e

Edoardo Luppi

09/24/2023, 9:35 AM
Ah yes, so the continuous build option of Gradle. Tried it out with
assemble
and it's equally fast for non-web projects
j

Jilles van Gurp

09/24/2023, 9:35 AM
I found a good workaround for this issue btw. Simply change a dependency version, refresh, change it back, refresh again.
Forces intellij to clear it's confused caching
2 Views