Skip to content

Commit

Permalink
upgrade to java 21, use gradle version catalogue
Browse files Browse the repository at this point in the history
  • Loading branch information
sschaeffner committed Oct 15, 2024
1 parent 1941b6c commit 2ed2633
Show file tree
Hide file tree
Showing 9 changed files with 178 additions and 93 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1

FROM gcr.io/distroless/java17-debian11
FROM gcr.io/distroless/java21-debian12
WORKDIR /app
COPY app/build/libs/app-*-all.jar ./app.jar
CMD ["app.jar"]
28 changes: 15 additions & 13 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
kotlin("jvm")
alias(libs.plugins.kotlin.jvm)
application
id("com.github.johnrengelman.shadow") version "8.1.1"
alias(libs.plugins.shadow)
}

application {
Expand All @@ -22,17 +22,19 @@ dependencies {
implementation(project(":domain"))
implementation(project(":persistence"))
implementation(project(":logging"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.1")
implementation(rootProject.libs.kotlinx.coroutines.core)
implementation(rootProject.libs.kotlinx.datetime)

testImplementation(testFixtures(project(":domain")))
testImplementation("io.ktor:ktor-serialization:2.3.12")
testImplementation("io.ktor:ktor-server-test-host:2.3.12")
testImplementation("io.ktor:ktor-client-content-negotiation:2.3.12")
testImplementation("io.ktor:ktor-serialization-kotlinx-json:2.3.12")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0")
testImplementation("org.testcontainers:testcontainers:1.20.2")
testImplementation("org.testcontainers:postgresql:1.20.2")
testImplementation("org.jetbrains.exposed:exposed-core:0.55.0")
testImplementation("com.zaxxer:HikariCP:6.0.0")
// TODO REMOVE
// testImplementation(rootProject.libs.ktor.serialization)
testImplementation(rootProject.libs.ktor.server.test.host)
testImplementation(rootProject.libs.ktor.client.content.negotiation)
testImplementation(rootProject.libs.ktor.serialization.kotlinx.json)
testImplementation(rootProject.libs.wiremock)
testImplementation(rootProject.libs.kotlinx.coroutines.test)
testImplementation(rootProject.libs.testcontainers)
testImplementation(rootProject.libs.testcontainers.postgres)
testImplementation(rootProject.libs.exposed.core)
testImplementation(rootProject.libs.hikaricp)
}
39 changes: 17 additions & 22 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent

plugins {
base
kotlin("jvm") version "2.0.20"
alias(libs.plugins.kotlin.jvm)
jacoco
id("com.github.ben-manes.versions") version "0.51.0"
alias(libs.plugins.versions)
}

tasks.register<GradleBuild>("stage") {
Expand All @@ -21,15 +21,11 @@ allprojects {
repositories {
mavenCentral()
maven("https://oss.sonatype.org/content/repositories/snapshots/")
maven {
url = uri("https://maven.pkg.jetbrains.space/public/p/ktor/eap")
}
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

Expand All @@ -52,19 +48,18 @@ allprojects {
}

dependencies {
implementation(enforcedPlatform("org.jetbrains.kotlin:kotlin-bom:2.0.20"))
implementation("org.jetbrains.kotlin:kotlin-stdlib")
implementation("io.arrow-kt:arrow-core:1.2.4")
implementation("org.kodein.di:kodein-di:7.22.0")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.1")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")
implementation(rootProject.libs.kotlin.stdlib)
implementation(rootProject.libs.arrow.core)
implementation(rootProject.libs.kodein)
implementation(rootProject.libs.kotlinx.datetime)
implementation(rootProject.libs.kotlinx.serialization.json)

testImplementation("org.jetbrains.kotlin:kotlin-test")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.11.1")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.11.1")
testImplementation("com.willowtreeapps.assertk:assertk-jvm:0.28.1")
testImplementation("org.mockito.kotlin:mockito-kotlin:5.4.0")
testImplementation("org.mockito:mockito-junit-jupiter:5.14.1")
testImplementation(rootProject.libs.kotlin.test)
testImplementation(rootProject.libs.kotlin.test.junit5)
testImplementation(rootProject.libs.junit.engine)
testImplementation(rootProject.libs.junit.params)
testImplementation(rootProject.libs.assertk.jvm)
testImplementation(rootProject.libs.mockito.kotlin)
testImplementation(rootProject.libs.mockito.junit5)
}
}
25 changes: 13 additions & 12 deletions domain/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
plugins {
kotlin("jvm")
alias(libs.plugins.kotlin.jvm)
`java-test-fixtures`
kotlin("plugin.serialization") version "2.0.20"
alias(libs.plugins.kotlinx.serialization)
}

dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
implementation("com.webauthn4j:webauthn4j-core:0.26.0.RELEASE")
implementation("com.sksamuel.scrimage:scrimage-core:4.2.0")
implementation(rootProject.libs.kotlinx.coroutines.core)
implementation(rootProject.libs.webauthn4j.core)
implementation(rootProject.libs.scrimage.core)

testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0")
testFixturesImplementation("com.webauthn4j:webauthn4j-core:0.26.0.RELEASE")
testFixturesImplementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.1")
testFixturesImplementation("io.arrow-kt:arrow-core:1.2.4")
testFixturesImplementation("com.willowtreeapps.assertk:assertk-jvm:0.28.1")
testFixturesImplementation("org.mockito.kotlin:mockito-kotlin:5.4.0")
testFixturesImplementation("org.mockito:mockito-junit-jupiter:5.14.1")
testImplementation(rootProject.libs.kotlinx.coroutines.test)

testFixturesImplementation(rootProject.libs.webauthn4j.core)
testFixturesImplementation(rootProject.libs.kotlinx.datetime)
testFixturesImplementation(rootProject.libs.arrow.core)
testFixturesImplementation(rootProject.libs.assertk.jvm)
testFixturesImplementation(rootProject.libs.mockito.kotlin)
testFixturesImplementation(rootProject.libs.mockito.junit5)
}

kotlin.target.compilations.getByName("testFixtures") {
Expand Down
3 changes: 2 additions & 1 deletion frontend/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
java
id("com.github.node-gradle.node") version "7.1.0"
alias(libs.plugins.node)
alias(libs.plugins.kotlinx.serialization)
}

node {
Expand Down
83 changes: 83 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
[versions]
kotlin = "2.0.20"
arrow = "1.2.4"
kodein = "7.22.0"
ktor = "2.3.12"
micrometer = "1.13.4"
kotlinx-coroutines = "1.9.0"
kotlinx-datetime = "0.6.1"
kotlinx-serialization-json = "1.7.3"
exposed = "0.55.0"
hikari = "6.0.0"
postgresql = "42.7.4"
liquibase = "4.29.2"
liquibase-slf4j = "5.0.0"
webauthn4j = "0.26.0.RELEASE"
scrimage = "4.2.0"
logback = "1.5.8"
slf4j = "2.0.16"

junit = "5.11.1"
assertk = "0.28.1"
mockito-kotlin = "5.4.0"
mockito-junit5 = "5.14.0"
kotlin-wiremock = "2.1.1"
testcontainers = "1.20.2"

[libraries]
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
arrow-core = { module = "io.arrow-kt:arrow-core", version.ref = "arrow" }
kodein = { module = "org.kodein.di:kodein-di", version.ref = "kodein" }
ktor-server-core = { module = "io.ktor:ktor-server-core", version.ref = "ktor" }
ktor-server-core-jvm = { module = "io.ktor:ktor-server-core-jvm", version.ref = "ktor" }
ktor-server-netty = { module = "io.ktor:ktor-server-netty", version.ref = "ktor" }
ktor-server-auth = { module = "io.ktor:ktor-server-auth", version.ref = "ktor" }
ktor-server-auth-jwt = { module = "io.ktor:ktor-server-auth-jwt", version.ref = "ktor" }
ktor-server-forwarded-header = { module = "io.ktor:ktor-server-forwarded-header", version.ref = "ktor" }
ktor-server-content-negotiation = { module = "io.ktor:ktor-server-content-negotiation", version.ref = "ktor" }
ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
ktor-server-cors = { module = "io.ktor:ktor-server-cors", version.ref = "ktor" }
ktor-server-call-logging = { module = "io.ktor:ktor-server-call-logging", version.ref = "ktor" }
ktor-server-http-redirect = { module = "io.ktor:ktor-server-http-redirect", version.ref = "ktor" }
ktor-server-status-pages = { module = "io.ktor:ktor-server-status-pages", version.ref = "ktor" }
ktor-server-websockets = { module = "io.ktor:ktor-server-websockets", version.ref = "ktor" }
ktor-server-metrics-micrometer = { module = "io.ktor:ktor-server-metrics-micrometer", version.ref = "ktor" }
ktor-server-metrics-micrometer-jvm = { module = "io.ktor:ktor-server-metrics-micrometer-jvm", version.ref = "ktor" }
micrometer-registry-prometheus = { module = "io.micrometer:micrometer-registry-prometheus", version.ref = "micrometer" }

kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization-json" }
exposed-core = { module = "org.jetbrains.exposed:exposed-core", version.ref = "exposed" }
exposed-json = { module = "org.jetbrains.exposed:exposed-json", version.ref = "exposed" }
exposed-jdbc = { module = "org.jetbrains.exposed:exposed-jdbc", version.ref = "exposed" }
exposed-java-time = { module = "org.jetbrains.exposed:exposed-java-time", version.ref = "exposed" }
hikaricp = { module = "com.zaxxer:HikariCP", version.ref = "hikari" }
postgresql = { module = "org.postgresql:postgresql", version.ref = "postgresql" }
liquibase = { module = "org.liquibase:liquibase-core", version.ref = "liquibase" }
liquibase-slf4j = { module = "com.mattbertolini:liquibase-slf4j", version.ref = "liquibase-slf4j" }
webauthn4j-core = { module = "com.webauthn4j:webauthn4j-core", version.ref = "webauthn4j" }
scrimage-core = { module = "com.sksamuel.scrimage:scrimage-core", version.ref = "scrimage" }
logback = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }

kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
kotlin-test-junit5 = { module = "org.jetbrains.kotlin:kotlin-test-junit5", version.ref = "kotlin" }
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" }
junit-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit" }
junit-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit" }
assertk-jvm = { module = "com.willowtreeapps.assertk:assertk-jvm", version.ref = "assertk" }
mockito-kotlin = { module = "org.mockito.kotlin:mockito-kotlin", version.ref = "mockito-kotlin" }
mockito-junit5 = { module = "org.mockito:mockito-junit-jupiter", version.ref = "mockito-junit5" }
ktor-server-test-host = { module = "io.ktor:ktor-server-test-host", version.ref = "ktor" }
ktor-client-content-negotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktor" }
wiremock = { module = "com.marcinziolo:kotlin-wiremock", version.ref="kotlin-wiremock" }
testcontainers = { module = "org.testcontainers:testcontainers", version.ref = "testcontainers" }
testcontainers-postgres = { module = "org.testcontainers:postgresql", version.ref = "testcontainers" }

[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
shadow = { id = "com.github.johnrengelman.shadow", version = "8.1.1" }
versions = { id = "com.github.ben-manes.versions", version = "0.51.0" }
node = { id = "com.github.node-gradle.node", version = "7.1.0" }
4 changes: 2 additions & 2 deletions logging/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
plugins {
kotlin("jvm")
alias(libs.plugins.kotlin.jvm)
}

dependencies {
implementation(project(":domain"))

implementation("ch.qos.logback:logback-classic:1.5.8")
implementation(rootProject.libs.logback)
}
32 changes: 17 additions & 15 deletions persistence/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
plugins {
kotlin("jvm")
kotlin("plugin.serialization") version "2.0.20"
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlinx.serialization)
}

dependencies {
implementation(project(":domain"))
implementation(project(":logging"))

implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
implementation("org.jetbrains.exposed:exposed-core:0.55.0")
implementation("org.jetbrains.exposed:exposed-json:0.55.0")
implementation("org.jetbrains.exposed:exposed-jdbc:0.55.0")
implementation("org.jetbrains.exposed:exposed-java-time:0.55.0")
implementation("com.zaxxer:HikariCP:6.0.0")
implementation("org.postgresql:postgresql:42.7.4")
implementation("org.liquibase:liquibase-core:4.29.2")
implementation("com.mattbertolini:liquibase-slf4j:5.0.0")
implementation(rootProject.libs.kotlinx.coroutines.core)
implementation(rootProject.libs.exposed.core)
implementation(rootProject.libs.exposed.json)
implementation(rootProject.libs.exposed.jdbc)
implementation(rootProject.libs.exposed.java.time)
implementation(rootProject.libs.hikaricp)
implementation(rootProject.libs.postgresql)
implementation(rootProject.libs.liquibase)
implementation(rootProject.libs.liquibase.slf4j)
implementation(rootProject.libs.kotlinx.coroutines.test)

testImplementation(testFixtures(project(":domain")))
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0")
testImplementation("org.testcontainers:testcontainers:1.20.2")
testImplementation("org.testcontainers:postgresql:1.20.2")
}
testImplementation(rootProject.libs.kotlinx.coroutines.test)
testImplementation(rootProject.libs.testcontainers)
testImplementation(rootProject.libs.testcontainers.postgres)
}
55 changes: 28 additions & 27 deletions web/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
plugins {
kotlin("jvm")
kotlin("plugin.serialization") version "2.0.20"
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlinx.serialization)
}

dependencies {
implementation(project(":domain"))
implementation(project(":logging"))

implementation("io.ktor:ktor-server-core:2.3.12")
implementation("io.ktor:ktor-server-core-jvm:2.3.12")
implementation("io.ktor:ktor-server-netty:2.3.12")
implementation("io.ktor:ktor-server-auth:2.3.12")
implementation("io.ktor:ktor-server-auth-jwt:2.3.12")
implementation("io.ktor:ktor-server-http-redirect:2.3.12")
implementation("io.ktor:ktor-server-forwarded-header:2.3.12")
implementation("io.ktor:ktor-server-content-negotiation:2.3.12")
implementation("io.ktor:ktor-serialization-kotlinx-json:2.3.12")
implementation("io.ktor:ktor-server-cors:2.3.12")
implementation("io.ktor:ktor-server-status-pages:2.3.12")
implementation("io.ktor:ktor-server-websockets:2.3.12")
implementation("io.ktor:ktor-server-call-logging:2.3.12")
implementation("io.ktor:ktor-server-metrics-micrometer:2.3.12")
implementation("io.ktor:ktor-server-metrics-micrometer-jvm:2.3.12")
implementation("io.micrometer:micrometer-registry-prometheus:1.13.4")
implementation("org.slf4j:slf4j-api:2.0.16")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
implementation("ch.qos.logback:logback-classic:1.5.8")
implementation("com.webauthn4j:webauthn4j-core:0.26.0.RELEASE")
implementation(rootProject.libs.ktor.server.core)
implementation(rootProject.libs.ktor.server.core.jvm)
implementation(rootProject.libs.ktor.server.netty)
implementation(rootProject.libs.ktor.server.auth)
implementation(rootProject.libs.ktor.server.auth.jwt)
implementation(rootProject.libs.ktor.server.http.redirect)
implementation(rootProject.libs.ktor.server.forwarded.header)
implementation(rootProject.libs.ktor.server.content.negotiation)
implementation(rootProject.libs.ktor.serialization.kotlinx.json)
implementation(rootProject.libs.ktor.server.cors)
implementation(rootProject.libs.ktor.server.call.logging)
implementation(rootProject.libs.ktor.server.http.redirect)
implementation(rootProject.libs.ktor.server.status.pages)
implementation(rootProject.libs.ktor.server.websockets)
implementation(rootProject.libs.ktor.server.metrics.micrometer)
implementation(rootProject.libs.ktor.server.metrics.micrometer.jvm)
implementation(rootProject.libs.micrometer.registry.prometheus)
implementation(rootProject.libs.kotlinx.coroutines.core)
implementation(rootProject.libs.logback)
implementation(rootProject.libs.webauthn4j.core)
implementation(rootProject.libs.slf4j.api)

testImplementation(testFixtures(project(":domain")))
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0")
testImplementation("io.ktor:ktor-server-test-host:2.3.12")
testImplementation("io.ktor:ktor-client-content-negotiation:2.3.12")
testImplementation("io.ktor:ktor-serialization-kotlinx-json:2.3.12")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0")
testImplementation(rootProject.libs.kotlinx.coroutines.test)
testImplementation(rootProject.libs.ktor.server.test.host)
testImplementation(rootProject.libs.ktor.client.content.negotiation)
testImplementation(rootProject.libs.ktor.serialization.kotlinx.json)
testImplementation(rootProject.libs.ktor.serialization.kotlinx.json)
}

0 comments on commit 2ed2633

Please sign in to comment.