2022-07-06 17:40:21 +02:00
|
|
|
import dev.adamko.kafkatorio.task.DockerEnvUpdateTask
|
2022-02-27 01:01:24 +01:00
|
|
|
import dev.adamko.kafkatorio.task.KafkaConsumerGroupsTask
|
2021-12-28 16:26:23 +01:00
|
|
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
|
|
|
|
2022-06-26 14:56:53 +02:00
|
|
|
|
2021-10-22 18:19:53 +02:00
|
|
|
plugins {
|
2022-01-16 23:16:09 +01:00
|
|
|
dev.adamko.kafkatorio.lang.`kotlin-jvm`
|
2021-10-25 23:35:47 +02:00
|
|
|
kotlin("plugin.serialization")
|
2021-10-24 14:55:04 +02:00
|
|
|
application
|
2021-10-22 18:19:53 +02:00
|
|
|
}
|
|
|
|
|
|
2022-06-26 14:56:53 +02:00
|
|
|
|
2022-07-01 13:14:32 +02:00
|
|
|
description = "serves Kafkatorio content over the web"
|
2021-10-22 18:19:53 +02:00
|
|
|
|
|
|
|
|
val projectId: String by project.extra
|
|
|
|
|
|
2022-05-18 19:32:52 +02:00
|
|
|
val kafkaStateDir: Directory = layout.projectDirectory.dir("kafka-state")
|
2022-02-09 13:16:57 +01:00
|
|
|
|
2022-06-26 14:56:53 +02:00
|
|
|
|
2021-10-24 14:55:04 +02:00
|
|
|
dependencies {
|
2022-05-01 09:41:49 +02:00
|
|
|
implementation(platform(projects.modules.versionsPlatform))
|
2021-10-24 14:55:04 +02:00
|
|
|
|
2022-02-09 11:53:58 +01:00
|
|
|
implementation(libs.kafka.streams)
|
2022-03-12 16:42:24 +01:00
|
|
|
testImplementation(libs.kafka.streamsTestUtils)
|
2021-10-24 14:55:04 +02:00
|
|
|
|
2022-07-02 08:45:21 +02:00
|
|
|
implementation(projects.modules.eventsLibrary)
|
2021-12-01 13:35:32 +01:00
|
|
|
|
|
|
|
|
implementation(libs.kotlinx.serialization.core)
|
|
|
|
|
implementation(libs.kotlinx.serialization.json)
|
2021-10-25 23:35:47 +02:00
|
|
|
|
2022-05-01 09:41:49 +02:00
|
|
|
implementation(libs.kotlinx.coroutines.core)
|
2021-12-27 12:44:37 +01:00
|
|
|
|
2021-10-24 14:55:04 +02:00
|
|
|
implementation(libs.bundles.logging)
|
2022-01-13 00:00:59 +01:00
|
|
|
|
2022-03-12 22:00:58 +01:00
|
|
|
implementation(libs.scrimage.core)
|
2022-01-16 23:16:09 +01:00
|
|
|
|
2022-04-19 23:25:10 +02:00
|
|
|
implementation(libs.okio.core)
|
|
|
|
|
|
2022-07-01 13:14:32 +02:00
|
|
|
//<editor-fold desc="Ktor">
|
|
|
|
|
implementation(libs.ktorSerialization.kotlinxJson)
|
|
|
|
|
|
|
|
|
|
with(libs.ktorServer) {
|
|
|
|
|
implementation(core)
|
|
|
|
|
implementation(callId)
|
|
|
|
|
implementation(callLogging)
|
|
|
|
|
implementation(contentNegotiaion)
|
|
|
|
|
implementation(cio)
|
|
|
|
|
implementation(autoHeadResponse)
|
|
|
|
|
implementation(partialContent)
|
|
|
|
|
implementation(resources)
|
|
|
|
|
implementation(statusPages)
|
|
|
|
|
implementation(websockets)
|
|
|
|
|
implementation(compression)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
with(libs.ktorNetwork) {
|
|
|
|
|
implementation(core)
|
|
|
|
|
implementation(tls)
|
|
|
|
|
}
|
|
|
|
|
//</editor-fold>
|
|
|
|
|
|
2022-06-27 22:07:42 +02:00
|
|
|
|
|
|
|
|
implementation(libs.simpleSyslogParser)
|
|
|
|
|
|
2022-03-12 22:00:58 +01:00
|
|
|
implementation(libs.kafka.kotkaStreams) {
|
2022-07-01 13:14:32 +02:00
|
|
|
isChanging = false
|
2022-01-16 23:16:09 +01:00
|
|
|
}
|
|
|
|
|
|
2022-06-19 10:20:48 +02:00
|
|
|
implementation(libs.bundles.hoplite)
|
2021-10-24 14:55:04 +02:00
|
|
|
}
|
|
|
|
|
|
2022-02-05 12:20:25 +01:00
|
|
|
|
2021-10-24 14:55:04 +02:00
|
|
|
application {
|
2022-07-02 08:45:21 +02:00
|
|
|
mainClass.set("dev.adamko.kafkatorio.server.EventsServerKt")
|
2021-10-24 14:55:04 +02:00
|
|
|
}
|
2021-12-28 16:26:23 +01:00
|
|
|
|
2022-07-02 09:50:11 +02:00
|
|
|
|
2022-05-18 19:32:52 +02:00
|
|
|
tasks.withType<KotlinCompile>().configureEach {
|
2021-12-28 16:26:23 +01:00
|
|
|
kotlinOptions.freeCompilerArgs += listOf(
|
|
|
|
|
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
2022-02-05 12:20:25 +01:00
|
|
|
"-opt-in=kotlinx.coroutines.FlowPreview",
|
2022-02-26 17:34:31 +01:00
|
|
|
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
|
2021-12-28 16:26:23 +01:00
|
|
|
)
|
|
|
|
|
}
|
2022-02-08 11:51:16 +01:00
|
|
|
|
|
|
|
|
|
2022-02-27 01:01:24 +01:00
|
|
|
val kafkaStateDirDelete by tasks.registering(Delete::class) {
|
|
|
|
|
group = project.name
|
|
|
|
|
mustRunAfter(kafkaConsumersDelete)
|
2022-03-12 01:37:35 +01:00
|
|
|
delete(kafkaStateDir)
|
2022-02-27 01:01:24 +01:00
|
|
|
}
|
|
|
|
|
|
2022-07-02 09:50:11 +02:00
|
|
|
|
2022-02-27 01:01:24 +01:00
|
|
|
val kafkaConsumersDelete by tasks.registering(KafkaConsumerGroupsTask.DeleteAll::class) {
|
2022-02-26 17:34:31 +01:00
|
|
|
group = project.name
|
2022-02-08 11:51:16 +01:00
|
|
|
}
|
|
|
|
|
|
2022-03-12 01:37:35 +01:00
|
|
|
|
|
|
|
|
idea {
|
|
|
|
|
module {
|
2022-07-02 09:50:11 +02:00
|
|
|
excludeDirs = excludeDirs + listOf(
|
|
|
|
|
kafkaStateDir.asFile,
|
|
|
|
|
file("server-data"),
|
|
|
|
|
)
|
2022-03-12 01:37:35 +01:00
|
|
|
}
|
|
|
|
|
}
|
2022-07-06 17:40:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
val dockerEnvUpdate by tasks.registering(DockerEnvUpdateTask::class) {
|
|
|
|
|
dotEnvFile.set(layout.projectDirectory.file("docker/.env"))
|
|
|
|
|
|
|
|
|
|
properties(
|
|
|
|
|
"COMPOSE_PROJECT_NAME" to rootProject.name,
|
|
|
|
|
"KAFKATORIO_VERSION" to project.version,
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
tasks.assemble { dependsOn(dockerEnvUpdate) }
|