Skip to content

Commit

Permalink
chore: update examples (#253)
Browse files Browse the repository at this point in the history
Update example dependency versions.

Also, add Kotlin data classes example.
  • Loading branch information
monosoul authored Dec 21, 2024
1 parent 15b58bc commit e26c66b
Show file tree
Hide file tree
Showing 20 changed files with 92 additions and 69 deletions.
4 changes: 2 additions & 2 deletions examples/external-database/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import dev.monosoul.jooq.RecommendedVersions

plugins {
kotlin("jvm") version "1.9.20"
id("dev.monosoul.jooq-docker") version "6.0.0"
kotlin("jvm") version "2.1.0"
id("dev.monosoul.jooq-docker") version "6.1.14"
id("com.avast.gradle.docker-compose") version "0.16.11"
}

Expand Down
Binary file modified examples/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
6 changes: 4 additions & 2 deletions examples/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
22 changes: 12 additions & 10 deletions examples/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down Expand Up @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import dev.monosoul.jooq.RecommendedVersions

plugins {
kotlin("jvm") version "1.9.20"
id("dev.monosoul.jooq-docker") version "6.0.0"
kotlin("jvm") version "2.1.0"
id("dev.monosoul.jooq-docker") version "6.1.14"
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import dev.monosoul.jooq.RecommendedVersions

plugins {
kotlin("jvm") version "1.9.20"
id("dev.monosoul.jooq-docker") version "6.0.0"
kotlin("jvm") version "2.1.0"
id("dev.monosoul.jooq-docker") version "6.1.14"
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import dev.monosoul.jooq.RecommendedVersions

plugins {
kotlin("jvm") version "1.9.20"
id("dev.monosoul.jooq-docker") version "6.0.0"
kotlin("jvm") version "2.1.0"
id("dev.monosoul.jooq-docker") version "6.1.14"
}

repositories {
Expand Down
4 changes: 2 additions & 2 deletions examples/java-codegen-configuration/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import dev.monosoul.jooq.RecommendedVersions

plugins {
kotlin("jvm") version "1.9.20"
id("dev.monosoul.jooq-docker") version "6.0.0"
kotlin("jvm") version "2.1.0"
id("dev.monosoul.jooq-docker") version "6.1.14"
}

repositories {
Expand Down
32 changes: 32 additions & 0 deletions examples/kotlin-data-classes/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* This is how you can configure jOOQ to generate Kotlin data classes
*/

import dev.monosoul.jooq.RecommendedVersions

plugins {
kotlin("jvm") version "2.1.0"
id("dev.monosoul.jooq-docker") version "6.1.14"
}

repositories {
mavenCentral()
}

dependencies {
jooqCodegen("org.postgresql:postgresql:42.5.4")
implementation("org.postgresql:postgresql:42.5.4")
implementation("org.jooq:jooq:${RecommendedVersions.JOOQ_VERSION}")
}

tasks.generateJooqClasses {
usingJavaConfig {
withName("org.jooq.codegen.KotlinGenerator")
generate.apply {
withPojosAsKotlinDataClasses(true)
withKotlinNotNullRecordAttributes(true)
withKotlinNotNullPojoAttributes(true)
withKotlinNotNullInterfaceAttributes(true)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package dev.monosoul.jooq.example

import org.jooq.generated.tables.records.FooRecord
import java.util.UUID


fun main() {
println(FooRecord(UUID.randomUUID(), "someData"))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
create table foo
(
id UUID primary key,
data TEXT not null
);
4 changes: 2 additions & 2 deletions examples/multiple-databases/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import dev.monosoul.jooq.GenerateJooqClassesTask
import dev.monosoul.jooq.RecommendedVersions

plugins {
kotlin("jvm") version "1.9.20"
id("dev.monosoul.jooq-docker") version "6.0.0"
kotlin("jvm") version "2.1.0"
id("dev.monosoul.jooq-docker") version "6.1.14"
}

repositories {
Expand Down
4 changes: 2 additions & 2 deletions examples/mysql/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import dev.monosoul.jooq.RecommendedVersions

plugins {
kotlin("jvm") version "1.9.20"
id("dev.monosoul.jooq-docker") version "6.0.0"
kotlin("jvm") version "2.1.0"
id("dev.monosoul.jooq-docker") version "6.1.14"
}

repositories {
Expand Down
4 changes: 2 additions & 2 deletions examples/properties/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import dev.monosoul.jooq.RecommendedVersions

plugins {
kotlin("jvm") version "1.9.20"
id("dev.monosoul.jooq-docker") version "6.0.0"
kotlin("jvm") version "2.1.0"
id("dev.monosoul.jooq-docker") version "6.1.14"
}

repositories {
Expand Down
4 changes: 2 additions & 2 deletions examples/recommended-jooq-flyway-versions/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import dev.monosoul.jooq.RecommendedVersions

plugins {
kotlin("jvm") version "1.9.20"
id("dev.monosoul.jooq-docker") version "6.0.0"
kotlin("jvm") version "2.1.0"
id("dev.monosoul.jooq-docker") version "6.1.14"
}

repositories {
Expand Down
41 changes: 7 additions & 34 deletions examples/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import dev.monosoul.gradle.module.tree.includeTree

rootProject.name = "jooq-gradle-plugin-examples"

plugins {
id("dev.monosoul.module-tree") version "0.0.2"
}

includeTree {
dir("spring-boot") {
module("recommended-jooq-version")
Expand All @@ -22,38 +28,5 @@ includeTree {
}
module("third-party-jar")
}
}



// Module declaration DSL, feel free to ignore it
data class IncludeTree(
private val path: String,
private val parentProject: String
) {
fun dir(path: String, block: IncludeTree.() -> Unit) {
val nestedPath = "${this.path}/$path"
includeTree(nestedPath, parentProject, block)
}

fun module(name: String, block: IncludeTree.() -> Unit = {}) {
val projectName = "$parentProject:$name"
val projectDir = "$path/$name"

include(projectName)
project(projectName).also {
it.projectDir = file(projectDir)

it.buildFile.takeUnless(File::exists)
?.also { buildFile ->
buildFile.parentFile.mkdirs()
file("${buildFile.absolutePath}.kts").createNewFile()
}
}
includeTree(projectDir, projectName, block)
}
}

fun includeTree(path: String = ".", parentProject: String = "", block: IncludeTree.() -> Unit) {
IncludeTree(path, parentProject).block()
module("kotlin-data-classes")
}
2 changes: 1 addition & 1 deletion examples/spring-boot/old-jooq-version/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
val kotlinVersion = "1.7.22"
kotlin("jvm") version kotlinVersion
kotlin("plugin.spring") version kotlinVersion
id("dev.monosoul.jooq-docker") version "6.0.0"
id("dev.monosoul.jooq-docker") version "6.1.14"
}

buildscript {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
val kotlinVersion = "1.7.22"
kotlin("jvm") version kotlinVersion
kotlin("plugin.spring") version kotlinVersion
id("dev.monosoul.jooq-docker") version "6.0.0"
id("dev.monosoul.jooq-docker") version "6.1.14"
}

repositories {
Expand Down
4 changes: 2 additions & 2 deletions examples/xml-codegen-configuration/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import dev.monosoul.jooq.RecommendedVersions

plugins {
kotlin("jvm") version "1.9.20"
id("dev.monosoul.jooq-docker") version "6.0.0"
kotlin("jvm") version "2.1.0"
id("dev.monosoul.jooq-docker") version "6.1.14"
}

repositories {
Expand Down

0 comments on commit e26c66b

Please sign in to comment.