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-02 13:57:15 +02:00
|
|
|
import dev.adamko.geedeecee.DockerEnvUpdateTask.Companion.put
|
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-01-04 15:09:50 +01:00
|
|
|
kvision("kvision")
|
|
|
|
|
kvision("kvision-bootstrap")
|
|
|
|
|
kvision("kvision-bootstrap-css")
|
|
|
|
|
kvision("kvision-bootstrap-icons")
|
|
|
|
|
kvision("kvision-fontawesome")
|
|
|
|
|
kvision("kvision-state")
|
|
|
|
|
kvision("kvision-chart")
|
|
|
|
|
kvision("kvision-maps")
|
2022-08-28 19:37:49 +02:00
|
|
|
kvision("kvision-rest")
|
2022-01-04 15:09:50 +01:00
|
|
|
kvision("kvision-redux")
|
|
|
|
|
kvision("kvision-state-flow")
|
2022-08-28 19:37:49 +02:00
|
|
|
kvision("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
|
|
|
|
|
|
|
|
kvision("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-01-04 15:09:50 +01:00
|
|
|
fun KotlinDependencyHandler.kvision(
|
|
|
|
|
module: String,
|
|
|
|
|
version: Provider<String> = libs.versions.kvision,
|
|
|
|
|
configure: ExternalModuleDependency.() -> Unit = {
|
2022-01-09 17:39:24 +01:00
|
|
|
// isChanging = true
|
2022-01-04 15:09:50 +01:00
|
|
|
}
|
|
|
|
|
) {
|
|
|
|
|
implementation("io.kvision:$module:${version.get()}", configure)
|
|
|
|
|
}
|
2022-04-20 16:30:23 +02:00
|
|
|
|
2022-10-02 12:11:06 +02:00
|
|
|
geedeecee {
|
|
|
|
|
srcDir.set(layout.projectDirectory.dir("docker"))
|
|
|
|
|
}
|
2022-07-06 17:40:21 +02:00
|
|
|
|
2022-10-02 12:11:06 +02:00
|
|
|
tasks.dockerComposeEnvUpdate {
|
2022-10-02 13:57:15 +02:00
|
|
|
envProperties {
|
|
|
|
|
put("KAFKATORIO_VERSION" to project.version.toString())
|
|
|
|
|
put("REGISTRY_HOST" to "dcr.adamko.dev:5000")
|
|
|
|
|
}
|
2022-07-06 17:40:21 +02:00
|
|
|
}
|
2022-10-02 12:11:06 +02:00
|
|
|
|
|
|
|
|
tasks.assemble { dependsOn(tasks.dockerComposeEnvUpdate) }
|
2022-09-02 23:22:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
val installThemeCss by tasks.registering(Copy::class) {
|
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
|
|
|
|
|
|
|
|
tasks.matching { it.name == "processResources" }.configureEach {
|
2022-09-02 23:22:18 +02:00
|
|
|
dependsOn(installThemeCss)
|
|
|
|
|
}
|
2022-09-09 17:21:09 +02:00
|
|
|
|
|
|
|
|
|
2022-09-13 17:56:57 +02:00
|
|
|
val runWebMap by tasks.registering {
|
|
|
|
|
group = rootProject.name
|
|
|
|
|
|
|
|
|
|
dependsOn(tasks.matching { it.name == "browserDevelopmentRun" })
|
|
|
|
|
}
|