From 9a5086af1dc88a6fb139241988fc96051fb5ebe0 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Wed, 18 Jul 2018 20:10:40 +0700 Subject: [PATCH] [gradle-plugin] Don't create compiler tasks for unsupported targets --- .../plugins/KotlinNativePlugin.kt | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/plugins/KotlinNativePlugin.kt b/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/plugins/KotlinNativePlugin.kt index 899cc9e2309..e63306cd011 100644 --- a/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/plugins/KotlinNativePlugin.kt +++ b/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/experimental/plugins/KotlinNativePlugin.kt @@ -112,23 +112,26 @@ class KotlinNativePlugin @Inject constructor(val attributesFactory: ImmutableAtt objects ) - val binary = component.addBinary(kind, variantIdentity) + if (hostManager.isEnabled(target)) { + val binary = component.addBinary(kind, variantIdentity) - if (kind.publishable) { - if (hostManager.isEnabled(target)) { + if (kind == developmentKind && + buildType == KotlinNativeBuildType.DEBUG && + target == developmentTarget) { + component.developmentBinary.set(binary) + } + + if (kind.publishable) { component.mainPublication.variants.add(binary) - } else { + } + + } else { + if (kind.publishable) { // Known but not buildable. // It allows us to publish different parts of a multitarget library from differnt hosts. component.mainPublication.variants.add(variantIdentity) } } - - if (kind == developmentKind && - buildType == KotlinNativeBuildType.DEBUG && - target == developmentTarget) { - component.developmentBinary.set(binary) - } } } }