Skip to content

Commit

Permalink
Merge pull request #212 from zero88/improvement/reogranize-project
Browse files Browse the repository at this point in the history
Improvement/reogranize project
  • Loading branch information
zero88 authored Mar 30, 2024
2 parents 0e75b26 + a8aac59 commit bc5673b
Show file tree
Hide file tree
Showing 49 changed files with 35 additions and 16 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/jooqx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ jobs:
# java: [ '8', '17', '21' ]
java: [ '8', '17' ]
os: [ 'ubuntu-latest' ]
itProfile: [ 'pg:10-alpine', 'pg:12-alpine', 'pg:14-alpine', 'pg:16-alpine', 'h2', 'mysql:8.3', 'mysql:8.0', 'mysql:5.7' ]
sonarProfile: [ 'pg:16-alpine' ]
itProfile: [ 'postgres:12-alpine', 'postgres:14-alpine', 'postgres:16-alpine', 'h2', 'mysql:8.3', 'mysql:8.0' ]
sonarProfile: [ 'postgres:16-alpine' ]
fail-fast: false
name: Test ${{ matrix.itProfile }} | Java ${{ matrix.java }} (${{ matrix.os }})
with:
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
hashVersion: ${{ needs.context.outputs.commitId }}
sha: ${{ needs.context.outputs.sha }}
isRelease: ${{ needs.context.outputs.isRelease }}
antoraCommand: ':integtest:pg:generateJooq antoraDoc'
antoraCommand: ':integtest:postgres:generateJooq antoraDoc'
antoraBuildDir: 'docs/build/docs/antora'
syncDoc: ${{ needs.context.outputs.shouldPublish == 'true' || needs.context.outputs.isRelease == 'true' }}
docBranch: ${{ needs.context.outputs.docBranch }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rsql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
hashVersion: ${{ needs.context.outputs.commitId }}
sha: ${{ needs.context.outputs.sha }}
isRelease: ${{ needs.context.outputs.isRelease }}
antoraCommand: ':integtest:pg:generateJooq antoraDoc'
antoraCommand: ':integtest:postgres:generateJooq antoraDoc'
antoraBuildDir: 'rsql/asciidoc/build/docs/antora'
syncDoc: ${{ needs.context.outputs.shouldPublish == 'true' || needs.context.outputs.isRelease == 'true' }}
docBranch: ${{ needs.context.outputs.docBranch }}
Expand Down
26 changes: 23 additions & 3 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.gradle.api.Project

private fun Map<Int, List<Int>>.ver(minor: Int, patch: Int): String = "${minor}.${this[minor]?.get(patch)}"

object UtilLibs {
Expand Down Expand Up @@ -37,7 +39,8 @@ object TestLibs {
object Version {

const val junit5 = "5.10.2"
// const val pioneer = "2.2.0" // java > 11

// const val pioneer = "2.2.0" // java > 11
const val pioneer = "1.9.1" // java 8
const val testContainer = "1.19.7"
}
Expand Down Expand Up @@ -165,8 +168,25 @@ object DatabaseLibs {

object DatabaseContainer {

val postgres = listOf("16-alpine", "14-alpine", "12-alpine")
val mysql = listOf("8.3", "8.0", "5.7")
data class Container(val defaultImage: String, val jdbcPrefix: String, val supportedVersions: List<String>) {}

enum class Containers(val container: Container) {
// https://endoflife.date/postgresql
postgres(Container("postgres:16-alpine", "postgresql", listOf("16-alpine", "14-alpine", "12-alpine"))),

// https://endoflife.date/mysql
mysql(Container("mysql:8.3", "mysql", listOf("8.3", "8.0")))
}

fun findImage(project: Project): String {
val container = Containers.valueOf(project.name).container
val version = project.findProperty("dbVersion");
val jdbcDbImage: String = when (version) {
in container.supportedVersions -> container.defaultImage.replaceAfter(":", "$version")
else -> container.defaultImage
}
return jdbcDbImage.replaceBefore(":", container.jdbcPrefix)
}
}

object ZeroLibs {
Expand Down
2 changes: 1 addition & 1 deletion docs/asciidoc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ plugins {

dependencies {
compileOnly(project(":spi"))
compileOnly(project(":integtest:pg"))
compileOnly(project(":integtest:postgres"))
compileOnly(JooqLibs.jooqMeta)
compileOnly(VertxLibs.jdbc)
compileOnly(VertxLibs.pgsql)
Expand Down
2 changes: 1 addition & 1 deletion docs/testing-asciidoc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies {
compileOnly(project(":spi"))
compileOnly(testFixtures(project(":jooqx")))
// compileOnly(project(":rsql:jooq"))
compileOnly(project(":integtest:pg"))
compileOnly(project(":integtest:postgres"))
compileOnly(VertxLibs.jdbc)
compileOnly(VertxLibs.pgsql)
compileOnly(VertxLibs.mysql)
Expand Down
2 changes: 1 addition & 1 deletion integtest/mysql/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dependencies {
}

val dialect = "org.jooq.meta.mysql.MySQLDatabase"
val dbImage = "mysql:${prop(project, "dbVersion", DatabaseContainer.mysql[0])}"
val dbImage = DatabaseContainer.findImage(project)
fun getSchema(schemaFile: String): String = "${buildDir}/resources/main/${schemaFile}"

jooq {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import cloud.playio.gradle.jooq.JooqJdbcContainer
import cloud.playio.gradle.shared.prop
import nu.studer.gradle.jooq.JooqGenerate
import org.jooq.meta.jaxb.ForcedType
import org.jooq.meta.jaxb.Logging
Expand All @@ -24,7 +23,7 @@ dependencies {
}

val dialect = "org.jooq.meta.postgres.PostgresDatabase"
val dbImage = "postgresql:${prop(project, "dbVersion", DatabaseContainer.postgres[0])}"
val dbImage = DatabaseContainer.findImage(project)
fun getSchema(schemaFile: String): String = "${buildDir}/resources/main/${schemaFile}"

jooq {
Expand Down
2 changes: 1 addition & 1 deletion rsql/asciidoc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {

dependencies {
compileOnly(project(":rsql:jooq"))
compileOnly(project(":integtest:pg"))
compileOnly(project(":integtest:postgres"))
compileOnly(VertxLibs.jdbc)
compileOnly(VertxLibs.pgsql)
compileOnly(VertxLibs.mysql)
Expand Down
6 changes: 3 additions & 3 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pluginManagement {

rootProject.name = "jooqx-parent"
val profile: String by settings
val supportDatabases = arrayOf("db2", "h2", "mssql", "mysql", "oracle", "pg", "sqlite")
val supportDatabases = arrayOf("db2", "h2", "mssql", "mysql", "oracle", "postgres", "sqlite")
var pp: Array<String> = arrayOf()
val pools = mutableMapOf(
"jpa" to arrayOf(":jpa-ext"),
Expand All @@ -32,9 +32,9 @@ val excludeCIBuild = pools["sample"]!! + pools["integtest"]!! + excludeCISonar
pools.putAll(
mapOf(
"jooqx:sonar" to pools["jooqx"]!!.plus(pools["integtest"]!!),
"jooqx:docs" to pools["jooqx"]!!.plus(":integtest:pg").plus(jooqxDocs),
"jooqx:docs" to pools["jooqx"]!!.plus(":integtest:postgres").plus(jooqxDocs),
"rsql:sonar" to pools["rsql"]!!,
"rsql:docs" to pools["rsql"]!!.plus(pools["jooqx"]!!).plus(":integtest:pg").plus(rsqlDocs)
"rsql:docs" to pools["rsql"]!!.plus(pools["jooqx"]!!).plus(":integtest:postgres").plus(rsqlDocs)
)
)

Expand Down

0 comments on commit bc5673b

Please sign in to comment.