You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had trouble integrating kunafa into a build.gradle.kts (kotlin based) build using the examples in the docs, but managed to come up with the following:
plugins {
id("kotlin2js")
}
dependencies {
implementation(kotlin("stdlib-js"))
implementation("com.narbase:kunafa:0.2.0-beta")
testImplementation(kotlin("stdlib-js"))
}
tasks {
compileKotlin2Js {
kotlinOptions {
outputFile = "${sourceSets.main.get().output.resourcesDir}/output.js"
sourceMap = true
// moduleKind = "plain"
}
}
fun copyJar(outputDir: File, pattern: String) {
val jar = configurations.compileClasspath.get().single {
it.name.matches(Regex(pattern))
}
copy {
includeEmptyDirs = false
from(zipTree(jar))
into(outputDir)
include("**/*.js")
exclude("META-INF/**")
}
}
val unpackKotlinJsStdlib by registering {
group = "build"
description = "Unpack the Kotlin JavaScript standard library"
val outputDir = file("$buildDir/$name")
inputs.property("compileClasspath", configurations.compileClasspath.get())
outputs.dir(outputDir)
doLast {
copyJar(outputDir, "kotlin-stdlib-js-.+\\.jar")
}
}
val unpackKunafaLib by registering {
group = "build"
description = "Unpack the kunafa library"
val outputDir = file("$buildDir/$name")
inputs.property("compileClasspath", configurations.compileClasspath.get())
outputs.dir(outputDir)
doLast {
copyJar(outputDir, "kunafa-.+\\.jar")
}
}
val assembleWeb by registering(Copy::class) {
group = "build"
description = "Assemble the web application"
includeEmptyDirs = false
from(unpackKotlinJsStdlib)
from(unpackKunafaLib)
from(sourceSets.main.get().output) {
exclude("**/*.kjsm")
}
into("$buildDir/web")
}
assemble {
dependsOn(assembleWeb)
}
}
The text was updated successfully, but these errors were encountered:
I had trouble integrating kunafa into a build.gradle.kts (kotlin based) build using the examples in the docs, but managed to come up with the following:
The text was updated successfully, but these errors were encountered: