2021-06-20 13:27:01 +02:00
|
|
|
plugins {
|
2023-08-10 18:38:55 +02:00
|
|
|
id("org.jetbrains.kotlin.js") version "1.9.0"
|
2021-06-20 13:27:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
group = "fr.username404"
|
2023-01-27 22:07:37 +01:00
|
|
|
version = "2"
|
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
|
|
|
}
|
|
|
|
|
2023-08-10 18:38:55 +02:00
|
|
|
val compilationOutputDirectory = file("$rootDir/compiledOutput")
|
2021-06-20 15:57:44 +02:00
|
|
|
|
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
|
|
|
}
|
2023-08-10 18:38:55 +02:00
|
|
|
val majorVersion = apiVersion!!.substringBefore('.').toInt()
|
|
|
|
val minorVersion = apiVersion!!.substringAfter('.').toInt()
|
|
|
|
languageVersion = if (minorVersion == 9) {
|
|
|
|
"${majorVersion + 1}.0"
|
|
|
|
} else {
|
|
|
|
"$majorVersion.${minorVersion + 1}"
|
|
|
|
}
|
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 {
|
2023-08-10 18:38:55 +02:00
|
|
|
webpackTask(Action {
|
|
|
|
outputDirectory = compilationOutputDirectory
|
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 }
|
2023-08-10 18:38:55 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
runTask(Action {
|
2023-01-21 17:01:37 +01:00
|
|
|
cssSupport { isEnabled = true }
|
2023-08-10 18:38:55 +02:00
|
|
|
})
|
2021-06-20 13:27:01 +02:00
|
|
|
|
2023-08-10 18:38:55 +02:00
|
|
|
testTask(Action {
|
2021-06-20 13:27:01 +02:00
|
|
|
useKarma {
|
|
|
|
useFirefoxNightlyHeadless()
|
2023-01-21 17:01:37 +01:00
|
|
|
webpackConfig.cssSupport { isEnabled = true }
|
2021-06-20 13:27:01 +02:00
|
|
|
}
|
2023-08-10 18:38:55 +02:00
|
|
|
})
|
2021-06-20 13:27:01 +02:00
|
|
|
}
|
|
|
|
binaries.executable()
|
|
|
|
}
|
|
|
|
}
|
2021-06-20 15:57:44 +02:00
|
|
|
|
|
|
|
tasks {
|
2023-08-10 18:38:55 +02:00
|
|
|
clean.get().delete.add(compilationOutputDirectory)
|
2021-06-20 15:57:44 +02:00
|
|
|
withType(ProcessResources::class) {
|
2023-08-10 18:38:55 +02:00
|
|
|
destinationDir = compilationOutputDirectory
|
2021-06-20 15:57:44 +02:00
|
|
|
}
|
|
|
|
}
|