Ben Madore
09/23/2021, 5:02 PMkotlin-conventions
plugin (precompiled script plugin), that users can put on their app, and it will configure kotlin (apply various plugins, imports kotlin bom, configure detekt etc.)
the version of the kotlin bom applied is configurable via an extension class, but i’ve run into an issue with kapt.
the version of the kotlin plugins (e.g. kapt) applied seems to be fixed, by whatever is added to the plugin build’s classpath.
Is there any way to make this configurable? It looks like using kotlin 1.5.31 at runtime, with kapt plugin version 1.4.31 was causing some very strange and unexpected failures. and i’m not sure how to solve this for a generic plugin.
i guess the generic question is: is there any way to apply a plugin to a project, where the version of the plugin comes from an extension object, and is not statically defined.tapchicoma
09/23/2021, 5:04 PMBen Madore
09/23/2021, 5:13 PMBen Madore
09/23/2021, 5:16 PMmyPlugin {
kotlinVersion = "1.5.31"
}
plugin:
plugins { // these versions come from whatever the PLUGIN's build has defined on classpath, in this case 1.4.31
id("my.java-conventions")
id("org.jetbrains.kotlin.jvm")
id("org.jetbrains.kotlin.kapt")
id("org.jetbrains.kotlin.plugin.spring")
id("org.jetbrains.kotlin.plugin.jpa")
id("io.gitlab.arturbosch.detekt")
id("org.jetbrains.dokka")
}
dependencies {
implementation(platform("org.jetbrains.kotlin:kotlin-bom:${extension.kotlinVersion}"))
implementation(platform("org.jetbrains.kotlinx:kotlinx-coroutines-bom:${extension.kotlinCoroutinesVersion}")
...
}
tapchicoma
09/23/2021, 5:33 PMcompileOnly
dependency and react on it via plugin.withId('org.jetbrains.kotlin....') { ... }
Ben Madore
09/23/2021, 5:38 PMtapchicoma
09/23/2021, 5:40 PMBen Madore
09/23/2021, 6:54 PMHanno
09/24/2021, 5:04 PMBen Madore
09/24/2021, 9:55 PMHanno
09/25/2021, 12:04 PMHanno
09/27/2021, 7:22 AM