Revert native plugin configuration
This commit is contained in:
parent
8df651bead
commit
b4f494e58a
@ -2,24 +2,61 @@ package space.kscience.gradle
|
|||||||
|
|
||||||
import org.gradle.api.Plugin
|
import org.gradle.api.Plugin
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.kotlin.dsl.hasPlugin
|
import org.gradle.kotlin.dsl.*
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||||
|
|
||||||
|
@Deprecated("Use common configuration block")
|
||||||
public class KScienceNativePlugin : Plugin<Project> {
|
public class KScienceNativePlugin : Plugin<Project> {
|
||||||
override fun apply(project: Project): Unit = project.run {
|
override fun apply(project: Project): Unit = project.run {
|
||||||
|
logger.warn("Native plugin is deprecated. Use `ksceince.native()`")
|
||||||
|
|
||||||
//Apply multiplatform plugin is not applied, apply it
|
//Apply multiplatform plugin is not applied, apply it
|
||||||
if (!plugins.hasPlugin("org.jetbrains.kotlin.multiplatform")) {
|
if (!plugins.hasPlugin("org.jetbrains.kotlin.multiplatform")) {
|
||||||
logger.info("Kotlin multiplatform plugin is not resolved. Adding it automatically")
|
logger.info("Kotlin multiplatform plugin is not resolved. Adding it automatically")
|
||||||
plugins.apply("org.jetbrains.kotlin.multiplatform")
|
plugins.apply("org.jetbrains.kotlin.multiplatform")
|
||||||
}
|
}
|
||||||
|
|
||||||
registerKScienceExtension(::KScienceMppExtension).apply {
|
if (!plugins.hasPlugin(KScienceCommonPlugin::class)) {
|
||||||
native()
|
logger.info("KScience plugin is not resolved. Adding it automatically")
|
||||||
|
apply<KScienceCommonPlugin>()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plugins.hasPlugin(KScienceCommonPlugin::class)) {
|
configure<KotlinMultiplatformExtension> {
|
||||||
configureKScience()
|
val nativeTargets = setOf(
|
||||||
} else {
|
linuxX64(),
|
||||||
project.logger.warn("Use `kscience.native()` configuration block")
|
mingwX64(),
|
||||||
|
macosX64(),
|
||||||
|
iosX64(),
|
||||||
|
iosArm64()
|
||||||
|
)
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
val commonMain = findByName("commonMain")!!
|
||||||
|
val commonTest = findByName("commonTest")!!
|
||||||
|
|
||||||
|
val nativeMain by creating {
|
||||||
|
dependsOn(commonMain)
|
||||||
|
}
|
||||||
|
|
||||||
|
val nativeTest by creating {
|
||||||
|
//should NOT depend on nativeMain because automatic dependency by plugin
|
||||||
|
dependsOn(commonTest)
|
||||||
|
}
|
||||||
|
|
||||||
|
configure(nativeTargets) {
|
||||||
|
compilations["main"]?.apply {
|
||||||
|
configure(kotlinSourceSets) {
|
||||||
|
dependsOn(nativeMain)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
compilations["test"]?.apply {
|
||||||
|
configure(kotlinSourceSets) {
|
||||||
|
dependsOn(nativeTest)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user