spierce7
08/18/2020, 4:33 PMkotlin
extension, and instead I have. to define it. It's ugly, but works. Anyone know of a solution?
plugins.withType(KotlinMultiplatformPlugin::class) {
afterEvaluate {
val kotlin = (this as ExtensionAware).extensions.getByName("kotlin") as org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
kotlin.sourceSets.map {
it.apply {
languageSettings.apply {
useExperimentalAnnotation("kotlin.ExperimentalStdlibApi")
useExperimentalAnnotation("kotlinx.coroutines.FlowPreview")
useExperimentalAnnotation("kotlinx.coroutines.ExperimentalCoroutinesApi")
}
}
}
}
}
Sebastian Sellmair [JB]
08/18/2020, 5:03 PMkotlin.sourceSets.map
, since this will iterate over the current content of the source sets. Instead, you can probably drop the afterEvaluate
in favour of kotlin.sourceSets.all
or kotlin.sourceSets.configureEach
Sebastian Sellmair [JB]
08/18/2020, 5:05 PMall
and configureEach
will apply your configuration block also to all the subsequently added sourceSets. The difference between those function is:
• all
will configure the source sets immediately (not lazy)
• configureEach
will configure the source sets when they are required (lazy)Sebastian Sellmair [JB]
08/18/2020, 5:06 PMplugins.withType(..) { }
with plugins.withType(...).configureEach { }
to be "even more lazy"spierce7
08/18/2020, 7:52 PM