Username404-Website/build.gradle.kts

73 lines
2.1 KiB
Plaintext
Raw Normal View History

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"
version = "2"
2021-06-20 13:27:01 +02:00
repositories {
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib-js"))
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 13:27:01 +02:00
kotlin {
js(IR) {
moduleName = "Username404_Website"
2021-06-20 15:20:32 +02:00
compilations.all {
with(kotlinOptions) {
val secondDot = coreLibrariesVersion.let { it.indexOf('.', startIndex = it.indexOf('.') + 1) }
apiVersion = coreLibrariesVersion.run {
substring(0 until secondDot)
}
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}"
}
2021-06-20 15:42:32 +02:00
moduleKind = "plain"
2021-06-20 15:20:32 +02:00
freeCompilerArgs = freeCompilerArgs + listOf(
"-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"
cssSupport { isEnabled = true }
2023-08-10 18:38:55 +02:00
})
runTask(Action {
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()
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()
}
}
tasks {
2023-08-10 18:38:55 +02:00
clean.get().delete.add(compilationOutputDirectory)
withType(ProcessResources::class) {
2023-08-10 18:38:55 +02:00
destinationDir = compilationOutputDirectory
}
}