Username404-Website/build.gradle.kts

73 lines
2.1 KiB
Plaintext

plugins {
id("org.jetbrains.kotlin.js") version "1.9.22"
}
group = "fr.username404"
version = "2"
repositories {
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib-js"))
implementation("org.jetbrains.kotlinx:kotlinx-html:${rootProject.property("kotlinx-html_version")}")
}
val compilationOutputDirectory = 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)
}
val majorVersion = apiVersion!!.substringBefore('.').toInt()
val minorVersion = apiVersion!!.substringAfter('.').toInt()
languageVersion = if (minorVersion == 9) {
"${majorVersion + 1}.0"
} else {
"$majorVersion.${minorVersion + 1}"
}
moduleKind = "plain"
freeCompilerArgs = freeCompilerArgs + listOf(
"-opt-in=kotlin.RequiresOptIn",
"-opt-in=kotlin.js.ExperimentalJsExport",
"-Xir-property-lazy-initialization"
)
}
}
browser {
webpackTask(Action {
outputDirectory = compilationOutputDirectory
output.library = "Web404"
output.libraryTarget = "this"
cssSupport { isEnabled = true }
})
runTask(Action {
cssSupport { isEnabled = true }
})
testTask(Action {
useKarma {
useFirefoxNightlyHeadless()
webpackConfig.cssSupport { isEnabled = true }
}
})
}
binaries.executable()
}
}
tasks {
clean.get().delete.add(compilationOutputDirectory)
withType(ProcessResources::class) {
destinationDir = compilationOutputDirectory
}
}