eygraber
04/20/2021, 4:31 AMbuild.gradle.kts
but I can't figure out how to do that. Any help?
allprojects {
repositories {
google()
mavenCentral()
maven("<https://maven.pkg.jetbrains.space/public/p/compose/dev>")
maven("<https://s01.oss.sonatype.org/content/repositories/snapshots>")
}
// trying to do something like the following
kotlin.sourceSets.all {
languageSettings.useExperimentalAnnotation("kotlin.RequiresOptIn")
}
}
eygraber
04/20/2021, 4:32 AMbuild.gradle.kts
ephemient
04/20/2021, 4:34 AMephemient
04/20/2021, 4:36 AMephemient
04/20/2021, 4:38 AMephemient
04/20/2021, 4:39 AMgradle.afterProject { findPlugin()…
but it'll be in the wrong order for overridingeygraber
04/20/2021, 4:41 AMeygraber
04/20/2021, 4:43 AMplugins.whenPluginAdded {
if(this is KotlinBasePluginWrapper) {
val kotlin = extensions.getByName("kotlin") as KotlinMultiplatformExtension
kotlin.sourceSets.all {
languageSettings.useExperimentalAnnotation("kotlin.RequiresOptIn")
}
}
}
Not sure if that is the "right" way or not, but it's a start, and I'll look more into convention plugins.jw
04/20/2021, 4:48 AMplugins.withId('org.jetbrains.kotlin.multiplatform') { .. }
eygraber
04/20/2021, 4:55 AMeygraber
04/20/2021, 4:56 AMval kotlin = extensions.getByType<KotlinMultiplatformExtension>()
louiscad
04/20/2021, 11:56 AMthe<KotlinMultiplatformExtension>()
will also workephemient
04/20/2021, 12:43 PMCarter
04/22/2021, 2:15 PMsubprojects {}
in the root build.gradle to a convention plugin?
I’ve had luck with convention plugins for java and maven, but the kotlin multiplatform plugin is giving me trouble.
I specifically get import issues with the org.jetbrains.kotlin
namespace.
plugins.withId("org.jetbrains.kotlin.multiplatform") {
extensions.findByType<org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension>()?.apply {
targets.all {
compilations.all {
kotlinOptions {
allWarningsAsErrors = run {
val kotlinWarningsAsErrors: String by project
kotlinWarningsAsErrors.toBoolean()
}
freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn"
}
}
}
}
}
I’ve fiddled with the plugins and repositories under both build-conventions/build.gradle.kts and build-conventions/settings.gradle.kts without much luck.
If someone has a working example of applying multiplatform conventions, that would really help.