mirror of
https://github.com/bitsycore/skiko.git
synced 2026-10-07 15:37:27 +00:00
63 lines
1.5 KiB
Kotlin
63 lines
1.5 KiB
Kotlin
plugins {
|
|
kotlin("multiplatform") version "1.5.31"
|
|
}
|
|
|
|
repositories {
|
|
mavenLocal()
|
|
mavenCentral()
|
|
maven("https://dl.bintray.com/kotlin/kotlin-eap")
|
|
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
|
|
}
|
|
|
|
var version = "0.0.0-SNAPSHOT"
|
|
if (project.hasProperty("skiko.version")) {
|
|
version = project.properties["skiko.version"] as String
|
|
}
|
|
|
|
val resourcesDir = "$buildDir/resources/"
|
|
|
|
val skikoWasm by configurations.creating
|
|
|
|
dependencies {
|
|
skikoWasm("org.jetbrains.skiko:skiko-js-wasm-runtime:$version")
|
|
}
|
|
|
|
val unzipTask = tasks.register("unzipWasm", Copy::class) {
|
|
destinationDir = file(resourcesDir)
|
|
from(skikoWasm.map { zipTree(it) })
|
|
}
|
|
|
|
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile>().configureEach {
|
|
dependsOn(unzipTask)
|
|
}
|
|
|
|
kotlin {
|
|
|
|
js(IR) {
|
|
browser()
|
|
binaries.executable()
|
|
}
|
|
|
|
sourceSets {
|
|
val commonMain by getting {
|
|
dependencies {
|
|
implementation("org.jetbrains.skiko:skiko:$version")
|
|
}
|
|
}
|
|
|
|
val jsMain by getting {
|
|
dependsOn(commonMain)
|
|
resources.setSrcDirs(resources.srcDirs)
|
|
resources.srcDirs(unzipTask.map { it.destinationDir })
|
|
}
|
|
}
|
|
}
|
|
|
|
// a temporary workaround for a bug in jsRun invocation - see https://youtrack.jetbrains.com/issue/KT-48273
|
|
afterEvaluate {
|
|
extensions.configure<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension> {
|
|
versions.webpackDevServer.version = "4.0.0"
|
|
}
|
|
}
|
|
|