diff --git a/.github/workflows/deployment-ci.yml b/.github/workflows/deployment-ci.yml index a0a01ee1e7fa..f372fdbf87f5 100644 --- a/.github/workflows/deployment-ci.yml +++ b/.github/workflows/deployment-ci.yml @@ -28,10 +28,10 @@ jobs: with: distribution: temurin java-version: 11 + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v3 - name: Build with Gradle - uses: gradle/gradle-build-action@v2 - with: - arguments: --stacktrace --info build + run: ./gradlew --stacktrace --info build release: name: Publish artifacts runs-on: ubuntu-latest @@ -53,11 +53,9 @@ jobs: with: distribution: temurin java-version: 11 + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v3 - name: Build with Gradle - uses: gradle/gradle-build-action@v2 - with: - arguments: --stacktrace --info build + run: ./gradlew --stacktrace --info build - name: Publish with Gradle - uses: gradle/gradle-build-action@v2 - with: - arguments: --no-parallel -x test publish + run: ./gradlew --no-parallel -x test publish diff --git a/.github/workflows/docs-ci.yml b/.github/workflows/docs-ci.yml index 4a2522ec3f1f..473ab855651f 100644 --- a/.github/workflows/docs-ci.yml +++ b/.github/workflows/docs-ci.yml @@ -24,10 +24,10 @@ jobs: with: distribution: temurin java-version: 11 + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v3 - name: Build docs with Gradle - uses: gradle/gradle-build-action@v2 - with: - arguments: --stacktrace --info dokkaHtmlMultiModule + run: ./gradlew --stacktrace --info dokkaHtmlMultiModule - name: Deploy docs to GitHub Pages uses: JamesIves/github-pages-deploy-action@v4 with: diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml index e58b1ef402f5..b922a432849f 100644 --- a/.github/workflows/gradle-wrapper-validation.yml +++ b/.github/workflows/gradle-wrapper-validation.yml @@ -11,4 +11,4 @@ jobs: steps: - uses: actions/checkout@v4 - name: Validate Gradle Wrapper - uses: gradle/wrapper-validation-action@v1 + uses: gradle/wrapper-validation-action@v2 diff --git a/buildSrc/src/main/kotlin/kord-internal-multiplatform-module.gradle.kts b/buildSrc/src/main/kotlin/kord-internal-multiplatform-module.gradle.kts index bf1d80fd0b61..2ad0bbd272be 100644 --- a/buildSrc/src/main/kotlin/kord-internal-multiplatform-module.gradle.kts +++ b/buildSrc/src/main/kotlin/kord-internal-multiplatform-module.gradle.kts @@ -10,6 +10,7 @@ kotlin { jvm() js { nodejs() + useCommonJs() } jvmToolchain(Jvm.target) diff --git a/buildSrc/src/main/kotlin/kord-multiplatform-module.gradle.kts b/buildSrc/src/main/kotlin/kord-multiplatform-module.gradle.kts index 8e9837e167c5..f56faf4bc48f 100644 --- a/buildSrc/src/main/kotlin/kord-multiplatform-module.gradle.kts +++ b/buildSrc/src/main/kotlin/kord-multiplatform-module.gradle.kts @@ -28,6 +28,7 @@ kotlin { jvm() js { nodejs() + useCommonJs() } jvmToolchain(Jvm.target) diff --git a/common/api/common.api b/common/api/common.api index 324cfa62fd2d..8512985a5d85 100644 --- a/common/api/common.api +++ b/common/api/common.api @@ -19,9 +19,6 @@ public final class dev/kord/common/ColorKt { public static final fun getKColor (Ljava/awt/Color;)Ldev/kord/common/Color; } -public final class dev/kord/common/ConcurrentHashMapKt { -} - public final class dev/kord/common/DiscordBitSet { public static final field Companion Ldev/kord/common/DiscordBitSet$Companion; public fun ([J)V @@ -9013,9 +9010,6 @@ public abstract class dev/kord/common/exception/RequestException : java/lang/Exc public fun (Ljava/lang/Throwable;)V } -public final class dev/kord/common/http/HttpEngineKt { -} - public abstract class dev/kord/common/ratelimit/AbstractIntervalRateLimiter : dev/kord/common/ratelimit/IntervalRateLimiter { public synthetic fun (IJLkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun consume (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; diff --git a/core/api/core.api b/core/api/core.api index a535d1f6dd6d..37fb9756b77b 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -2160,9 +2160,6 @@ public final class dev/kord/core/builder/kord/KordBuilder : dev/kord/core/builde public final fun setEnableShutdownHook (Z)V } -public final class dev/kord/core/builder/kord/KordBuilderUtilKt { -} - public final class dev/kord/core/builder/kord/KordProxyBuilder : dev/kord/core/builder/kord/RestOnlyBuilder { public fun (Ldev/kord/common/entity/Snowflake;)V public fun getApplicationId ()Ldev/kord/common/entity/Snowflake; diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 8cbdb531e502..454621f95785 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -1,5 +1,3 @@ -import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 - plugins { `kord-multiplatform-module` `kord-publishing` @@ -49,14 +47,4 @@ tasks { dokkaHtmlMultiModule { enabled = false } - compileTestKotlinJvm { - compilerOptions { - // needed to inline MockK functions - jvmTarget = JVM_11 - } - } - jvmTest { - // needed to run the output of compileTestKotlinJvm targeting jvm 11 - javaLauncher = project.javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(11) } - } } diff --git a/gateway/src/commonTest/kotlin/retry/LinearRetryTest.kt b/gateway/src/commonTest/kotlin/retry/LinearRetryTest.kt index a11a53d9f8b4..0cecf0b49c19 100644 --- a/gateway/src/commonTest/kotlin/retry/LinearRetryTest.kt +++ b/gateway/src/commonTest/kotlin/retry/LinearRetryTest.kt @@ -41,6 +41,10 @@ class LinearRetryTest { val end = currentTime val elapsed = (end - start).milliseconds - assertEquals(1000.seconds, elapsed) + // first retry is exactly 1s, retries 2 to 1000 are between 1.000000027s and 1.000027447s, + // kotlinx.coroutines.delay (used by LinearRetry) rounds nanoseconds up to full milliseconds since 1.8.0: + // https://github.com/Kotlin/kotlinx.coroutines/pull/3921 + // -> 1s + 999 * 1.001s = 1000.999s + assertEquals(1000.seconds + 999.milliseconds, elapsed) } } diff --git a/gateway/src/jsMain/kotlin/internal/JsInflater.kt b/gateway/src/jsMain/kotlin/internal/JsInflater.kt index 37941e95f5a0..2d5fa569e611 100644 --- a/gateway/src/jsMain/kotlin/internal/JsInflater.kt +++ b/gateway/src/jsMain/kotlin/internal/JsInflater.kt @@ -1,5 +1,4 @@ @file:JsModule("fast-zlib") -@file:JsNonModule package dev.kord.gateway.internal diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 17b77358e1c2..dc99efa3f121 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,35 +1,35 @@ [versions] # api dependencies -kotlin = "1.9.21" # https://github.com/JetBrains/kotlin -ktor = "2.3.7" # https://github.com/ktorio/ktor -kotlinx-coroutines = "1.7.3" # https://github.com/Kotlin/kotlinx.coroutines -kotlinx-serialization = "1.6.2" # https://github.com/Kotlin/kotlinx.serialization +kotlin = "1.9.22" # https://github.com/JetBrains/kotlin +ktor = "2.3.9" # https://github.com/ktorio/ktor +kotlinx-coroutines = "1.8.0" # https://github.com/Kotlin/kotlinx.coroutines +kotlinx-serialization = "1.6.3" # https://github.com/Kotlin/kotlinx.serialization kotlinx-datetime = "0.5.0" # https://github.com/Kotlin/kotlinx-datetime -kotlin-logging = "6.0.1" # https://github.com/oshai/kotlin-logging -kotlin-logging-old = "3.0.5" # TODO remove after dependency is removed in rest, gateway, voice and core kord-cache = "0.4.0" # https://github.com/kordlib/cache # implementation dependencies -kotlin-node = "18.16.12-pre.619" # https://github.com/JetBrains/kotlin-wrappers -bignum = "0.3.8" # https://github.com/ionspin/kotlin-multiplatform-bignum +kotlin-logging = "6.0.3" # https://github.com/oshai/kotlin-logging +kotlin-logging-old = "3.0.5" # TODO remove after dependency is removed in rest, gateway, voice and core +slf4j = "2.0.12" # https://www.slf4j.org +kotlin-node = "20.11.5-pre.706" # https://github.com/JetBrains/kotlin-wrappers +bignum = "0.3.9" # https://github.com/ionspin/kotlin-multiplatform-bignum stately = "2.0.6" # https://github.com/touchlab/Stately fastZlib = "2.0.1" # https://github.com/timotejroiko/fast-zlib # code generation -ksp = "1.9.21-1.0.16" # https://github.com/google/ksp -kotlinpoet = "1.15.3" # https://github.com/square/kotlinpoet +ksp = "1.9.22-1.0.17" # https://github.com/google/ksp +kotlinpoet = "1.16.0" # https://github.com/square/kotlinpoet # tests -junit5 = "5.10.1" # https://github.com/junit-team/junit5 -mockk = "1.13.8" # https://github.com/mockk/mockk -slf4j = "2.0.9" # https://www.slf4j.org +junit5 = "5.10.2" # https://github.com/junit-team/junit5 +mockk = "1.13.10" # https://github.com/mockk/mockk # plugins -dokka = "1.9.10" # https://github.com/Kotlin/dokka -kotlinx-atomicfu = "0.23.1" # https://github.com/Kotlin/kotlinx-atomicfu -binary-compatibility-validator = "0.13.2" # https://github.com/Kotlin/binary-compatibility-validator -buildconfig = "5.1.0" # https://github.com/gmazzo/gradle-buildconfig-plugin +dokka = "1.9.20" # https://github.com/Kotlin/dokka +kotlinx-atomicfu = "0.23.2" # https://github.com/Kotlin/kotlinx-atomicfu +binary-compatibility-validator = "0.14.0" # https://github.com/Kotlin/binary-compatibility-validator +buildconfig = "5.3.5" # https://github.com/gmazzo/gradle-buildconfig-plugin [libraries] diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index db8c3baafe34..4baf5a11d45a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026 -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionSha256Sum=9631d53cf3e74bfa726893aee1f8994fee4e060c401335946dba2156f440f24c +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew.bat b/gradlew.bat index 93e3f59f135d..25da30dbdeee 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,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 @@ -57,11 +57,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 diff --git a/settings.gradle.kts b/settings.gradle.kts index 2ced0338e2f8..d0ab04959b0c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,6 +1,6 @@ plugins { // https://github.com/gradle/foojay-toolchains - id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0" + id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" } rootProject.name = "kord" diff --git a/test-kit/src/jsMain/kotlin/Platform.node.kt b/test-kit/src/jsMain/kotlin/Platform.node.kt index 0ed68d8e9763..2e53169286e5 100644 --- a/test-kit/src/jsMain/kotlin/Platform.node.kt +++ b/test-kit/src/jsMain/kotlin/Platform.node.kt @@ -1,19 +1,11 @@ package dev.kord.test import io.ktor.utils.io.* -import js.iterable.toList -import node.buffer.Buffer import node.buffer.BufferEncoding +import node.fs.readFile import node.process.process internal suspend fun nodeFile(project: String, path: String): String = - node.fs.readFile("${process.env["PROJECT_ROOT"]}/$project/src/commonTest/resources/$path") - .toString(BufferEncoding.utf8) + readFile("${process.env["PROJECT_ROOT"]}/$project/src/commonTest/resources/$path", BufferEncoding.utf8) -internal suspend fun nodeReadFile(project: String, path: String): ByteReadChannel { - val buffer = node.fs.readFile("${process.env["PROJECT_ROOT"]}/$project/src/commonTest/resources/$path") - - return ByteReadChannel(buffer.toByteArray()) -} - -private fun Buffer.toByteArray() = values().toList().toByteArray() +internal suspend fun nodeReadFile(project: String, path: String) = ByteReadChannel(nodeFile(project, path))