Username404-Website/build.gradle.kts

67 lines
1.8 KiB
Plaintext

plugins {
id("org.jetbrains.kotlin.js") version "1.8.20"
}
group = "fr.username404"
version = "2"
repositories {
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib-js"))
implementation("org.jetbrains.kotlinx:kotlinx-html:${rootProject.property("kotlinx-html_version")}")
}
val outputDirectory = file("$rootDir/compiledOutput")
kotlin {
js(IR) {
moduleName = "Username404_Website"
compilations.all {
with(kotlinOptions) {
val secondDot = coreLibrariesVersion.let { it.indexOf('.', startIndex = it.indexOf('.') + 1) }
apiVersion = coreLibrariesVersion.run {
substring(0 until secondDot)
}
languageVersion = apiVersion!!.substringBefore('.') + '.' + (apiVersion!!.substringAfter('.').toInt() + 1).toString()
moduleKind = "plain"
freeCompilerArgs = freeCompilerArgs + listOf(
"-opt-in=kotlin.RequiresOptIn",
"-opt-in=kotlin.js.ExperimentalJsExport",
"-Xir-property-lazy-initialization"
)
}
}
browser {
webpackTask {
destinationDirectory = outputDirectory
output.library = "Web404"
output.libraryTarget = "this"
cssSupport { isEnabled = true }
}
runTask {
cssSupport { isEnabled = true }
}
testTask {
useKarma {
useFirefoxNightlyHeadless()
webpackConfig.cssSupport { isEnabled = true }
}
}
}
binaries.executable()
}
}
tasks {
clean.get().delete.add(outputDirectory)
withType(ProcessResources::class) {
destinationDir = outputDirectory
}
}