Grégory Lureau
07/08/2022, 9:51 AMplugins {
id("com.deezer.kmp.convention-plugin") version "0.1.0"
}
kmpp {
platformJvm.set(true)
}
but I've a couple of issues:
• when I use a Property (from an abstract Extension), the value is accessible only if I use afterEvaluate
• (I think) the multiplatform plugin expects to be configured in the configuration pass , and what I do in the afterEvaluate is too late
Is it possible to listen Property changes so that I can apply multiplatform plugin when the value is set? (I suppose it's still the configuration phase)
Any help or idea is much appreciated.Javier
07/08/2022, 9:55 AMpublic fun Project.kmpp(action: Action<KMPPExtension> = Action {}) {
action.invoke(the())
// configure here
}
mbonnin
07/08/2022, 10:15 AMJavier
07/08/2022, 10:16 AMGrégory Lureau
07/08/2022, 11:16 AMpublic fun Project.kmpp(
action: Action<KmppConventionPluginExtension> = Action {},
sourceSetsConfigure: Action<NamedDomainObjectContainer<KotlinSourceSet>> = Action {}
) {
action(the())
val ext = extensions["kmppExt"] as KmppConventionPluginExtension
plugins.apply("org.jetbrains.kotlin.multiplatform")
val kotlin = extensions.getByName<KotlinMultiplatformExtension>("kotlin")
if (ext.platformJvm.get()) kotlin.jvm()
// More configuration
sourceSetsConfigure(kotlin.sourceSets)
}
I was expecting to be able to use kotlin { ...}
directly after my extension function, but it's tricky in my case : if the multiplatform plugin is applied in the Plugin
apply method, it fails because there is no targets, and if it's in the extension function then kotlin { ... }
is not available in the build.gradle.kts as the plugin has not been applied yet.Javier
07/08/2022, 11:51 AMGrégory Lureau
07/08/2022, 11:57 AMJavier
07/08/2022, 12:03 PMsrc
part with no issuesGrégory Lureau
07/08/2022, 12:06 PMhubdle
)Javier
07/08/2022, 12:06 PMkotlin {
multiplatform { ... }
}
Grégory Lureau
07/08/2022, 12:07 PMJavier
07/08/2022, 12:07 PMGrégory Lureau
07/08/2022, 12:10 PMJavier
07/08/2022, 12:11 PM