val ktor_version: String by project val kotlin_version: String by project val logback_version: String by project val exposed_version: String by project val postgresql_version: String by project val hikari_version: String by project val flyway_version: String by project val bouncycastle_version: String by project plugins { kotlin("jvm") version "2.2.21" kotlin("plugin.serialization") version "2.2.21" id("io.ktor.plugin") version "3.3.3" id("com.gradleup.shadow") version "9.3.0" id("org.flywaydb.flyway") version "11.19.0" application } group = "org.ccoin" version = "1.0.0" application { mainClass.set("org.ccoin.ServerKt") val isDevelopment: Boolean = project.ext.has("development") applicationDefaultJvmArgs = listOf("-Dio.ktor.development=$isDevelopment") } repositories { mavenCentral() } dependencies { // Ktor server implementation("io.ktor:ktor-server-core-jvm:$ktor_version") implementation("io.ktor:ktor-server-netty-jvm:$ktor_version") implementation("io.ktor:ktor-server-content-negotiation-jvm:$ktor_version") implementation("io.ktor:ktor-serialization-kotlinx-json-jvm:$ktor_version") implementation("io.ktor:ktor-server-cors-jvm:$ktor_version") implementation("io.ktor:ktor-server-call-logging-jvm:$ktor_version") implementation("io.ktor:ktor-server-status-pages-jvm:$ktor_version") implementation("io.ktor:ktor-server-compression-jvm:$ktor_version") implementation("io.ktor:ktor-server-default-headers-jvm:$ktor_version") implementation("io.ktor:ktor-server-host-common-jvm:$ktor_version") implementation("io.ktor:ktor-server-config-yaml:$ktor_version") // Database implementation("org.jetbrains.exposed:exposed-core:$exposed_version") implementation("org.jetbrains.exposed:exposed-dao:$exposed_version") implementation("org.jetbrains.exposed:exposed-jdbc:$exposed_version") implementation("org.jetbrains.exposed:exposed-java-time:$exposed_version") implementation("org.postgresql:postgresql:$postgresql_version") implementation("com.zaxxer:HikariCP:$hikari_version") implementation("org.flywaydb:flyway-core:$flyway_version") implementation("org.flywaydb:flyway-database-postgresql:$flyway_version") // Logging implementation("ch.qos.logback:logback-classic:$logback_version") implementation("io.github.oshai:kotlin-logging-jvm:7.0.0") // Crypto utilities implementation("org.bouncycastle:bcprov-jdk18on:$bouncycastle_version") implementation("org.bouncycastle:bcpkix-jdk18on:$bouncycastle_version") // JSON implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3") implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.1") // Coroutines implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0") // Testing testImplementation("io.ktor:ktor-server-test-host-jvm:$ktor_version") testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version") testImplementation("io.mockk:mockk:1.13.13") testImplementation("org.junit.jupiter:junit-jupiter:5.11.3") testImplementation("org.testcontainers:testcontainers:1.20.3") testImplementation("org.testcontainers:postgresql:1.20.3") testImplementation("org.testcontainers:junit-jupiter:1.20.3") } tasks.withType { useJUnitPlatform() } // Fat JAR configuration for Docker tasks.jar { enabled = false } tasks.shadowJar { archiveClassifier.set("") manifest { attributes["Main-Class"] = "org.ccoin.ServerKt" } mergeServiceFiles() } // Flyway configuration flyway { url = "jdbc:postgresql://localhost:5432/ccoin" user = "ccoin" password = "ccoin" locations = arrayOf("classpath:db/migration") baselineOnMigrate = true validateOnMigrate = true } // Docker build task tasks.register("buildDocker") { dependsOn("shadowJar") commandLine("docker", "build", "-t", "ccoin-server:latest", ".") } // Development task tasks.register("dev") { dependsOn("run") doFirst { project.ext.set("development", true) } }