Skip to content

Commit

Permalink
feat(gradle): switch to java17
Browse files Browse the repository at this point in the history
  • Loading branch information
zero88 committed Apr 20, 2024
1 parent bc5673b commit 4183bb4
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/jooqx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
semanticVersion: ${{ needs.context.outputs.semanticVersion }}
hashVersion: ${{ needs.context.outputs.commitId }}
javaVersion: ${{ matrix.java }}
buildArgs: 'clean build -PjvmRuntime=${{ matrix.java }}'

analysis:
uses: zero88/shared-ghactions/.github/workflows/gradle-analysis.yml@main
Expand All @@ -74,7 +75,7 @@ jobs:
semanticVersion: ${{ needs.context.outputs.semanticVersion }}
hashVersion: ${{ needs.context.outputs.commitId }}
javaVersion: ${{ matrix.java }}
buildArgs: 'clean integtest:itTest -PitProfile=${{ matrix.itProfile }}'
buildArgs: 'clean integtest:itTest -PitProfile=${{ matrix.itProfile }} -PjvmRuntime=${{ matrix.java }}'
sonarqube: ${{ contains(matrix.sonarProfile, matrix.itProfile) && matrix.java == '17' }}
sonarProps: '-PskipItTest=true' # to not run integtest again
secrets:
Expand All @@ -91,6 +92,7 @@ jobs:
semanticVersion: ${{ needs.context.outputs.semanticVersion }}
hashVersion: ${{ needs.context.outputs.commitId }}
isRelease: ${{ needs.context.outputs.isRelease }}
javaVersion: 17
secrets:
ossrhUser: ${{ secrets.OSS_SONATYPE_USER }}
ossrhToken: ${{ secrets.OSS_SONATYPE_PASSWORD }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/jpa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
semanticVersion: ${{ needs.context.outputs.semanticVersion }}
hashVersion: ${{ needs.context.outputs.commitId }}
javaVersion: ${{ matrix.java }}
buildArgs: 'clean build -PjvmRuntime=${{ matrix.java }}'

publish:
needs: [ context, build ]
Expand All @@ -62,6 +63,7 @@ jobs:
semanticVersion: ${{ needs.context.outputs.semanticVersion }}
hashVersion: ${{ needs.context.outputs.commitId }}
isRelease: ${{ needs.context.outputs.isRelease }}
javaVersion: 8
secrets:
ossrhUser: ${{ secrets.OSS_SONATYPE_USER }}
ossrhToken: ${{ secrets.OSS_SONATYPE_PASSWORD }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/rsql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
semanticVersion: ${{ needs.context.outputs.semanticVersion }}
hashVersion: ${{ needs.context.outputs.commitId }}
javaVersion: ${{ matrix.java }}
buildArgs: 'clean test jacocoTestReport -PjvmRuntime=${{ matrix.java }}'
sonarqube: ${{ matrix.java == '17' && matrix.os == 'ubuntu-latest' }}
sonarProps: '-Dsonar.projectKey=zero88_rsql'
secrets:
Expand Down Expand Up @@ -100,6 +101,7 @@ jobs:
semanticVersion: ${{ needs.context.outputs.semanticVersion }}
hashVersion: ${{ needs.context.outputs.commitId }}
isRelease: ${{ needs.context.outputs.isRelease }}
javaVersion: 8
secrets:
ossrhUser: ${{ secrets.OSS_SONATYPE_USER }}
ossrhToken: ${{ secrets.OSS_SONATYPE_PASSWORD }}
Expand Down
2 changes: 1 addition & 1 deletion .sdkmanrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Enable auto-env through the sdkman_auto_env config
# Add key=value pairs of SDKs to use below
java=11.0.22-tem
java=17.0.10-tem
43 changes: 36 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ plugins {

project.ext.set("baseName", "jooqx")
project.ext.set(NexusConfig.NEXUS_VERSION_KEY, NexusVersion.BEFORE_2021_02_24)
val skipPublish = (gradle as ExtensionAware).extensions["SKIP_PUBLISH"] as Array<*>

jacoco {
toolVersion = "0.8.11"
}

allprojects {
group = "io.github.zero88"
Expand All @@ -29,7 +34,6 @@ allprojects {
mavenCentral()
}

val skipPublish = (gradle as ExtensionAware).extensions["SKIP_PUBLISH"] as Array<*>
sonarqube {
isSkipProject = project.path in skipPublish
}
Expand All @@ -44,6 +48,16 @@ allprojects {
subprojects {
apply(plugin = PlayioPlugin.oss)

val jvmRuntime = prop(project, "jvmRuntime") as String
val jvmRelease = prop(project, "jvmRelease") as String
val artifactClassifier = when (jvmRuntime) {
"8" -> if (jvmRelease == "8") "" else "-jvm8"
"11" -> if (jvmRelease == "11") "" else "-jvm11"
"17" -> if (jvmRelease == "17") "" else "-jvm17"
"21" -> if (jvmRelease == "21") "" else "-jvm21"
else -> throw IllegalArgumentException("Unknown version $jvmRuntime")
}

dependencies {
compileOnly(UtilLibs.jetbrainsAnnotations)

Expand All @@ -62,10 +76,29 @@ subprojects {
}
}

jacoco {
toolVersion = "0.8.11"
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(jvmRuntime))
}
}

tasks {
withType<AbstractPublishToMaven> {
enabled = project != rootProject && project.path !in skipPublish
}

withType<Jar> {
archiveClassifier.set(
when (name) {
"testFixturesJar" -> "test-fixtures$artifactClassifier"
"javadocJar" -> "javadoc$artifactClassifier"
"sourcesJar" -> "sources$artifactClassifier"
else -> artifactClassifier.replace("-", "")
}
)
println(archiveClassifier.get())
}
}
}

rootProject.apply {
Expand All @@ -78,10 +111,6 @@ rootProject.apply {
}
}

jacoco {
toolVersion = "0.8.11"
}

tasks {
// exclude jacoco report: https://github.com/gradle/gradle/issues/13013
withType<JacocoReport> {
Expand Down
3 changes: 1 addition & 2 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ object DatabaseContainer {

fun findImage(project: Project): String {
val container = Containers.valueOf(project.name).container
val version = project.findProperty("dbVersion");
val jdbcDbImage: String = when (version) {
val jdbcDbImage: String = when (val version = project.findProperty("dbVersion")) {
in container.supportedVersions -> container.defaultImage.replaceAfter(":", "$version")
else -> container.defaultImage
}
Expand Down
6 changes: 6 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
org.gradle.caching=true
org.gradle.parallel=true

# JVM properties -----------------------------
# Defines the runtime java version that is used to build the current project
jvmRuntime=17
# Defines the default java baseline version to release the current project
jvmRelease=17

# Project properties --------------------------
title=jOOQ.x
description=Reactive SQL with Vert.x and jOOQ
Expand Down
4 changes: 4 additions & 0 deletions jpa-ext/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# JVM properties
jvmRuntime=8
jvmRelease=8

title=JPA Extension
description=JPA Extension
version=1.0.0
Expand Down
4 changes: 4 additions & 0 deletions rsql/core/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# JVM properties
jvmRuntime=8
jvmRelease=8

title=RSQL Core
description=RSQL core
6 changes: 5 additions & 1 deletion rsql/jooq/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# JVM properties
jvmRuntime=17
jvmRelease=17

title=jOOQ RSQL
description=jOOQ RSQL
description=jOOQ RSQL

0 comments on commit 4183bb4

Please sign in to comment.