Skip to content

Commit

Permalink
setup version libs for gradle and dependabot
Browse files Browse the repository at this point in the history
  • Loading branch information
anderssonw committed Jun 4, 2024
1 parent 4eb4499 commit cb96739
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 36 deletions.
52 changes: 22 additions & 30 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

val ktor_version: String by project
val kotlin_version: String by project
val logback_version: String by project
val prometheus_version: String by project
val flyway_version: String by project

plugins {
kotlin("jvm") version "2.0.0"
kotlin("plugin.serialization") version "2.0.0"
id("io.ktor.plugin") version "2.3.11"
kotlin("jvm").version(libs.versions.kotlinVersion)
kotlin("plugin.serialization").version(libs.versions.kotlinVersion)

id("com.github.johnrengelman.shadow") version "8.1.1"
alias(libs.plugins.ktor)
alias(libs.plugins.shadow)
}

group = "no.kartverket.matrikkel.bygning"
Expand All @@ -29,38 +23,36 @@ repositories {
mavenCentral()
}



dependencies {
// Ktor
implementation("io.ktor:ktor-server-core-jvm:$ktor_version")
implementation("io.ktor:ktor-server-netty-jvm:$ktor_version")
implementation("io.ktor:ktor-server-swagger:$ktor_version")
implementation("io.ktor:ktor-server-cors:$ktor_version")
implementation("io.ktor:ktor-server-openapi:$ktor_version")
implementation(libs.ktor.server.core)
implementation(libs.ktor.server.netty)
implementation(libs.ktor.server.swagger)
implementation(libs.ktor.server.cors)
implementation(libs.ktor.server.openapi)

// Monitoring
implementation("io.ktor:ktor-server-call-logging:$ktor_version")
implementation("io.ktor:ktor-server-metrics-micrometer:$ktor_version")
implementation("io.micrometer:micrometer-registry-prometheus:$prometheus_version")
implementation(libs.ktor.server.call.logging)
implementation(libs.ktor.server.metrics.micrometer)
implementation(libs.micrometer.prometheus)

// Logs
implementation("net.logstash.logback:logstash-logback-encoder:7.4")
implementation("ch.qos.logback:logback-classic:$logback_version")
implementation("com.fasterxml.jackson.core:jackson-databind:2.17.1")
implementation(libs.logstash.encoder)
implementation(libs.logback.classic)
implementation(libs.jackson.databind)

// Serialization
implementation("io.ktor:ktor-server-content-negotiation-jvm:$ktor_version")
implementation("io.ktor:ktor-serialization-kotlinx-json-jvm:$ktor_version")
implementation(libs.ktor.server.content.negotiation)
implementation(libs.ktor.serialization.kotlinx)

// Persistence
implementation("org.postgresql:postgresql:42.7.3")
implementation("org.flywaydb:flyway-core:$flyway_version")
implementation("org.flywaydb:flyway-database-postgresql:$flyway_version")
implementation(libs.postgres)
implementation(libs.flyway.core)
implementation(libs.flyway.database.postgresql)

// Tests
testImplementation("io.ktor:ktor-server-tests-jvm:$ktor_version")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version")
testImplementation(libs.ktor.server.tests)
testImplementation(libs.kotlin.test)
}

ktor {
Expand Down
5 changes: 0 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
ktor_version=2.3.11
kotlin_version=2.0.0
logback_version=1.4.14
prometheus_version=1.10.3
flyway_version=10.13.0
kotlin.code.style=official
40 changes: 40 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[versions]
ktorVersion = "2.3.11"
kotlinVersion = "2.0.0"
logbackVersion = "1.4.14"
logstashVersion = "7.4"
prometheusVersion = "1.10.3"
flywayVersion = "10.13.0"
jacksonVersion = "2.17.1"
postgresVersion = "42.7.3"
shadowVersion = "8.1.1"

[libraries]
ktor-server-core = { group = "io.ktor", name = "ktor-server-core-jvm", version.ref = "ktorVersion" }
ktor-server-netty = { group = "io.ktor", name = "ktor-server-netty-jvm", version.ref = "ktorVersion" }
ktor-server-swagger = { group = "io.ktor", name = "ktor-server-swagger", version.ref = "ktorVersion" }
ktor-server-cors = { group = "io.ktor", name = "ktor-server-cors", version.ref = "ktorVersion" }
ktor-server-openapi = { group = "io.ktor", name = "ktor-server-openapi", version.ref = "ktorVersion" }
ktor-server-tests = { group = "io.ktor", name = "ktor-server-tests-jvm", version.ref = "ktorVersion" }
ktor-server-call-logging = { group = "io.ktor", name = "ktor-server-call-logging", version.ref = "ktorVersion" }
ktor-server-metrics-micrometer = { group = "io.ktor", name = "ktor-server-metrics-micrometer", version.ref = "ktorVersion" }
ktor-server-content-negotiation = { group = "io.ktor", name = "ktor-server-content-negotiation-jvm", version.ref = "ktorVersion" }
ktor-serialization-kotlinx = { group = "io.ktor", name = "ktor-serialization-kotlinx-json-jvm", version.ref = "ktorVersion" }

flyway-core = { group = "org.flywaydb", name = "flyway-core", version.ref = "flywayVersion" }
flyway-database-postgresql = { group = "org.flywaydb", name = "flyway-database-postgresql", version.ref = "flywayVersion" }

micrometer-prometheus = { group = "io.micrometer", name = "micrometer-registry-prometheus", version.ref = "prometheusVersion" }
logstash-encoder = { group = "net.logstash.logback", name = "logstash-logback-encoder", version.ref = "logstashVersion" }
logback-classic = { group = "ch.qos.logback", name = "logback-classic", version.ref = "logbackVersion" }
jackson-databind = { group = "com.fasterxml.jackson.core", name = "jackson-databind", version.ref = "jacksonVersion" }
postgres = { group = "org.postgresql", name = "postgresql", version.ref = "postgresVersion" }
kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version.ref = "kotlinVersion" }


[plugins]
kotlin-jvm = { id = "jvm", version.ref = "kotlinVersion" }
kotlin-serialization = {id = "plugin.serialization", version.ref="kotlinVersion"}

ktor = {id = "io.ktor.plugin", version.ref="ktorVersion" }
shadow = {id = "com.github.johnrengelman.shadow", version.ref="shadowVersion"}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ fun Application.module() {
install(ContentNegotiation) {
json()
removeIgnoredType<String>()
removeIgnoredType<HttpStatusCode>()
}

install(CORS) {
Expand Down

0 comments on commit cb96739

Please sign in to comment.