blob: d5cf6249f2fb25a81a459ccd0bd038efa223576e [file] [log] [blame]
import org.jetbrains.kotlin.gradle.*
import org.jetbrains.kotlin.gradle.plugin.mpp.*
/*
* Copyright 2017-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
plugins {
kotlin("multiplatform")
}
kotlin {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
applyDefaultHierarchyTemplate {
}
// According to https://kotlinlang.org/docs/native-target-support.html
// Tier 1
macosX64()
macosArm64()
iosSimulatorArm64()
iosX64()
// Tier 2
linuxX64()
linuxArm64()
watchosSimulatorArm64()
watchosX64()
watchosArm32()
watchosArm64()
tvosSimulatorArm64()
tvosX64()
tvosArm64()
iosArm64()
// Tier 3
mingwX64()
// https://github.com/square/okio/issues/1242#issuecomment-1759357336
if (doesNotDependOnOkio(project)) {
androidNativeArm32()
androidNativeArm64()
androidNativeX86()
androidNativeX64()
watchosDeviceArm64()
// Deprecated, but not removed
linuxArm32Hfp()
}
// setup tests running in RELEASE mode
targets.withType<KotlinNativeTarget>().configureEach {
binaries.test(listOf(NativeBuildType.RELEASE))
}
targets.withType<KotlinNativeTargetWithTests<*>>().configureEach {
testRuns.create("releaseTest") {
setExecutionSourceFrom(binaries.getTest(NativeBuildType.RELEASE))
}
}
}
fun doesNotDependOnOkio(project: Project): Boolean {
return !project.name.contains("json-okio") && !project.name.contains("json-tests")
}