diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index bec54eb..ff8014b 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -16,48 +16,40 @@ jobs: strategy: matrix: java-version: - - 17 + - '17' + - '21' os: - ubuntu-latest - - windows-2019 + - windows-latest # in case one combination fails, we still want to see results from others fail-fast: false runs-on: ${{ matrix.os }} timeout-minutes: 30 steps: - - uses: actions/checkout@v3 - - - name: Setup Gradle Dependencies Cache - uses: actions/cache@v3 - with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }} - - - name: Setup Gradle Wrapper Cache - uses: actions/cache@v3 - with: - path: ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} + - uses: actions/checkout@v6 - name: Set up JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v5 with: java-version: ${{ matrix.java-version }} distribution: 'temurin' + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v5 + - name: Build with Gradle run: | ./gradlew build - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v6 if: ${{ matrix.java-version == '17' && matrix.os == 'ubuntu-latest' }} with: token: ${{secrets.CODECOV_TOKEN}} files: ./build/reports/kover/report.xml - name: Temporarily set snapshot version - if: ${{ github.event_name == 'push' && matrix.os == 'ubuntu-latest' }} + if: ${{ github.event_name == 'push' && matrix.java-version == '17' && matrix.os == 'ubuntu-latest' }} uses: christian-draeger/write-properties@1.0.1 with: path: './gradle.properties' @@ -65,7 +57,7 @@ jobs: value: 0-SNAPSHOT - name: Publish snapshot to Maven Central - if: ${{ github.event_name == 'push' && matrix.os == 'ubuntu-latest' }} + if: ${{ github.event_name == 'push' && matrix.java-version == '17' && matrix.os == 'ubuntu-latest' }} env: ORG_GRADLE_PROJECT_signingKey: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGKEY}} ORG_GRADLE_PROJECT_signingKeyId: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGKEYID}} @@ -82,16 +74,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v6 with: fetch-depth: 0 - name: Run static code analysis - uses: JetBrains/qodana-action@v2022.3.2 - with: - linter: jetbrains/qodana-jvm + uses: JetBrains/qodana-action@v2025.2.2 - name: Upload static code analysis results - uses: github/codeql-action/upload-sarif@v2 + uses: github/codeql-action/upload-sarif@v4 with: sarif_file: ${{ runner.temp }}/qodana/results/qodana.sarif.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 771c06e..88bc456 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,26 +22,17 @@ jobs: timeout-minutes: 30 steps: - - uses: actions/checkout@v3 - - - name: Setup Gradle Dependencies Cache - uses: actions/cache@v3 - with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }} - - - name: Setup Gradle Wrapper Cache - uses: actions/cache@v3 - with: - path: ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} + - uses: actions/checkout@v6 - name: Set up JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v5 with: - java-version: 17 + java-version: '17' distribution: 'temurin' + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v5 + - name: Build with Gradle run: | ./gradlew build diff --git a/build.gradle.kts b/build.gradle.kts index 8ca4833..3da0fea 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -39,6 +39,6 @@ nexusPublishing { } tasks.wrapper { - gradleVersion = "8.4" + gradleVersion = "9.5.0" distributionType = Wrapper.DistributionType.ALL } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 5ca71b4..2de5330 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -7,18 +7,17 @@ plugins { val kotlinVersion = "1.9.10" val detektPlugin = "1.23.4" -val gradleNexusPublishPlugin = "1.3.0" +val gradleNexusPublishPlugin = "2.0.0" val gradleTestLoggerPlugin = "4.0.0" -val gradleVersionsPlugin = "0.50.0" +val gradleVersionsPlugin = "0.51.0" val kotlinDokkaPlugin = "1.9.10" val kotlinxKoverPlugin = "0.7.5" -val useLatestVersionsPlugin = "0.2.18" +val useLatestVersionsPlugin = "0.2.19" dependencies { implementation(platform("org.jetbrains.kotlin:kotlin-bom:$kotlinVersion")) implementation("org.jetbrains.kotlin:kotlin-serialization") implementation("org.jetbrains.kotlin:kotlin-reflect") - implementation("org.jetbrains.kotlin:kotlin-compiler-embeddable") implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$detektPlugin") @@ -29,3 +28,7 @@ dependencies { implementation("org.jetbrains.kotlinx:kover-gradle-plugin:$kotlinxKoverPlugin") implementation("se.patrikerdes:gradle-use-latest-versions-plugin:$useLatestVersionsPlugin") } + +kotlin { + jvmToolchain(17) +} diff --git a/buildSrc/src/main/kotlin/Deps.kt b/buildSrc/src/main/kotlin/Deps.kt index b167997..48a7496 100644 --- a/buildSrc/src/main/kotlin/Deps.kt +++ b/buildSrc/src/main/kotlin/Deps.kt @@ -5,7 +5,7 @@ object Versions { const val serialization = "1.0.1" const val jsoup = "1.13.1" const val htmlUnit = "2.63.0" - const val testContainers = "1.16.2" + const val testContainers = "2.0.5" const val wireMock = "2.28.0" const val log4jOverSlf4j = "2.0.7" const val logback = "1.3.11" @@ -38,6 +38,7 @@ object Deps { const val log4jOverSlf4j = "org.slf4j:log4j-over-slf4j:${Versions.log4jOverSlf4j}" const val strikt = "io.strikt:strikt-core:${Versions.strikt}" const val jUnit = "org.junit.jupiter:junit-jupiter:${Versions.jUnit}" + const val jUnitPlatformLauncher = "org.junit.platform:junit-platform-launcher" const val javaxServlet = "javax.servlet:javax.servlet-api:${Versions.javaxServlet}" const val jetbrainsAnnotations = "org.jetbrains:annotations:${Versions.jetbrainsAnnotations}" const val restAssured = "io.rest-assured:kotlin-extensions:${Versions.restAssured}" @@ -80,7 +81,7 @@ object Deps { version = Versions.testContainers, ) { val testContainers = dependency("testcontainers") - val jUnit = dependency("junit-jupiter") + val jUnit = dependency("testcontainers-junit-jupiter") } object Mockk : DependencyGroup( diff --git a/buildSrc/src/main/kotlin/buildsrc/convention/kotlin-jvm.gradle.kts b/buildSrc/src/main/kotlin/buildsrc/convention/kotlin-jvm.gradle.kts index 84d8f1b..9e7e5a0 100644 --- a/buildSrc/src/main/kotlin/buildsrc/convention/kotlin-jvm.gradle.kts +++ b/buildSrc/src/main/kotlin/buildsrc/convention/kotlin-jvm.gradle.kts @@ -1,6 +1,8 @@ package buildsrc.convention import Deps +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -14,6 +16,7 @@ plugins { dependencies { testImplementation(Deps.jUnit) + testRuntimeOnly(Deps.jUnitPlatformLauncher) testImplementation(Deps.strikt) testImplementation(Deps.Mockk.mockk) testImplementation(Deps.Mockk.dslJvm) @@ -36,11 +39,11 @@ tasks.withType().configureEach { } tasks.withType().configureEach { - kotlinOptions.apply { - jvmTarget = "1.8" - freeCompilerArgs += listOf("-Xjsr305=strict") - apiVersion = "1.6" - languageVersion = "1.6" + compilerOptions { + jvmTarget.set(JvmTarget.JVM_1_8) + freeCompilerArgs.add("-Xjsr305=strict") + apiVersion.set(KotlinVersion.KOTLIN_2_1) + languageVersion.set(KotlinVersion.KOTLIN_2_1) } } diff --git a/buildSrc/src/main/kotlin/buildsrc/convention/version-management.gradle.kts b/buildSrc/src/main/kotlin/buildsrc/convention/version-management.gradle.kts index 7f369fb..33d4322 100644 --- a/buildSrc/src/main/kotlin/buildsrc/convention/version-management.gradle.kts +++ b/buildSrc/src/main/kotlin/buildsrc/convention/version-management.gradle.kts @@ -4,13 +4,21 @@ import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask plugins { base - id("com.github.ben-manes.versions") - id("se.patrikerdes.use-latest-versions") +} + +val isPrecompiledScriptPluginAccessorsProject = + project.path.contains("generatePrecompiledScriptPluginAccessors") + +if (!isPrecompiledScriptPluginAccessorsProject) { + apply(plugin = "com.github.ben-manes.versions") + apply(plugin = "se.patrikerdes.use-latest-versions") } val updateDependencies by tasks.registering { group = LifecycleBasePlugin.BUILD_GROUP - dependsOn(tasks.useLatestVersions) + if (!isPrecompiledScriptPluginAccessorsProject) { + dependsOn("useLatestVersions") + } dependsOn(tasks.withType()) } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 249e583..b1b8ef5 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fce403e..f193d72 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,9 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-all.zip +networkTimeout=10000 +retries=0 +retryBackOffMs=500 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index a69d9cb..b9bb139 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/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/. @@ -80,13 +82,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +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 @@ -114,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -133,22 +132,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -165,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -193,16 +198,19 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index f127cfd..24c62d5 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -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 ########################################################################## @@ -21,11 +23,12 @@ @rem @rem ########################################################################## -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -42,13 +45,13 @@ 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 +"%COMSPEC%" /c exit 1 :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -56,36 +59,24 @@ 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 +"%COMSPEC%" /c exit 1 :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel -:omega +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/qodana.yaml b/qodana.yaml index 2971434..c54abed 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -1,3 +1,5 @@ version: "1.0" +linter: qodana-jvm-community +projectJDK: 17 profile: - name: qodana.recommended \ No newline at end of file + name: qodana.recommended diff --git a/settings.gradle.kts b/settings.gradle.kts index 0a9d7cc..a764bca 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -26,7 +26,7 @@ dependencyResolutionManagement { } plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version ("0.4.0") + id("org.gradle.toolchains.foojay-resolver-convention") version ("1.0.0") } // Gradle Plugin versions are defined in ./buildSrc/build.gradle.kts diff --git a/test-utils/src/main/kotlin/Testcontainer.kt b/test-utils/src/main/kotlin/Testcontainer.kt index a2f1369..8d8c6ad 100644 --- a/test-utils/src/main/kotlin/Testcontainer.kt +++ b/test-utils/src/main/kotlin/Testcontainer.kt @@ -17,10 +17,11 @@ public object Testcontainer { start() } }) { + val host = host Wiremock( - client = WireMock(containerIpAddress, getMappedPort(httpPort)), - httpUrl = "http://$containerIpAddress:${getMappedPort(httpPort)}", - httpsUrl = "https://$containerIpAddress:${getMappedPort(httpsPort)}", + client = WireMock(host, getMappedPort(httpPort)), + httpUrl = "http://$host:${getMappedPort(httpPort)}", + httpsUrl = "https://$host:${getMappedPort(httpsPort)}", ) } } @@ -31,7 +32,7 @@ public object Testcontainer { start() } }) { - "http://$containerIpAddress:${getMappedPort(internalPort)}" + "http://$host:${getMappedPort(internalPort)}" } } @@ -62,4 +63,3 @@ private class HttpBinContainer( withExposedPorts(internalPort) } } -