2021-06-20 13:27:01 +02:00
|
|
|
plugins {
|
2023-01-21 17:01:37 +01:00
|
|
|
id("org.jetbrains.kotlin.js") version "1.8.0"
|
2021-06-20 13:27:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
group = "fr.username404"
|
2023-01-21 17:01:37 +01:00
|
|
|
version = "1"
|
2021-06-20 13:27:01 +02:00
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
implementation(kotlin("stdlib-js"))
|
2021-06-20 21:05:00 +02:00
|
|
|
implementation("org.jetbrains.kotlinx:kotlinx-html:${rootProject.property("kotlinx-html_version")}")
|
2021-06-20 13:27:01 +02:00
|
|
|
}
|
|
|
|
|
2021-06-20 15:57:44 +02:00
|
|
|
val outputDirectory = file("$rootDir/compiledOutput")
|
|
|
|
|
2021-06-20 13:27:01 +02:00
|
|
|
kotlin {
|
|
|
|
js(IR) {
|
|
|
|
moduleName = "Username404_Website"
|
2021-06-20 15:20:32 +02:00
|
|
|
compilations.all {
|
2023-01-21 17:01:37 +01:00
|
|
|
with(kotlinOptions) {
|
2021-11-21 14:33:16 +01:00
|
|
|
val secondDot = coreLibrariesVersion.let { it.indexOf('.', startIndex = it.indexOf('.') + 1) }
|
|
|
|
apiVersion = coreLibrariesVersion.run {
|
2023-01-21 17:01:37 +01:00
|
|
|
substring(0 until secondDot)
|
2021-11-21 14:33:16 +01:00
|
|
|
}
|
|
|
|
languageVersion = apiVersion!!.substringBefore('.') + '.' + (apiVersion!!.substringAfter('.').toInt() + 1).toString()
|
2023-01-21 17:01:37 +01:00
|
|
|
|
2021-06-20 15:42:32 +02:00
|
|
|
moduleKind = "plain"
|
2021-06-20 15:20:32 +02:00
|
|
|
freeCompilerArgs = freeCompilerArgs + listOf(
|
2023-01-21 17:01:37 +01:00
|
|
|
"-opt-in=kotlin.RequiresOptIn",
|
|
|
|
"-opt-in=kotlin.js.ExperimentalJsExport",
|
2021-06-20 15:34:54 +02:00
|
|
|
"-Xir-property-lazy-initialization"
|
2021-06-20 15:20:32 +02:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
2021-06-20 13:27:01 +02:00
|
|
|
browser {
|
|
|
|
webpackTask {
|
2021-06-20 15:57:44 +02:00
|
|
|
destinationDirectory = outputDirectory
|
2021-06-20 16:20:53 +02:00
|
|
|
output.library = "Web404"
|
|
|
|
output.libraryTarget = "this"
|
2023-01-21 17:01:37 +01:00
|
|
|
cssSupport { isEnabled = true }
|
2021-06-20 13:27:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
runTask {
|
2023-01-21 17:01:37 +01:00
|
|
|
cssSupport { isEnabled = true }
|
2021-06-20 13:27:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
testTask {
|
|
|
|
useKarma {
|
|
|
|
useFirefoxNightlyHeadless()
|
2023-01-21 17:01:37 +01:00
|
|
|
webpackConfig.cssSupport { isEnabled = true }
|
2021-06-20 13:27:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
binaries.executable()
|
|
|
|
}
|
|
|
|
}
|
2021-06-20 15:57:44 +02:00
|
|
|
|
|
|
|
tasks {
|
|
|
|
clean.get().delete.add(outputDirectory)
|
|
|
|
withType(ProcessResources::class) {
|
|
|
|
destinationDir = outputDirectory
|
|
|
|
}
|
|
|
|
}
|