This message was deleted.
# community-support
s
This message was deleted.
1
c
Is your project compiling Gradle code (plugins, tasks, etc) or application code?
j
I'm compiling Gradle code — it's a plugin for Gradle.
c
cool. 👀
j
Reproducible locally as well. Just switching back to 8.1.1 lets me compiling the code. Branch: master
c
This is suspect, we should track down what is triggering it:
WARNING: Unsupported Kotlin plugin version.
The
embedded-kotlin
and
kotlin-dsl
plugins rely on features of Kotlin
1.8.20
that might work differently than in the requested version
1.8.22
.
j
I've seen that in 8.1.1 too, it's not problematic at all.
c
it is suspect and perhaps triggering this issue. It indicates that you’re messing with the embedded Kotlin version, which shouldn’t be done, it has bad effects.
A few issues here that confuse the Kotlin stuff:
Copy code
plugins {
    `jvm-test-suite`
    `java-test-fixtures`
    `java-gradle-plugin`
    `kotlin-dsl`
    `maven-publish`
    alias(libs.plugins.kotlin)
    alias(libs.plugins.kotlinSerialization)
    alias(libs.plugins.kotlinSamWithReceiver)
    alias(libs.plugins.pluginPublish)
    alias(libs.plugins.changelog)
    alias(libs.plugins.dokka)
}
1. `java-gradle-plugin`is provided by
kotlin-dsl
and can be removed (this is cleanup, unrelated to issue) 2.
libs.plugins.kotlin
should not be mixed with
kotlin-dsl
. The former is for compiling application code with Kotlin; the latter is for what you are doing, compiling Gradle code.
iirc kotlin SAM with receiver is part of embedded Kotlin with Gradle.
j
The following didn’t help:
Copy code
plugins {
    `jvm-test-suite`
    `java-test-fixtures`
//    `java-gradle-plugin`
    `kotlin-dsl`
    `maven-publish`
//    alias(libs.plugins.kotlin)
    alias(libs.plugins.kotlinSerialization)
//    alias(libs.plugins.kotlinSamWithReceiver)
    alias(libs.plugins.pluginPublish)
    alias(libs.plugins.changelog)
    alias(libs.plugins.dokka)
}
c
That’s part of it. There’s more to work through - looking at this:
compileOnly(libs.kotlinGradlePlugin)
…and perhaps other inclusions of stuff at different Kotlin versions.
Getting there… seeing this now, which is why
lowercase()
isn’t compiling:
w: Language version 1.4 is deprecated and its support will be removed in a future version of Kotlin
These changes:
Copy code
plugins {
    `jvm-test-suite`
    `java-test-fixtures`
//    `java-gradle-plugin`
    `kotlin-dsl`
    `maven-publish`
 //   alias(libs.plugins.kotlin)
    id("org.jetbrains.kotlin.plugin.serialization") version(embeddedKotlinVersion)
    // kotlinSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
//    alias(libs.plugins.kotlinSerialization)
 //   alias(libs.plugins.kotlinSamWithReceiver)
    alias(libs.plugins.pluginPublish)
    alias(libs.plugins.changelog)
    alias(libs.plugins.dokka)
}
and these dep changes:
Copy code
implementation(libs.jacksonDatabind)
//    implementation(libs.kotlinxSerializationJson)
    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1")
    implementation(libs.jaxbApi)
    implementation(libs.ddPlist)

//    compileOnly(libs.kotlinGradlePlugin)
    additionalPluginClasspath(libs.kotlinGradlePlugin)
ummm. scrolling down further in the build script… why is the lang set to 1.4?
Copy code
withType<KotlinCompile> {
        kotlinOptions {
            jvmTarget = "11"
            apiVersion = "1.4"
            languageVersion = "1.4"
        }
    }
that’s the problem (in addition to a bunch of incorrect Kotlin version deps). No idea how that would have worked on previous Gradle versions.
j
I'm also surprised with that. 🙃 I guess I can entirely drop the above part as I rely on JVM Toolchain.
c
Ok, so fixing that (removing api + lang for kotlin compile) and adjusting this one dep is allowing the code to compile, tests to run:
Copy code
//    compileOnly(libs.kotlinGradlePlugin)
    compileOnly("org.jetbrains.kotlin:kotlin-gradle-plugin:$embeddedKotlinVersion")
v
I guess I can entirely drop the above part as I rely on JVM Toolchain.
... yeah ... no
The
jvmTarget
yes, if that is coming from the toolchain anyway
But
apiVersion
and
languageVersion
is about Kotlin api and language so is not related to the JVM toolchain
I wonder like Chris why it worked previously, but didn't have any look, just read the messages here.
lowercase()
was introduced later than 1.4 I think as a replacement for
toLowerCase()
.
👍 1
Whether you can remove the api and language version probably highly depends on what Gradle versions you want to support.
If you use a higher value, you might not be able to run on older Gradle versions. But you hopefully have integration tests for the Gradle version you want to support to ensure it does not break. 😉
And btw. to answer the inital question, yes. In 8.1.1 1.8.10 was shipped, in 8.2 1.8.20 is shipped.
c
Given that that configuration wasn’t previously used (for whatever reason) the plugin would have targeted the Gradle embedded kotlin api/lang levels (not 1.4 as requested in the config). Dunno whether that would be right or wrong for this plugins Gradle compatibility requirements…
v
Maybe, maybe not, who knows. 😄
c
🤷
v
It needs to be investigated and / or tested
j
Thanks for your input, folks! Here’s the commit that resolved the issue: https://github.com/JetBrains/gradle-intellij-plugin/commit/dfaea1a67024894791d7b984f306d26154eac1ec
v
Actually, for the things you need with embedded Kotlin version, I wouldn't use the version catalog, but
embeddedKotlin("<kotlin-module>")
🙌 1
j
This message contains interactive elements.
v
The usual workaround probably works
project.dependencies.embeddedKotlin("kotlin-test")
and additionally open a feature request or even better PR 🙂
🙏 1
j
Even worst:
Copy code
implementation(project.dependencies.embeddedKotlin("test") as String)
v
Why "as String"? o_O
j
embeddedKotlin
gives you
Any
(but eventually a
String
)which confuses
implementation
.
v
😞
You could abstract it into an extension function 🙂
Copy code
fun JvmComponentDependencies.embeddedKotlin(module: String) =
    project.dependencies.embeddedKotlin(module) as String