2024-03-19 05:54:50 +00:00
|
|
|
val ktor_version: String by project
|
|
|
|
val kotlin_version: String by project
|
|
|
|
val logback_version: String by project
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
kotlin("jvm") version "1.9.23"
|
|
|
|
id("io.ktor.plugin") version "2.3.9"
|
|
|
|
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.23"
|
|
|
|
id("com.google.protobuf") version "0.9.4"
|
|
|
|
}
|
|
|
|
|
|
|
|
group = "dev.usbharu"
|
|
|
|
version = "0.0.1"
|
|
|
|
|
|
|
|
application {
|
|
|
|
mainClass.set("io.ktor.server.netty.EngineMain")
|
|
|
|
|
|
|
|
val isDevelopment: Boolean = project.ext.has("development")
|
|
|
|
applicationDefaultJvmArgs = listOf("-Dio.ktor.development=$isDevelopment")
|
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
implementation("io.ktor:ktor-server-core-jvm")
|
|
|
|
implementation("io.ktor:ktor-server-host-common-jvm")
|
|
|
|
implementation("io.ktor:ktor-server-status-pages-jvm")
|
|
|
|
implementation("io.ktor:ktor-server-cors-jvm")
|
|
|
|
implementation("io.ktor:ktor-server-call-logging-jvm")
|
|
|
|
implementation("io.ktor:ktor-server-content-negotiation-jvm")
|
|
|
|
implementation("io.ktor:ktor-serialization-kotlinx-json-jvm")
|
|
|
|
implementation("io.ktor:ktor-server-netty-jvm")
|
|
|
|
implementation("ch.qos.logback:logback-classic:$logback_version")
|
|
|
|
testImplementation("io.ktor:ktor-server-tests-jvm")
|
|
|
|
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version")
|
|
|
|
implementation("io.grpc:grpc-kotlin-stub:1.4.1")
|
|
|
|
implementation("io.grpc:grpc-protobuf:1.61.1")
|
|
|
|
implementation("com.google.protobuf:protobuf-kotlin:3.25.3")
|
|
|
|
implementation("io.grpc:grpc-netty:1.61.1")
|
|
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0")
|
|
|
|
protobuf(files("../unos-proto/src/main/proto/watchdog"))
|
|
|
|
implementation("io.ktor:ktor-client-core:2.3.9")
|
|
|
|
implementation("io.ktor:ktor-client-cio:2.3.9")
|
|
|
|
implementation("dev.usbharu.unos:utils")
|
|
|
|
}
|
|
|
|
|
2024-03-19 06:07:11 +00:00
|
|
|
tasks.test {
|
|
|
|
useJUnitPlatform()
|
|
|
|
}
|
|
|
|
kotlin {
|
|
|
|
jvmToolchain(17)
|
|
|
|
}
|
|
|
|
|
2024-03-19 05:54:50 +00:00
|
|
|
protobuf {
|
|
|
|
protoc {
|
|
|
|
artifact = "com.google.protobuf:protoc:3.25.3"
|
|
|
|
}
|
|
|
|
plugins {
|
|
|
|
create("grpc") {
|
|
|
|
artifact = "io.grpc:protoc-gen-grpc-java:1.61.1"
|
|
|
|
}
|
|
|
|
create("grpckt") {
|
|
|
|
artifact = "io.grpc:protoc-gen-grpc-kotlin:1.4.1:jdk8@jar"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
generateProtoTasks {
|
|
|
|
all().forEach {
|
|
|
|
it.plugins {
|
|
|
|
create("grpc")
|
|
|
|
create("grpckt")
|
|
|
|
}
|
|
|
|
it.builtins {
|
|
|
|
create("kotlin")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
jib {
|
|
|
|
if (System.getProperty("os.name").toLowerCase().contains("windows")) {
|
|
|
|
dockerClient.environment = mapOf(
|
|
|
|
"DOCKER_HOST" to "localhost:2375"
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ktor {
|
|
|
|
docker {
|
|
|
|
localImageName.set("watchdog-bell")
|
|
|
|
this.imageTag = version.toString()
|
|
|
|
}
|
|
|
|
}
|