diff --git a/build-conventions/src/main/kotlin/convention.kotlin-mpp.gradle.kts b/build-conventions/src/main/kotlin/convention.kotlin-mpp.gradle.kts index a7f02f3..ce34a6a 100644 --- a/build-conventions/src/main/kotlin/convention.kotlin-mpp.gradle.kts +++ b/build-conventions/src/main/kotlin/convention.kotlin-mpp.gradle.kts @@ -1,4 +1,10 @@ +import Env.CI +import Env.SANDBOX import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeCompilation +import util.buildHost +import util.enabled +import util.mainHost plugins { id("convention.base") @@ -8,4 +14,21 @@ plugins { kotlin { @OptIn(ExperimentalKotlinGradlePluginApi::class) targetHierarchy.default() + + targets.all target@{ + val control = Action { + onlyIf { + !CI || this@target.enabled || (SANDBOX && this@target.buildHost == mainHost) + } + } + compilations.all compilation@{ + compileTaskProvider.configure(control) + + if (this@compilation is KotlinNativeCompilation) { + this@compilation.cinterops.all { + tasks.named(interopProcessingTaskName, control) + } + } + } + } } diff --git a/build-conventions/src/main/kotlin/convention.publishing-mpp.gradle.kts b/build-conventions/src/main/kotlin/convention.publishing-mpp.gradle.kts index eed2ef7..4a5e6ff 100644 --- a/build-conventions/src/main/kotlin/convention.publishing-mpp.gradle.kts +++ b/build-conventions/src/main/kotlin/convention.publishing-mpp.gradle.kts @@ -1,7 +1,6 @@ import Env.CI import Env.SANDBOX import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinAndroidTarget -import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeCompilation import org.jetbrains.kotlin.konan.target.HostManager import util.buildHost import util.enabled @@ -29,21 +28,11 @@ kotlin { } targets.all target@{ - val control = Action { + configurePublishTasks(this@target.name) { onlyIf { !CI || this@target.enabled || (SANDBOX && this@target.buildHost == mainHost) } } - compilations.all compilation@{ - compileTaskProvider.configure(control) - - if (this@compilation is KotlinNativeCompilation) { - this@compilation.cinterops.all { - tasks.named(interopProcessingTaskName, control) - } - } - configurePublishTasks(this@target.name, control) - } if (this@target is KotlinAndroidTarget && (!CI || this@target.enabled || SANDBOX)) this@target.publishLibraryVariants("release", "debug")