From 4ee375f682c65cb03d296204baeb560775d2f236 Mon Sep 17 00:00:00 2001 From: Jonathan Cornaz Date: Tue, 19 Nov 2024 10:27:25 +0100 Subject: [PATCH] fix(deps): remove dependency on hikariCP (#85) --- build.gradle.kts | 3 +-- gradle/libs.versions.toml | 2 -- .../kotlin/com/optravis/jooq/gradle/Generator.kt | 16 +++++++++------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index c3eec5e..a4fb539 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,11 +19,10 @@ dependencies { implementation(libs.jooq.codegen) implementation(libs.flyway.core) implementation(libs.testcontainers.core) - implementation(libs.hikari) + implementation(libs.postgresql) runtimeOnly(libs.jooq.meta.kotlin) runtimeOnly(libs.flyway.postgres) - runtimeOnly(libs.postgresql) testImplementation(rootProject.libs.kotest.runner) testImplementation(rootProject.libs.kotest.assertions) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 344a1b8..376d0af 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,6 @@ flyway = "10.21.0" jooq = "3.19.15" testcontainers = "1.20.3" postgres = "42.7.4" -hikari = "6.2.0" gradle-plugin-publish = "1.3.0" [plugins] @@ -34,7 +33,6 @@ testcontainers-postgresql = { module = "org.testcontainers:postgresql", version. # DB access postgresql = { module = "org.postgresql:postgresql", version.ref = "postgres" } -hikari = { module = "com.zaxxer:HikariCP", version.ref = "hikari" } # Test kotest-assertions = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest" } diff --git a/src/main/kotlin/com/optravis/jooq/gradle/Generator.kt b/src/main/kotlin/com/optravis/jooq/gradle/Generator.kt index 72e0bac..ccd1fc8 100644 --- a/src/main/kotlin/com/optravis/jooq/gradle/Generator.kt +++ b/src/main/kotlin/com/optravis/jooq/gradle/Generator.kt @@ -2,8 +2,6 @@ package com.optravis.jooq.gradle -import com.zaxxer.hikari.HikariConfig -import com.zaxxer.hikari.HikariDataSource import org.flywaydb.core.Flyway import org.jooq.codegen.GenerationTool import org.jooq.meta.jaxb.Configuration @@ -12,6 +10,7 @@ import org.jooq.meta.jaxb.Generate import org.jooq.meta.jaxb.Generator import org.jooq.meta.jaxb.Jdbc import org.jooq.meta.jaxb.Target +import org.postgresql.ds.PGSimpleDataSource import org.testcontainers.containers.GenericContainer import org.testcontainers.containers.wait.strategy.Wait import org.testcontainers.utility.DockerImageName @@ -36,11 +35,14 @@ internal fun JooqRootConfig.generate() { } private fun DbConnectionConfig.isReady(jdbcUrl: String): Boolean { - val config = HikariConfig() - config.jdbcUrl = jdbcUrl - config.username = user - config.password = password - return runCatching { HikariDataSource(config).connection.close() }.isSuccess + return runCatching { + PGSimpleDataSource().apply { + setUrl(jdbcUrl) + user = this@isReady.user + password = this@isReady.password + connection.close() + } + }.isSuccess } private fun JooqRootConfig.toConfiguration(jdbcUrl: String) =