diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c5f0ee6..1e9c20c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,10 +15,10 @@ jobs: runs-on: ${{ github.repository == 'stainless-sdks/knock-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@v6 with: distribution: temurin java-version: | @@ -27,7 +27,7 @@ jobs: cache: gradle - name: Set up Gradle - uses: gradle/actions/setup-gradle@v4 + uses: gradle/actions/setup-gradle@v6 - name: Run lints run: ./scripts/lint @@ -36,10 +36,10 @@ jobs: name: test runs-on: ${{ github.repository == 'stainless-sdks/knock-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@v6 with: distribution: temurin java-version: | @@ -48,7 +48,7 @@ jobs: cache: gradle - name: Set up Gradle - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v6 - name: Run tests run: ./scripts/test diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml index bc7ecefd..5c493fc9 100644 --- a/.github/workflows/publish-sonatype.yml +++ b/.github/workflows/publish-sonatype.yml @@ -14,19 +14,19 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: Set up Java - uses: actions/setup-java@v3 + uses: actions/setup-java@v6 with: distribution: temurin java-version: | 8 - 17 + 21 cache: gradle - name: Set up Gradle - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v6 - name: Publish to Sonatype run: |- diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 3f0b91ce..d5cb8dac 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -12,7 +12,7 @@ jobs: if: github.repository == 'knocklabs/knock-java' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: Check release environment run: | diff --git a/MIGRATION.md b/MIGRATION.md index 9e2c1bba..2f474d97 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -102,6 +102,15 @@ BulkAddSubscriptionsParams.Subscription.builder() `ScheduleCreateParams.repeats()` returns `Optional>`, because a schedule can be created with only `scheduled_at`. +### Dependency updates + +The SDK still supports Java 8, but its dependencies have moved to their current major versions: + +- **OkHttp 5.** `knock-java-client-okhttp` (and so `knock-java`) now depends on OkHttp 5.5.0, via the `com.squareup.okhttp3:okhttp-jvm` artifact. OkHttp 5 is binary compatible with OkHttp 4 for most uses. If your build pins `com.squareup.okhttp3:okhttp` to 4.x, remove the pin or move it to 5.x. In Maven, depend on `okhttp-jvm` rather than `okhttp`, because the `okhttp` artifact is empty in OkHttp 5. +- **Kotlin.** The SDK is compiled with language and API version 2.2 and depends on `kotlin-stdlib` 2.2 or later (OkHttp 5 already requires `kotlin-stdlib` 2.x). Java projects aren't affected beyond the newer transitive `kotlin-stdlib`. Kotlin projects need the Kotlin 2.1 compiler or later. +- **Jackson.** The default Jackson version is 2.22.3. The minimum supported version is still 2.13.4. +- **Apache HttpClient.** The transitive `httpclient5` and `httpcore5` versions are 5.6.4 and 5.4.4. + ## New functionality - `workflowRecipientRuns()` with `list` and `get` diff --git a/README.md b/README.md index 33b30d4d..b5c542b8 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ implementation("app.knock.api:knock-java:1.0.0") ## Requirements -This library requires Java 8 or later. +This library requires Java 8 or later. Kotlin projects need Kotlin 2.1 or later. ## Usage @@ -323,7 +323,7 @@ $ export KNOCK_LOG=debug ## Jackson -The SDK depends on [Jackson](https://github.com/FasterXML/jackson) for JSON serialization/deserialization. It is compatible with version 2.13.4 or higher, but depends on version 2.18.2 by default. +The SDK depends on [Jackson](https://github.com/FasterXML/jackson) for JSON serialization/deserialization. It is compatible with version 2.13.4 or higher, but depends on version 2.22.3 by default. The SDK throws an exception if it detects an incompatible Jackson version at runtime (e.g. if the default version was overridden in your Maven or Gradle config). @@ -426,7 +426,7 @@ The SDK consists of three artifacts: This structure allows replacing the SDK's default HTTP client without pulling in unnecessary dependencies. -#### Customized [`OkHttpClient`](https://square.github.io/okhttp/3.x/okhttp/okhttp3/OkHttpClient.html) +#### Customized [`OkHttpClient`](https://javadoc.io/doc/com.squareup.okhttp3/okhttp-jvm/latest/okhttp3/OkHttpClient.html) > [!TIP] > Try the available [network options](#network-options) before replacing the default client. diff --git a/build.gradle.kts b/build.gradle.kts index b19b5516..382bbb72 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("org.jetbrains.dokka") version "2.0.0" + id("org.jetbrains.dokka-javadoc") version "2.2.0" apply false } repositories { @@ -9,15 +9,23 @@ repositories { allprojects { group = "app.knock.api" version = "1.0.0" // x-release-please-version -} -subprojects { - apply(plugin = "org.jetbrains.dokka") + // Dokka's isolated build-tool classpaths otherwise resolve Jackson and jsoup versions with known + // vulnerabilities. This doesn't affect the SDK's published or test dependencies. + configurations.matching { it.name.startsWith("dokka") }.configureEach { + resolutionStrategy.eachDependency { + if (requested.group == "com.fasterxml.jackson" || requested.group.startsWith("com.fasterxml.jackson.")) { + // Jackson annotations uses a two-component version starting with 2.20. + useVersion(if (requested.name == "jackson-annotations") "2.22" else "2.22.3") + because("Dokka's build-only Jackson classpath must use a secure aligned release") + } else if (requested.group == "org.jsoup" && requested.name == "jsoup") { + useVersion("1.23.2") + because("Dokka's build-only jsoup classpath must use a secure release") + } + } + } } -// Avoid race conditions between `dokkaJavadocCollector` and `dokkaJavadocJar` tasks -tasks.named("dokkaJavadocCollector").configure { - subprojects.flatMap { it.tasks } - .filter { it.project.name != "knock-java" && it.name == "dokkaJavadocJar" } - .forEach { mustRunAfter(it) } +subprojects { + apply(plugin = "org.jetbrains.dokka-javadoc") } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 778c89de..a87d00f1 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,7 +1,6 @@ plugins { `kotlin-dsl` - kotlin("jvm") version "1.9.20" - id("com.vanniktech.maven.publish") version "0.28.0" + id("com.vanniktech.maven.publish") version "0.37.0" } repositories { @@ -10,7 +9,7 @@ repositories { } dependencies { - implementation("com.diffplug.spotless:spotless-plugin-gradle:7.0.2") - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20") - implementation("com.vanniktech:gradle-maven-publish-plugin:0.28.0") + implementation("com.diffplug.spotless:spotless-plugin-gradle:8.10.3") + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.4.20") + implementation("com.vanniktech:gradle-maven-publish-plugin:0.37.0") } diff --git a/buildSrc/src/main/kotlin/knock.java.gradle.kts b/buildSrc/src/main/kotlin/knock.java.gradle.kts index dfbacb86..8f5e81ff 100644 --- a/buildSrc/src/main/kotlin/knock.java.gradle.kts +++ b/buildSrc/src/main/kotlin/knock.java.gradle.kts @@ -33,6 +33,11 @@ tasks.withType().configureEach { options.release.set(8) } +// Test-only dependencies (JUnit 6, WireMock 3) require a newer JVM. Published artifacts still target Java 8. +tasks.named("compileTestJava") { + options.release.set(17) +} + tasks.named("jar") { manifest { attributes(mapOf( diff --git a/buildSrc/src/main/kotlin/knock.kotlin.gradle.kts b/buildSrc/src/main/kotlin/knock.kotlin.gradle.kts index 3f079128..d083d921 100644 --- a/buildSrc/src/main/kotlin/knock.kotlin.gradle.kts +++ b/buildSrc/src/main/kotlin/knock.kotlin.gradle.kts @@ -1,6 +1,8 @@ import com.diffplug.gradle.spotless.SpotlessExtension +import org.jetbrains.kotlin.gradle.dsl.JvmDefaultMode import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.dsl.KotlinVersion +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { id("knock.java") @@ -14,22 +16,31 @@ kotlin { compilerOptions { freeCompilerArgs = listOf( - "-Xjvm-default=all", "-Xjdk-release=1.8", // Suppress deprecation warnings because we may still reference and test deprecated members. - // TODO: Replace with `-Xsuppress-warning=DEPRECATION` once we use Kotlin compiler 2.1.0+. - "-nowarn", + "-Xwarning-level=DEPRECATION:disabled", + // Generated `validity()` implementations call `toInt()` on values that are already `Int`. + "-Xwarning-level=REDUNDANT_CALL_OF_CONVERSION_METHOD:disabled", ) jvmTarget.set(JvmTarget.JVM_1_8) - languageVersion.set(KotlinVersion.KOTLIN_1_8) - apiVersion.set(KotlinVersion.KOTLIN_1_8) - coreLibrariesVersion = "1.8.0" + jvmDefault.set(JvmDefaultMode.NO_COMPATIBILITY) + languageVersion.set(KotlinVersion.KOTLIN_2_2) + apiVersion.set(KotlinVersion.KOTLIN_2_2) + coreLibrariesVersion = "2.2.0" + } +} + +tasks.named("compileTestKotlin") { + compilerOptions { + freeCompilerArgs = freeCompilerArgs.get().map { if (it == "-Xjdk-release=1.8") "-Xjdk-release=17" else it } + jvmTarget.set(JvmTarget.JVM_17) } } configure { kotlin { - ktfmt().kotlinlangStyle() + // Match the ktfmt version used to format generated code to avoid formatting churn. + ktfmt("0.61").kotlinlangStyle() toggleOffOn() } } diff --git a/buildSrc/src/main/kotlin/knock.publish.gradle.kts b/buildSrc/src/main/kotlin/knock.publish.gradle.kts index d9b68306..2e8ac122 100644 --- a/buildSrc/src/main/kotlin/knock.publish.gradle.kts +++ b/buildSrc/src/main/kotlin/knock.publish.gradle.kts @@ -1,7 +1,8 @@ import com.vanniktech.maven.publish.JavadocJar import com.vanniktech.maven.publish.KotlinJvm import com.vanniktech.maven.publish.MavenPublishBaseExtension -import com.vanniktech.maven.publish.SonatypeHost +import com.vanniktech.maven.publish.SourcesJar +import org.gradle.plugins.signing.SigningExtension plugins { id("com.vanniktech.maven.publish") @@ -12,19 +13,22 @@ repositories { mavenCentral() } -extra["signingInMemoryKey"] = System.getenv("GPG_SIGNING_KEY") -extra["signingInMemoryKeyId"] = System.getenv("GPG_SIGNING_KEY_ID") -extra["signingInMemoryKeyPassword"] = System.getenv("GPG_SIGNING_PASSWORD") - configure { signAllPublications() - publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) + configure { + useInMemoryPgpKeys( + System.getenv("GPG_SIGNING_KEY_ID"), + System.getenv("GPG_SIGNING_KEY"), + System.getenv("GPG_SIGNING_PASSWORD"), + ) + } + publishToMavenCentral() coordinates(project.group.toString(), project.name, project.version.toString()) configure( KotlinJvm( - javadocJar = JavadocJar.Dokka("dokkaJavadoc"), - sourcesJar = true, + javadocJar = JavadocJar.Dokka("dokkaGeneratePublicationJavadoc"), + sourcesJar = SourcesJar.Sources(), ) ) diff --git a/gradle.properties b/gradle.properties index ff76593f..c8e4fa33 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,6 +2,8 @@ org.gradle.caching=true org.gradle.configuration-cache=true org.gradle.parallel=true org.gradle.daemon=false +org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled +org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true # These options improve our compilation and test performance. They are inherited by the Kotlin daemon. org.gradle.jvmargs=\ -Xms1g \ diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index a4b76b95..5097068a 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 cea7a793..9b7cb4af 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,9 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.0-bin.zip networkTimeout=10000 +retries=0 +retryBackOffMs=500 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index f3b75f3b..249efbb0 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. @@ -20,7 +20,7 @@ ############################################################################## # -# Gradle start up script for POSIX generated by Gradle. +# gradlew start up script for POSIX generated by Gradle. # # Important for running: # @@ -29,7 +29,7 @@ # bash, then to run this script, type that shell name before the whole # command line, like: # -# ksh Gradle +# ksh gradlew # # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: @@ -57,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/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/. @@ -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. @@ -172,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" ) @@ -205,15 +203,14 @@ fi DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# * 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 9d21a218..3185a43f 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -19,12 +19,39 @@ @if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem -@rem Gradle startup script for Windows +@rem gradlew startup script for Windows @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 + +@rem Catch executions from older scripts and ensure they exit cleanly. +@rem This can be removed once we can be reasonably confident that few people +@rem will be migrating directly to this new wrapper. +goto afterSafetyNet +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +goto exitWithErrorLevel +:afterSafetyNet set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @@ -45,13 +72,14 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -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 +1>&2 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. -goto fail +"%COMSPEC%" /c exit 1 +goto exitWithErrorLevel :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -59,36 +87,26 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -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 +1>&2 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. -goto fail +"%COMSPEC%" /c exit 1 +goto exitWithErrorLevel :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 %* +@rem Execute gradlew +@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 & goto exitWithErrorLevel -: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 - -:omega +@rem This label must not be changed. We rely on old scripts being able to jump to this point. +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/knock-java-client-okhttp/build.gradle.kts b/knock-java-client-okhttp/build.gradle.kts index b9be04b8..597117b9 100644 --- a/knock-java-client-okhttp/build.gradle.kts +++ b/knock-java-client-okhttp/build.gradle.kts @@ -6,9 +6,9 @@ plugins { dependencies { api(project(":knock-java-core")) - implementation("com.squareup.okhttp3:okhttp:4.12.0") - implementation("com.squareup.okhttp3:logging-interceptor:4.12.0") + implementation("com.squareup.okhttp3:okhttp-jvm:5.5.0") + implementation("com.squareup.okhttp3:logging-interceptor:5.5.0") testImplementation(kotlin("test")) - testImplementation("org.assertj:assertj-core:3.25.3") + testImplementation("org.assertj:assertj-core:3.27.7") } diff --git a/knock-java-core/build.gradle.kts b/knock-java-core/build.gradle.kts index b142bbfd..733c2c18 100644 --- a/knock-java-core/build.gradle.kts +++ b/knock-java-core/build.gradle.kts @@ -17,25 +17,25 @@ configurations.all { } dependencies { - api("com.fasterxml.jackson.core:jackson-core:2.18.2") - api("com.fasterxml.jackson.core:jackson-databind:2.18.2") - api("com.google.errorprone:error_prone_annotations:2.33.0") + api("com.fasterxml.jackson.core:jackson-core:2.22.3") + api("com.fasterxml.jackson.core:jackson-databind:2.22.3") + api("com.google.errorprone:error_prone_annotations:2.50.0") - implementation("com.fasterxml.jackson.core:jackson-annotations:2.18.2") - implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.18.2") - implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.2") - implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.2") - implementation("org.apache.httpcomponents.core5:httpcore5:5.2.4") - implementation("org.apache.httpcomponents.client5:httpclient5:5.3.1") + implementation("com.fasterxml.jackson.core:jackson-annotations:2.22") + implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.22.3") + implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.22.3") + implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.22.3") + implementation("org.apache.httpcomponents.core5:httpcore5:5.4.4") + implementation("org.apache.httpcomponents.client5:httpclient5:5.6.4") testImplementation(kotlin("test")) testImplementation(project(":knock-java-client-okhttp")) - testImplementation("com.github.tomakehurst:wiremock-jre8:2.35.2") - testImplementation("org.assertj:assertj-core:3.25.3") - testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.3") - testImplementation("org.junit.jupiter:junit-jupiter-params:5.9.3") - testImplementation("org.junit-pioneer:junit-pioneer:1.9.1") - testImplementation("org.mockito:mockito-core:5.14.2") - testImplementation("org.mockito:mockito-junit-jupiter:5.14.2") - testImplementation("org.mockito.kotlin:mockito-kotlin:4.1.0") + testImplementation("org.wiremock:wiremock-standalone:3.13.2") + testImplementation("org.assertj:assertj-core:3.27.7") + testImplementation("org.junit.jupiter:junit-jupiter-api:6.1.3") + testImplementation("org.junit.jupiter:junit-jupiter-params:6.1.3") + testImplementation("org.junit-pioneer:junit-pioneer:2.3.0") + testImplementation("org.mockito:mockito-core:5.24.0") + testImplementation("org.mockito:mockito-junit-jupiter:5.24.0") + testImplementation("org.mockito.kotlin:mockito-kotlin:6.4.0") } diff --git a/knock-java-core/src/test/kotlin/app/knock/api/TestServerExtension.kt b/knock-java-core/src/test/kotlin/app/knock/api/TestServerExtension.kt index 1e667214..e70ab4ee 100644 --- a/knock-java-core/src/test/kotlin/app/knock/api/TestServerExtension.kt +++ b/knock-java-core/src/test/kotlin/app/knock/api/TestServerExtension.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.extension.ExtensionContext class TestServerExtension : BeforeAllCallback, ExecutionCondition { - override fun beforeAll(context: ExtensionContext?) { + override fun beforeAll(context: ExtensionContext) { try { URL(BASE_URL).openConnection().connect() } catch (e: Exception) { diff --git a/knock-java-core/src/test/kotlin/app/knock/api/core/ObjectMappersTest.kt b/knock-java-core/src/test/kotlin/app/knock/api/core/ObjectMappersTest.kt index a8b91d68..75f1e3a2 100644 --- a/knock-java-core/src/test/kotlin/app/knock/api/core/ObjectMappersTest.kt +++ b/knock-java-core/src/test/kotlin/app/knock/api/core/ObjectMappersTest.kt @@ -29,7 +29,7 @@ internal class ObjectMappersTest { assertThat(json).isEqualTo("{\"is_active\":true}") } - internal class Class(@get:JsonProperty("field") @JsonProperty("field") val field: String) + internal class Class(@get:JsonProperty("field") @param:JsonProperty("field") val field: String) enum class ShapeTestCase(val value: Any, val kClass: KClass<*>) { STRING("Hello World!", String::class), diff --git a/knock-java/build.gradle.kts b/knock-java/build.gradle.kts index 11d153b9..1436524a 100644 --- a/knock-java/build.gradle.kts +++ b/knock-java/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.dokka.gradle.DokkaExtension + plugins { id("knock.kotlin") id("knock.publish") @@ -7,23 +9,13 @@ dependencies { api(project(":knock-java-client-okhttp")) } -// Redefine `dokkaJavadoc` to: -// - Depend on the root project's task for merging the docs of all the projects -// - Forward that task's output to this task's output -tasks.named("dokkaJavadoc").configure { - actions.clear() - - val dokkaJavadocCollector = rootProject.tasks["dokkaJavadocCollector"] - dependsOn(dokkaJavadocCollector) - - val outputDirectory = project.layout.buildDirectory.dir("dokka/javadoc") - doLast { - copy { - from(dokkaJavadocCollector.outputs.files) - into(outputDirectory) - duplicatesStrategy = DuplicatesStrategy.INCLUDE - } +// Dokka's Javadoc format doesn't support multi-module aggregation, so document the sources of all the +// projects in this project's Javadoc directly. +configure { + dokkaSourceSets.named("main") { + sourceRoots.from( + project(":knock-java-core").layout.projectDirectory.dir("src/main/kotlin"), + project(":knock-java-client-okhttp").layout.projectDirectory.dir("src/main/kotlin"), + ) } - - outputs.dir(outputDirectory) }