xxfast
03/23/2023, 10:39 AM// module-1 build.gradle.kts
plugin {
kotlin("multiplatform")
}
// module-2 build.gradle.kts
plugin {
kotlin("jvm")
}
// module-3 build.gradle.kts
plugin {
kotlin("js")
}
how do I enable explicitApi
mode for allprojects{}
of the root build.gradle.pks ?
// root build.gradle.kts
allprojects {
extensions.configure<KotlinMultiplatformExtension> { explicitApi() } // Extension of type 'KotlinMultiplatformExtension' does not exist.
}
tapchicoma
03/23/2023, 12:20 PMKotlinMultiplatformExtension
with org.jetbrains.kotlin.gradle.dsl.KotlinTopLevelExtensionConfig
Vampire
03/23/2023, 7:07 PMallprojects { ... }
and subprojects { ... }
are evil.
Better use convention plugins.
So for example have a my.common.conventions
convention plugin that sets the explicitApi
, and apply it to all three projects explicitly.
Or have additionally a plugin my.kmp.conventions
, my.jvm.conventions
, and my.js.conventions
that each apply my.common.conventions
and the respective Kotlin plugin, then apply those to your projects.