Skip to content

Commit

Permalink
Merge pull request #97 from sellmair/KT-46273
Browse files Browse the repository at this point in the history
Only 'linkNativeSourceSets' when at least one native target is config…
  • Loading branch information
russhwolf authored Sep 23, 2021
2 parents 82d386e + c99ab21 commit 79fcbb5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion buildSrc/src/main/kotlin/BuildHelpers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinTargetPreset
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJsTargetPreset
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJvmWithJavaTargetPreset
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetPreset
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsTarget
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrTarget
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrTargetPreset
Expand Down Expand Up @@ -58,6 +59,8 @@ fun Project.standardConfiguration(
private val ideaActive by lazy { System.getProperty("idea.active") == "true" }
private val KotlinTargetPreset<*>.isJsTargetPreset: Boolean
get() = this is KotlinJsTargetPreset || this is KotlinJsIrTargetPreset
private val KotlinTargetPreset<*>.isNativeTargetPreset: Boolean
get() = this is KotlinNativeTargetPreset
private val KotlinTarget.isJsTarget: Boolean
get() = this is KotlinJsTarget || this is KotlinJsIrTarget

Expand Down Expand Up @@ -95,7 +98,9 @@ private fun KotlinMultiplatformExtension.buildAllTargets(targetPresets: NamedDom
}
}

linkNativeSourceSets()
if (targetPresets.any { it.isNativeTargetPreset }) {
linkNativeSourceSets()
}
}

private fun KotlinMultiplatformExtension.linkNativeSourceSets() {
Expand Down

0 comments on commit 79fcbb5

Please sign in to comment.