-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to K2 #196
Update to K2 #196
Conversation
I've published Some notes
|
Thank you for your quick support of the new Kotlin version! |
I've published
Note that KSP 2 and KSP 1 cannot be tested in the same compilation. You would need to do something like I've set up at the build level in this PR to conditionally choose dependencies. There also appears to be a broken dependency in their new Analysis API artifacts (google/ksp#1712), so you'd need to use an exclusion like I've done in this PR. I can publish a new alpha when this is fixed. In dependencies ksp-api = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" }
ksp-cli = { module = "com.google.devtools.ksp:symbol-processing-cmdline", version.ref = "ksp" }
ksp-aa-embeddable = { module = "com.google.devtools.ksp:symbol-processing-aa-embeddable", version.ref = "ksp" }
ksp-commonDeps = { module = "com.google.devtools.ksp:symbol-processing-common-deps", version.ref = "ksp" } In the build // It's not possible to test both KSP 1 and KSP 2 in the same compilation unit
val testKsp2 = providers.systemProperty("kct.test.useKsp2").getOrElse("false").toBoolean()
tasks.test {
if (testKsp2) {
systemProperty("kct.test.useKsp2", testKsp2)
}
}
dependencies {
if (testKsp2) {
testImplementation(libs.ksp.aa.embeddable) {
exclude(group = "com.google.devtools.ksp", module = "common-deps")
}
testImplementation(libs.ksp.commonDeps)
testImplementation(libs.ksp.cli)
} else {
testImplementation(libs.ksp)
}
} In tests val useKSP2 = System.getProperty("kct.test.useKsp2", "false").toBoolean()
KotlinCompilation().apply {
if (useKSP2) {
useKsp2()
} else {
// Fall back to K1
languageVersion = "1.9"
}
} |
I'm unable to repro the inheritClasspath issue I'm seeing in another repo, going to dig into the debugger there |
Worth an alpha08? It looks like Kotlin 2.0.0 will be based on the same commit as Kotlin 2.0.0-RC3: https://github.com/JetBrains/kotlin/commits/e84e83568cde569ee54980542e37c87507e914bc/ |
Only if we need one, otherwise will just wait for 2.0.0 to release |
KSP broke something in the 1.0.21 release google/ksp#1908 |
I'm going to publish an alpha08 against the 2.0 finals, but reluctant to publish a non-alpha until there's resolution on the above-linked KSP2 regression. It appears that it only works on linux in 1.0.21. I can't publish yet though because sonatype appears to be down |
|
I would actually advise against using 0.5.0-alpha08 due to google/ksp#1917, which I didn't notice before releasing due to inherited extra maven repositories set up on this project that I'll remove. |
FWIW detekt updated to alpha07 and now alpha08 with Kotlin 2.0.0 and it seems to be working well with cross platform tests all green, though we don't use KSP at all. Just mentioning as other non-KSP users may be safe to update. |
Hi @ZacSweers, is there any migration guide planned? There is one log message that could have prevented the proper build:
But adding
Any idea? |
See the note about KSP1 (which is still the default) requiring setting a lower language version? |
That was it, indeed. Sorry for not paying enough attention. I though keeping the default value (
Thanks for the quick reply 🙏 |
supportsK2
to true by defaultdisableStandardScript
to true by default. This doesn't seem to work yetNotes
languageVersion
to 1.9TODO