2022-10-16 12:47:45 +02:00
|
|
|
import io.kvision.gradle.KVisionPlugin
|
2022-01-04 15:09:50 +01:00
|
|
|
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
|
2021-12-06 22:15:26 +01:00
|
|
|
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig
|
2022-10-04 22:38:00 +02:00
|
|
|
|
2022-04-20 16:30:23 +02:00
|
|
|
|
2021-12-06 22:15:26 +01:00
|
|
|
plugins {
|
2022-09-18 20:49:32 +02:00
|
|
|
id("kafkatorio.conventions.lang.kotlin-js")
|
2022-02-09 11:53:58 +01:00
|
|
|
id("io.kvision")
|
2022-06-20 23:59:22 +02:00
|
|
|
kotlin("plugin.serialization")
|
2022-10-02 12:11:06 +02:00
|
|
|
id("dev.adamko.geedeecee")
|
2021-12-06 22:15:26 +01:00
|
|
|
}
|
|
|
|
|
|
2022-05-14 12:23:58 +02:00
|
|
|
|
2022-06-20 23:59:22 +02:00
|
|
|
kvision {
|
|
|
|
|
enableHiddenKotlinJsStore.set(false)
|
|
|
|
|
}
|
2022-05-14 12:23:58 +02:00
|
|
|
|
2022-06-26 14:56:53 +02:00
|
|
|
|
2022-06-19 10:16:37 +02:00
|
|
|
kotlin {
|
|
|
|
|
js(IR) {
|
2021-12-06 22:15:26 +01:00
|
|
|
browser {
|
2022-06-26 14:56:53 +02:00
|
|
|
binaries.executable()
|
|
|
|
|
|
2021-12-06 22:15:26 +01:00
|
|
|
runTask {
|
|
|
|
|
outputFileName = "main.bundle.js"
|
2022-01-09 17:39:24 +01:00
|
|
|
sourceMaps = false
|
2021-12-06 22:15:26 +01:00
|
|
|
devServer = KotlinWebpackConfig.DevServer(
|
|
|
|
|
open = false,
|
|
|
|
|
port = 3000,
|
|
|
|
|
proxy = mutableMapOf(
|
2022-07-02 08:45:21 +02:00
|
|
|
"/kafkatorio/data/servers" to mapOf(
|
2022-06-19 10:16:37 +02:00
|
|
|
"target" to "http://localhost:12080",
|
|
|
|
|
"secure" to false,
|
|
|
|
|
"changeOrigin" to true,
|
|
|
|
|
),
|
2022-07-02 08:45:21 +02:00
|
|
|
"/kafkatorio/ws" to mapOf(
|
2022-06-19 10:16:37 +02:00
|
|
|
"target" to "ws://localhost:12080",
|
2022-05-18 19:32:52 +02:00
|
|
|
"ws" to true,
|
2022-06-19 10:16:37 +02:00
|
|
|
),
|
2021-12-06 22:15:26 +01:00
|
|
|
),
|
2022-06-19 10:16:37 +02:00
|
|
|
// static = mutableListOf("$buildDir/processedResources/frontend/main")
|
|
|
|
|
static = mutableListOf("$buildDir/processedResources/js/main")
|
2021-12-06 22:15:26 +01:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
webpackTask {
|
|
|
|
|
outputFileName = "main.bundle.js"
|
|
|
|
|
}
|
|
|
|
|
testTask {
|
|
|
|
|
useKarma {
|
|
|
|
|
useChromeHeadless()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sourceSets {
|
2022-01-04 15:09:50 +01:00
|
|
|
|
2022-09-18 20:49:32 +02:00
|
|
|
configureEach {
|
|
|
|
|
languageSettings {
|
2022-03-09 21:40:40 +01:00
|
|
|
optIn("kotlin.RequiresOptIn")
|
|
|
|
|
optIn("kotlinx.serialization.ExperimentalSerializationApi")
|
|
|
|
|
}
|
2022-01-04 15:09:50 +01:00
|
|
|
}
|
2021-12-06 22:15:26 +01:00
|
|
|
|
2022-07-06 17:16:09 +02:00
|
|
|
|
2022-06-19 10:16:37 +02:00
|
|
|
main {
|
2022-05-14 12:23:58 +02:00
|
|
|
dependencies {
|
2022-07-06 17:16:09 +02:00
|
|
|
implementation(dependencies.platform(projects.modules.versionsPlatform))
|
2022-05-14 12:23:58 +02:00
|
|
|
|
|
|
|
|
implementation(libs.kotlinx.coroutines.core)
|
|
|
|
|
|
2022-07-02 08:45:21 +02:00
|
|
|
implementation(projects.modules.eventsLibrary)
|
2022-05-14 12:23:58 +02:00
|
|
|
|
|
|
|
|
implementation(libs.kotlinx.html)
|
2021-12-06 22:15:26 +01:00
|
|
|
|
2022-02-08 01:35:52 +01:00
|
|
|
implementation(libs.kotlinx.nodejs)
|
|
|
|
|
implementation(libs.kotlinx.html)
|
2021-12-06 22:15:26 +01:00
|
|
|
|
2022-10-04 22:38:00 +02:00
|
|
|
implementation(kvision())
|
|
|
|
|
implementation(kvision("bootstrap"))
|
|
|
|
|
implementation(kvision("bootstrap-css"))
|
|
|
|
|
implementation(kvision("bootstrap-icons"))
|
|
|
|
|
implementation(kvision("fontawesome"))
|
|
|
|
|
implementation(kvision("state"))
|
|
|
|
|
implementation(kvision("chart"))
|
|
|
|
|
implementation(kvision("maps"))
|
|
|
|
|
implementation(kvision("rest"))
|
|
|
|
|
implementation(kvision("redux"))
|
|
|
|
|
implementation(kvision("state-flow"))
|
|
|
|
|
implementation(kvision("routing-navigo-ng"))
|
2021-12-06 22:15:26 +01:00
|
|
|
}
|
|
|
|
|
|
2022-05-14 12:23:58 +02:00
|
|
|
resources.srcDir("src/main/web")
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-19 10:16:37 +02:00
|
|
|
|
|
|
|
|
test {
|
2021-12-06 22:15:26 +01:00
|
|
|
dependencies {
|
2022-07-06 16:18:48 +02:00
|
|
|
implementation(kotlin("test"))
|
2022-01-04 15:09:50 +01:00
|
|
|
|
2022-10-04 22:38:00 +02:00
|
|
|
implementation(kvision("testutils"))
|
2022-06-19 10:16:37 +02:00
|
|
|
// implementation(npm("karma", "^6.3.16"))
|
2021-12-06 22:15:26 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-01-04 15:09:50 +01:00
|
|
|
|
2022-07-06 17:16:09 +02:00
|
|
|
|
2022-10-04 22:38:00 +02:00
|
|
|
@Suppress("UnusedReceiverParameter") // just for scoping - this function doesn't need to be used everywhere
|
2022-01-04 15:09:50 +01:00
|
|
|
fun KotlinDependencyHandler.kvision(
|
2022-10-04 22:38:00 +02:00
|
|
|
module: String? = null,
|
2022-01-04 15:09:50 +01:00
|
|
|
version: Provider<String> = libs.versions.kvision,
|
2022-10-04 22:38:00 +02:00
|
|
|
): String {
|
|
|
|
|
val prefixedModule = if (module == null) "kvision" else "kvision-$module"
|
|
|
|
|
return "io.kvision:$prefixedModule:${version.get()}"
|
2022-10-02 12:11:06 +02:00
|
|
|
}
|
2022-07-06 17:40:21 +02:00
|
|
|
|
2022-09-02 23:22:18 +02:00
|
|
|
|
2022-10-16 12:47:45 +02:00
|
|
|
val installBootstrapThemeCss by tasks.registering(Copy::class) {
|
|
|
|
|
group = KVisionPlugin.KVISION_TASK_GROUP
|
2022-09-18 13:58:19 +02:00
|
|
|
val bootswatchThemeMinCss = resources.text.fromUri(
|
|
|
|
|
libs.versions.npm.bootswatch.map { bootswatch ->
|
|
|
|
|
"https://cdn.jsdelivr.net/npm/bootswatch@$bootswatch/dist/darkly/bootstrap.min.css"
|
|
|
|
|
}
|
|
|
|
|
)
|
2022-09-02 23:22:18 +02:00
|
|
|
from(bootswatchThemeMinCss) {
|
|
|
|
|
rename { "bootstrap.min.css" }
|
|
|
|
|
}
|
|
|
|
|
into(layout.projectDirectory.dir("src/main/resources/css"))
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-18 13:58:19 +02:00
|
|
|
|
2022-10-08 16:04:50 +02:00
|
|
|
tasks.withName("processResources").configureEach {
|
2022-10-16 12:47:45 +02:00
|
|
|
dependsOn(installBootstrapThemeCss)
|
2022-09-02 23:22:18 +02:00
|
|
|
}
|
2022-09-09 17:21:09 +02:00
|
|
|
|
|
|
|
|
|
2022-09-13 17:56:57 +02:00
|
|
|
val runWebMap by tasks.registering {
|
|
|
|
|
group = rootProject.name
|
|
|
|
|
|
2022-10-08 16:04:50 +02:00
|
|
|
dependsOn(tasks.withName("browserDevelopmentRun"))
|
|
|
|
|
|
2022-09-13 17:56:57 +02:00
|
|
|
}
|
2022-10-05 08:52:39 +02:00
|
|
|
|
2022-10-08 16:04:50 +02:00
|
|
|
|
|
|
|
|
tasks.zip {
|
2022-10-22 20:54:40 +02:00
|
|
|
dependsOn(tasks.withName("browserWebpack"))
|
|
|
|
|
from(layout.buildDirectory.dir("distributions"))
|
2022-10-08 16:04:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-10-22 19:55:02 +02:00
|
|
|
tasks.dockerContextPrepareFiles {
|
|
|
|
|
from(zipTree(tasks.zip.flatMap { it.archiveFile }))
|
2022-10-05 08:52:39 +02:00
|
|
|
}
|