Trying out Kotlin 2.0.0-RC1 and getting `Caused by...
# eap
j
Trying out Kotlin 2.0.0-RC1 and getting
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.ArrayStoreException: org.jetbrains.kotlin.konan.target.KonanTarget$IOS_ARM32 [in thread "Daemon worker"]
error when syncing.....this is in KMP project so maybe known issue? Full stack in thread. Tried latest AS canary so far
youtrack 1
βœ… 1
Untitled
d
It seems that you are using Compose plugin version which is incompatible with RC1
j
is there one available that I can use atm?
this project has previously been using 2.0.0-Beta3 btw along with
Copy code
compose {
    kotlinCompilerPlugin.set(libs.versions.compose.compiler)
    kotlinCompilerPluginArgs.add("suppressKotlinVersionCompatibilityCheck=${libs.versions.kotlin}")
}
d
Is it the same artifact used by compose multiplatform?
🚫 1
j
I'm currently using
Copy code
compose-compiler = "1.5.6-dev2-kt2.0.0-Beta3"
d
I've asked compose team about it
o
https://central.sonatype.com/artifact/org.jetbrains.kotlin/kotlin-compose-compiler-plugin - this one doesn't yet support compose multiplatform (web, native. but it's okay for desktop) We aim to make 'kotlin-compose-compiler-plugin' compatible with all targets. (it's a priority at the moment) For now, for CM this one can be used for now: pkg:maven/org.jetbrains.compose.compiler/compiler@1.5.11-kt-2.0.0-RC1
πŸ‘ 2
thank you color 1
t
Issue for new compose Gradle plugin: https://youtrack.jetbrains.com/issue/KT-67006. There are some details how to use it
j
ok, have pulled in that plugin here.....next up is following....maybe basic question but what should be used for this now?
this is with
Copy code
compose-plugin = "2.0.0-RC1"

[plugins]
jetbrainsCompose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "compose-plugin" }
and
Copy code
plugins {
    alias(libs.plugins.jetbrainsCompose)
    ...
}
t
this is only the migrated (kind of as is) Google compose compiler plugin. All other dependencies should stay as is
j
this is in a shared kmp/cmp module btw fwiw
Screenshot 2024-04-09 at 15.32.21.png
t
Do you have
compose
section in your version catalog?
j
no, and didn't need one before
(when using 2.0.0-Beta3 and related dependencies at the time)
this is project I'm updating btw https://github.com/joreilly/ClimateTraceKMP
πŸ‘€ 1
I've commented out JS/Wasm/Native stuff for now in case interfering
so just desktop and android
t
So error is caused by this commit which removed deprecated Kotlin targets. We've notified compose team regarding this issue.
πŸ‘ 1
j
Is that the same or different issue to
compose
not being resolvable now?
t
could be related as Gradle sync could not complete because of exception
j
in that latter case it seemed at least like gradle sync had worked
this is branch where I've been hacking these changes https://github.com/joreilly/ClimateTraceKMP/compare/kotlin_2_rc1?expand=1
p
fix for gradle compose plugin would be published in compose 1.6.2
πŸ‘ 3
j
Sorry, just realised I probably misunderstood something here.....it sounded from above like we should be using
2.0.0-RC1
of the compose plugin (and also using
org.jetbrains.kotlin.plugin.compose
now).....what 1.6.2 dependency would we be using then (once it's available)?
given as well that' we're using likes of
implementation(compose.runtime)
to pull in common CMP dependencies
t
it is
compose-plugin = "1.6.1"
from your version catalog
t
consider it as a copy of existing Google compose compiler plugin which will become the main compose compiler plugin
so we copied Google compose compiler plugin into Kotlin codebase and created a separate Gradle plugin for it which applies this compiler plugin. Difference from JB compose compiler plugin will eventually be merged into Kotlin compose compiler plugin and in the end we will have only one compiler plugin.
πŸ‘ 1
e
So the Kotlin compose compiler plugin currently doesn't support Compose Multiplatform, but eventually it will? And at that point there will only be one plugin going forward, or Google will continue to use their monorepo plugin?
t
I am not sure on exact plans, but changes in Google monorepo related to compose compiler plugin should be synced to the
kotlin.git
. You should expect some official announcement either from us or from Google (or joint one).
o
Hmm, I'd love to check out Kotlin 2.0.0-RC1, but with the Compose Gradle plugin 1.6.1 I get
Copy code
e: Please initialize at least one Kotlin target in 'frontend-html (:application:frontend-html)'.
This happens at Gradle script compilation time, before I even have a chance to define a Compose compiler plugin. With the new Compose Gradle plugin 2.0.0-RC1, the
compose
extension is missing, so these CMP settings don't work:
Copy code
compose {
    desktop.application.mainClass = "FrontendMainKt"

    experimental {
        web.application {}
    }
}
To reproduce:
Copy code
plugins {
    kotlin("multiplatform") version "2.0.0-RC1"
    // kotlin("plugin.compose") version "2.0.0-RC1" // <- does not support the `compose` extension
    id("org.jetbrains.compose") version "1.6.1" // <- "Please initialize at least one Kotlin target"
}

kotlin {
    jvmToolchain(11)

    jvm()
}

compose {
    desktop.application.mainClass = "FrontendMainKt"
}
e
fix for gradle compose plugin would be published in compose 1.6.2
@Pavel Shishkin will there be a dev release, or will 1.6.2 be released before then?
j
Trying out
1.6.10-dev1575
CMP version (https://github.com/JetBrains/compose-multiplatform/releases/tag/v1.6.10-dev1575) that was published today and getting a bit further....currently running in to other issues due to not having version of KSP plugin yet that works with Kotlin 2.0.0-RC1
same 1
fwiw I've been pushing any updates I've made so far to following branch https://github.com/joreilly/ClimateTraceKMP/compare/kotlin_2_rc1?expand=1
the KSP dependency might not be affecting everyone but just fyi that compatible version of that is due to be published in next few hours
o
Yay! Almost too fast for me, but so cool. And I love this place, hope we all meet at KotlinConf! πŸ˜ƒ
πŸ‘ 2
947 Views