From db0c3c856eb3e8c314f5ca19260e7c6c6f6feaf5 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Sat, 26 Apr 2025 01:39:18 -0700 Subject: [PATCH] Set Detekt JVM target to 23 under JDK 24 --- .github/workflows/gradle.yml | 9 ++------- build.gradle.kts | 9 ++++++++- detekt-baseline.xml | 14 +++++++------- .../java/com/example/GeneratedVersion.java | 6 +++--- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index ac4de6c..71d4858 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -35,15 +35,10 @@ jobs: ~/.gradle/wrapper key: ${{ runner.os }}-gradle-${{ matrix.java-version }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} restore-keys: | - ${{ runner.os }}-gradle-${{ matrix.java-version }}- - - - name: Check with Gradle - if: matrix.java-version != '24' - run: ./gradlew build check --stacktrace + ${{ runner.os }}-gradle-${{ matrix.java-version }} - name: Test with Gradle - if: matrix.java-version == '24' - run: ./gradlew build test --stacktrace + run: ./gradlew build check --stacktrace - name: Cleanup Gradle Cache run: | diff --git a/build.gradle.kts b/build.gradle.kts index 109a469..b519e59 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,4 @@ +import io.gitlab.arturbosch.detekt.Detekt import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.gradle.api.tasks.testing.logging.TestLogEvent import org.jetbrains.kotlin.gradle.dsl.JvmTarget @@ -59,10 +60,16 @@ tasks { } detekt { - // toolVersion = "main-SNAPSHOT" + toolVersion = "main-SNAPSHOT" baseline = project.rootDir.resolve("detekt-baseline.xml") } +tasks.withType().configureEach { + if (JavaVersion.current() >= JavaVersion.VERSION_24) { + jvmTarget = "23" + } +} + gradlePlugin { website.set(github) vcsUrl.set(github) diff --git a/detekt-baseline.xml b/detekt-baseline.xml index c57e9ed..4de5a80 100644 --- a/detekt-baseline.xml +++ b/detekt-baseline.xml @@ -1,12 +1,12 @@ - + - MagicNumber:utils.kt$3 - MagicNumber:utils.kt$4 - MagicNumber:utils.kt$5 - NestedBlockDepth:utils.kt$fun File.loadProperties(): Properties - NestedBlockDepth:utils.kt$fun parseSemVer(input: String?, version: Version): Boolean - NestedBlockDepth:utils.kt$fun saveProperties(projectDir: File, config: SemverConfig, version: Version) + MagicNumber:utils.kt:3 + MagicNumber:utils.kt:4 + MagicNumber:utils.kt:5 + NestedBlockDepth:utils.kt:fun File.loadProperties(): Properties + NestedBlockDepth:utils.kt:fun parseSemVer(input: String?, version: Version): Boolean + NestedBlockDepth:utils.kt:fun saveProperties(projectDir: File, config: SemverConfig, version: Version) diff --git a/examples/annotation-processor/java/src/generated/java/com/example/GeneratedVersion.java b/examples/annotation-processor/java/src/generated/java/com/example/GeneratedVersion.java index f0c4a7f..6ed2e78 100644 --- a/examples/annotation-processor/java/src/generated/java/com/example/GeneratedVersion.java +++ b/examples/annotation-processor/java/src/generated/java/com/example/GeneratedVersion.java @@ -14,16 +14,16 @@ import java.util.Date; */ public final class GeneratedVersion { public static final String PROJECT = "Java Example"; -public static final Date BUILDDATE = new Date(1707709694421L); +public static final Date BUILDDATE = new Date(1745642618838L); public static final int MAJOR = 2; -public static final int MINOR = 12; +public static final int MINOR = 13; public static final int PATCH = 0; public static final String PRERELEASE = ""; public static final String PRERELEASE_PREFIX = "-"; public static final String BUILDMETA = ""; public static final String BUILDMETA_PREFIX = "+"; public static final String SEPARATOR = "."; -public static final String VERSION = "2.12.0"; +public static final String VERSION = "2.13.0"; /** * Disables the default constructor.