blob: bb498a7f6f95fc02c016d49b46a83d3ce8c9b4e0 [file]
@file:OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class)
import org.gradle.kotlin.dsl.support.serviceOf
plugins {
id("common-configuration")
id("com.autonomousapps.dependency-analysis")
kotlin("multiplatform")
id("binaryen-configuration")
}
val buildFeatures = serviceOf<BuildFeatures>()
kotlin {
jvm()
js {
if (!buildFeatures.isolatedProjects.active.get()) {
binaries.executable()
}
}
wasmJs {
if (!buildFeatures.isolatedProjects.active.get()) {
binaries.executable()
}
}
if (kotlinBuildProperties.isInIdeaSync.get()) {
// this magic is needed because of explicit dependency of common
// source set on the stdlib
val hostOs = System.getProperty("os.name")
val isMingwX64 = hostOs.startsWith("Windows")
@Suppress("DEPRECATION", "DEPRECATION_ERROR")
when {
hostOs == "Mac OS X" -> macosX64("native")
hostOs == "Linux" -> linuxX64("native")
isMingwX64 -> mingwX64("native")
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}
} else {
linuxX64()
macosArm64()
mingwX64()
}
sourceSets {
val commonMain = getByName("commonMain") {
dependencies {
implementation(kotlinStdlib())
}
}
}
}
sourceSets {
"main" { projectDefault() }
"test" { none() }
}
tasks.register("distAnnotations") {
dependsOn("jvmJar", "jsJar", "wasmJsJar")
}