Skip to content

Commit

Permalink
fix(deps): remove dependency on hikariCP (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcornaz authored Nov 19, 2024
1 parent 98c9af4 commit 4ee375f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
3 changes: 1 addition & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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" }
Expand Down
16 changes: 9 additions & 7 deletions src/main/kotlin/com/optravis/jooq/gradle/Generator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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) =
Expand Down

0 comments on commit 4ee375f

Please sign in to comment.