Skip to content

Commit

Permalink
Merge branch 'main' into feature/native
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/deployment-ci.yml
#	.github/workflows/docs-ci.yml
#	.github/workflows/gradle-wrapper-validation.yml
#	buildSrc/src/main/kotlin/kord-multiplatform-module.gradle.kts
#	gradle/libs.versions.toml
  • Loading branch information
lukellmann committed Mar 4, 2024
2 parents 19c809f + 5f9294c commit 1200bd6
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ kotlin {
jvm()
js {
nodejs()
useCommonJs()
}
jvmToolchain(Jvm.target)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ kotlin {
if (name != "voice" && name != "core-voice") {
js {
nodejs()
useCommonJs()
}
}
jvmToolchain(Jvm.target)
Expand Down
6 changes: 0 additions & 6 deletions common/api/common.api
Original file line number Diff line number Diff line change
Expand Up @@ -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 <init> ([J)V
Expand Down Expand Up @@ -9013,9 +9010,6 @@ public abstract class dev/kord/common/exception/RequestException : java/lang/Exc
public fun <init> (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 <init> (IJLkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun consume (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
Expand Down
3 changes: 0 additions & 3 deletions core/api/core.api
Original file line number Diff line number Diff line change
Expand Up @@ -2159,9 +2159,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 <init> (Ldev/kord/common/entity/Snowflake;)V
public fun getApplicationId ()Ldev/kord/common/entity/Snowflake;
Expand Down
12 changes: 0 additions & 12 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11

plugins {
`kord-native-module`
`kord-multiplatform-module`
Expand Down Expand Up @@ -52,14 +50,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) }
}
}
6 changes: 5 additions & 1 deletion gateway/src/commonTest/kotlin/retry/LinearRetryTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
1 change: 0 additions & 1 deletion gateway/src/jsMain/kotlin/internal/JsInflater.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@file:JsModule("fast-zlib")
@file:JsNonModule

package dev.kord.gateway.internal

Expand Down
32 changes: 17 additions & 15 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,35 @@
# api dependencies
kotlin = "1.9.22" # https://github.com/JetBrains/kotlin
ktor = "3.0.0-beta-1" # 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
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
kord-cache = "0.5.0-20240130.022209-2" # 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
sodium = "0.9.0" # https://github.com/ionspin/kotlin-multiplatform-libsodium

# code generation
ksp = "1.9.22-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.11" # https://www.slf4j.org
kotlinx-io = "0.3.0" # https://github.com/Kotlin/kotlinx-io/
junit5 = "5.10.2" # https://github.com/junit-team/junit5
mockk = "1.13.10" # https://github.com/mockk/mockk
kotlinx-io = "0.3.0" # https://github.com/Kotlin/kotlinx-io

# 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]
Expand Down Expand Up @@ -95,6 +96,7 @@ ksp-plugin = { module = "com.google.devtools.ksp:symbol-processing-gradle-plugin
kord-gradle-plugin = { module = "dev.kord:gradle-tools", version = "1.3.0" }
maven-publish-plugin = { module = "com.vanniktech:gradle-maven-publish-plugin", version = "0.27.0" }


[bundles]

ktor-client-serialization = ["ktor-client-content-negotiation", "ktor-serialization-kotlinx-json"]
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
14 changes: 3 additions & 11 deletions test-kit/src/jsMain/kotlin/Platform.node.kt
Original file line number Diff line number Diff line change
@@ -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))

0 comments on commit 1200bd6

Please sign in to comment.