https://kotlinlang.org logo
Title
a

Alex Spence

11/20/2021, 2:58 AM
Hello - just ported my project from KAPT to KSP, so far experience has been great! But I'm having issues configuring the Gradle JVM Toolchain for the KspTask. Is there any documentation for how to set it up? For KAPT I had to add this snippet to my subProjects block:
tasks.withType<org.jetbrains.kotlin.gradle.internal.KaptTask> {
        kotlinJavaToolchain.toolchain.use(customLauncher)
    }
e

elect

11/20/2021, 9:05 AM
why would you set a specific toolchain for the kps only? I'd expect it to use the same toolchain the sources themselves are using, or?
a

Alex Spence

11/22/2021, 3:38 PM
Setting just the kotlin toolchain just doesn't work at all in my project. I've tried only setting:
kotlin {
    jvmToolchain {
        (this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(17))
    }
}
e

elect

11/22/2021, 3:39 PM
what do you mean doesnt work?
a

Alex Spence

11/22/2021, 3:39 PM
I do have a multi module project and I suspect that may be why, so I have to use a custom launcher and apply it to each task type. I was able to work around this problem with KAPT but no matter what I do to the KspTasks they seem to use the wrong version of the JVM.
e

elect

11/22/2021, 3:39 PM
However I suggest you to ask in #ksp, they are pretty responsive
😄 1
a

Alex Spence

11/22/2021, 3:39 PM
I get an error stating that code was compiled with the wrong version of the JVM on jenkins, which has Java 8 on it
I did post this in ksp right?