Skip to content

Commit

Permalink
Revert jooq gradle plugin change
Browse files Browse the repository at this point in the history
  • Loading branch information
mattupstate committed Dec 19, 2023
1 parent 1409f0e commit 9f9674a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 41 deletions.
83 changes: 45 additions & 38 deletions acme-data/acme-data-sql/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import org.jooq.codegen.gradle.CodegenTask
import nu.studer.gradle.jooq.JooqEdition
import nu.studer.gradle.jooq.JooqGenerate

plugins {
id("acme.kotlin-library-conventions")
alias(libs.plugins.org.jooq.codegen)
alias(libs.plugins.nu.studer.jooq)
}

dependencies {
jooqCodegen(files("src/main/resources"))
jooqCodegen(project(":acme-lib:acme-lib-liquibase"))
jooqCodegen(libs.org.testcontainers.postgresql)
jooqCodegen(libs.org.postgresql)
jooqCodegen(libs.ch.qos.logback.logback.classic)
jooqGenerator(project(":acme-lib:acme-lib-liquibase"))
jooqGenerator(libs.org.testcontainers.postgresql)
jooqGenerator(libs.org.postgresql)
jooqGenerator(libs.ch.qos.logback.logback.classic)

implementation(project(":acme-domain:acme-domain-core"))
implementation(libs.com.michael.bull.kotlin.coroutines.jdbc)
Expand All @@ -31,49 +31,56 @@ java {
sourceSets {
main {
java {
srcDir(tasks.withType(CodegenTask::class))
srcDir(tasks.withType(JooqGenerate::class))
}
}
}
}

jooq {
configuration {
logging = org.jooq.meta.jaxb.Logging.WARN
jdbc {
driver = "org.testcontainers.jdbc.ContainerDatabaseDriver"
url =
"jdbc:tc:postgresql:15.5:///test?TC_INITFUNCTION=com.acme.liquibase.LiquibaseTestContainerInitializerKt::update"
user = "test"
password = "test"
}
generator {
name = "org.jooq.codegen.KotlinGenerator"
database {
name = "org.jooq.meta.postgres.PostgresDatabase"
includes = ".*"
excludes = "databasechangelog.*|databasechangeloglock.*|pg_catalog.*|information_schema.*"
}
target {
packageName = "com.acme.sql"
directory = projectDir.resolve("build/generated-src/jooq/main").toString()
}
generate {
isKotlinNotNullPojoAttributes = true
isKotlinNotNullRecordAttributes = true
isKotlinNotNullInterfaceAttributes = true
}
strategy {
name = "org.jooq.codegen.DefaultGeneratorStrategy"
version.set("3.18.7")
edition.set(JooqEdition.OSS)
configurations {
create("main") {
jooqConfiguration.apply {
logging = org.jooq.meta.jaxb.Logging.WARN
jdbc.apply {
driver = "org.testcontainers.jdbc.ContainerDatabaseDriver"
url =
"jdbc:tc:postgresql:15.5:///test?TC_INITFUNCTION=com.acme.liquibase.LiquibaseTestContainerInitializerKt::update"
}
generator.apply {
name = "org.jooq.codegen.KotlinGenerator"
database.apply {
name = "org.jooq.meta.postgres.PostgresDatabase"
includes = ".*"
excludes = "databasechangelog.*|databasechangeloglock.*|pg_catalog.*|information_schema.*"
}
target.apply {
packageName = "com.acme.sql"
}
generate.apply {
isKotlinNotNullPojoAttributes = true
isKotlinNotNullRecordAttributes = true
isKotlinNotNullInterfaceAttributes = true
}
strategy.name = "org.jooq.codegen.DefaultGeneratorStrategy"
}
}
}
}
}

tasks {
withType(CodegenTask::class) {
inputs.dir(projectDir.resolve("src/main/resources/db"))
.withPathSensitivity(PathSensitivity.RELATIVE)
val liquibaseChangelogFile = "src/main/resources/db/changelog.yaml"

withType(JooqGenerate::class) {
inputs.dir(file(liquibaseChangelogFile).parent).withPathSensitivity(PathSensitivity.RELATIVE)
allInputsDeclared.set(true)
outputs.cacheIf { true }
javaExecSpec = Action {
systemProperty("liquibase.changelogFile", liquibaseChangelogFile)
systemProperty("logback.configurationFile", projectDir.resolve("logback-jooq.xml"))
}
}
}
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ io-kotest = "5.8.0"
io-ktor = "2.3.4"
io-opentelemetry = "1.30.1"
kotlin = "1.9.21"
org-jooq = "3.19.0"
org-jooq = "3.18.7"
org-junit-jupiter = "5.10.0"
org-seleniumhq-selenium = "4.13.0"
org-slf4j = "2.0.9"
Expand Down Expand Up @@ -74,6 +74,7 @@ org-jetbrains-kotlinx-kotlinx-serialization-json = "org.jetbrains.kotlinx:kotlin
# @keep this version, it's used in buildSrc and the update plugin doens't recognize it
org-jlleitschuh-ktlint-gradle-plugin = "org.jlleitschuh.gradle:ktlint-gradle:10.2.1"
org-jooq = { module = "org.jooq:jooq", version.ref = "org-jooq" }
org-jooq-jooq-codegen = { module = "org.jooq:jooq-codegen", version.ref = "org-jooq" }
org-jooq-jooq-kotlin = { module = "org.jooq:jooq-kotlin", version.ref = "org-jooq" }
org-jooq-jooq-kotlin-coroutines = { module = "org.jooq:jooq-kotlin-coroutines", version.ref = "org-jooq" }
org-junit-jupiter-junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "org-junit-jupiter" }
Expand All @@ -97,6 +98,5 @@ com-github-ben-manes-versions = "com.github.ben-manes.versions:0.50.0"
com-google-cloud-tools-jib = "com.google.cloud.tools.jib:3.4.0"
com-ryandens-javaagent-jib = "com.ryandens.javaagent-jib:0.5.1"
nl-littlerobots-version-catalog-update = "nl.littlerobots.version-catalog-update:0.8.1"
org-jooq-codegen = { id = "org.jooq.jooq-codegen-gradle", version.ref = "org-jooq" }
com-bmuschko-docker-remote-api = "com.bmuschko.docker-remote-api:9.4.0"
nu-studer-jooq = "nu.studer.jooq:8.2.1"
org-hidetake-swagger-generator = "org.hidetake.swagger.generator:2.19.2"

0 comments on commit 9f9674a

Please sign in to comment.