Skip to content

Commit

Permalink
Update Kotlin to 2.1.0-dev-7621
Browse files Browse the repository at this point in the history
Because of KT-52469 [1] Kord.getGlobalApplicationCommandOf,
Kord.getGlobalApplicationCommandOfOrNull and VoiceState.getChannelOrNull
had to be changed and their behavior was fixed.

KSP doesn't have a published version that works with Kotlin
2.1.0-dev-7621 yet, so I used a locally built KSP published to the local
Maven repository.

[1] https://youtrack.jetbrains.com/issue/KT-52469
  • Loading branch information
lukellmann committed Sep 19, 2024
1 parent 530920d commit 7161262
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 9 deletions.
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ plugins {

repositories {
mavenCentral()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap")
mavenLocal()
}

group = Library.group
Expand Down
2 changes: 2 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ plugins {

repositories {
mavenCentral()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap")
mavenLocal()
}

kotlin {
Expand Down
2 changes: 2 additions & 0 deletions buildSrc/src/main/kotlin/kord-internal-module.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ plugins {

repositories {
mavenCentral()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap")
mavenLocal()
}

kotlin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ plugins {

repositories {
mavenCentral()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap")
mavenLocal()
}

@OptIn(ExperimentalKotlinGradlePluginApi::class)
Expand Down
2 changes: 2 additions & 0 deletions buildSrc/src/main/kotlin/kord-module.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ plugins {

repositories {
mavenCentral()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap")
mavenLocal()
}

dependencies {
Expand Down
2 changes: 2 additions & 0 deletions buildSrc/src/main/kotlin/kord-multiplatform-module.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ plugins {

repositories {
mavenCentral()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap")
mavenLocal()
}

dependencies {
Expand Down
4 changes: 2 additions & 2 deletions core/api/core.api
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public final class dev/kord/core/Kord : kotlinx/coroutines/CoroutineScope {
public final fun getEvents ()Lkotlinx/coroutines/flow/SharedFlow;
public final fun getGateway ()Ldev/kord/core/gateway/MasterGateway;
public final fun getGlobalApplicationCommand (Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun getGlobalApplicationCommandOf (Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun getGlobalApplicationCommandOfOrNull (Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final synthetic fun getGlobalApplicationCommandOf (Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final synthetic fun getGlobalApplicationCommandOfOrNull (Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun getGlobalApplicationCommandOrNull (Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun getGlobalApplicationCommands (Ljava/lang/Boolean;)Lkotlinx/coroutines/flow/Flow;
public static synthetic fun getGlobalApplicationCommands$default (Ldev/kord/core/Kord;Ljava/lang/Boolean;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
Expand Down
2 changes: 2 additions & 0 deletions core/api/core.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -11698,6 +11698,8 @@ final class dev.kord.core/Kord : kotlinx.coroutines/CoroutineScope { // dev.kord
final suspend fun getWebhookWithTokenOrNull(dev.kord.common.entity/Snowflake, kotlin/String, dev.kord.core.supplier/EntitySupplyStrategy<*> = ...): dev.kord.core.entity/Webhook? // dev.kord.core/Kord.getWebhookWithTokenOrNull|getWebhookWithTokenOrNull(dev.kord.common.entity.Snowflake;kotlin.String;dev.kord.core.supplier.EntitySupplyStrategy<*>){}[0]
final suspend fun logout() // dev.kord.core/Kord.logout|logout(){}[0]
final suspend fun shutdown() // dev.kord.core/Kord.shutdown|shutdown(){}[0]
final suspend inline fun <#A1: reified dev.kord.core.entity.application/GlobalApplicationCommand> getGlobalApplicationCommandOf(dev.kord.common.entity/Snowflake): #A1 // dev.kord.core/Kord.getGlobalApplicationCommandOf|getGlobalApplicationCommandOf(dev.kord.common.entity.Snowflake){0§<dev.kord.core.entity.application.GlobalApplicationCommand>}[0]
final suspend inline fun <#A1: reified dev.kord.core.entity.application/GlobalApplicationCommand> getGlobalApplicationCommandOfOrNull(dev.kord.common.entity/Snowflake): #A1? // dev.kord.core/Kord.getGlobalApplicationCommandOfOrNull|getGlobalApplicationCommandOfOrNull(dev.kord.common.entity.Snowflake){0§<dev.kord.core.entity.application.GlobalApplicationCommand>}[0]
final suspend inline fun <#A1: reified dev.kord.core.entity.application/GuildApplicationCommand> getGuildApplicationCommandOf(dev.kord.common.entity/Snowflake, dev.kord.common.entity/Snowflake): #A1 // dev.kord.core/Kord.getGuildApplicationCommandOf|getGuildApplicationCommandOf(dev.kord.common.entity.Snowflake;dev.kord.common.entity.Snowflake){0§<dev.kord.core.entity.application.GuildApplicationCommand>}[0]
final suspend inline fun <#A1: reified dev.kord.core.entity.application/GuildApplicationCommand> getGuildApplicationCommandOfOrNull(dev.kord.common.entity/Snowflake, dev.kord.common.entity/Snowflake): #A1? // dev.kord.core/Kord.getGuildApplicationCommandOfOrNull|getGuildApplicationCommandOfOrNull(dev.kord.common.entity.Snowflake;dev.kord.common.entity.Snowflake){0§<dev.kord.core.entity.application.GuildApplicationCommand>}[0]
final suspend inline fun <#A1: reified dev.kord.core.entity.channel/Channel> getChannelOf(dev.kord.common.entity/Snowflake, dev.kord.core.supplier/EntitySupplyStrategy<*> = ...): #A1? // dev.kord.core/Kord.getChannelOf|getChannelOf(dev.kord.common.entity.Snowflake;dev.kord.core.supplier.EntitySupplyStrategy<*>){0§<dev.kord.core.entity.channel.Channel>}[0]
Expand Down
31 changes: 31 additions & 0 deletions core/src/commonMain/kotlin/Kord.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import kotlinx.coroutines.flow.*
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
import kotlin.coroutines.CoroutineContext
import kotlin.jvm.JvmName
import kotlinx.coroutines.channels.Channel as CoroutineChannel

@Deprecated("Use your own logger instead. This declaration will be removed in 0.16.0.", level = DeprecationLevel.HIDDEN)
Expand Down Expand Up @@ -501,16 +502,46 @@ public class Kord(
}


@Suppress("TYPE_INTERSECTION_AS_REIFIED_WARNING")
@Deprecated(
"This function has bad semantics: the type argument for T is effectively ignored. It no longer compiles " +
"without a 'TYPE_INTERSECTION_AS_REIFIED_WARNING' (https://youtrack.jetbrains.com/issue/KT-52469). " +
"The replacement function has a proper bounded reified type parameter that is actually used. This " +
"declaration is kept for binary compatibility, it will be removed in 0.18.0. The replacement function " +
"should then be migrated away from using @JvmName.",
level = DeprecationLevel.HIDDEN,
)
public suspend fun <T> getGlobalApplicationCommandOf(commandId: Snowflake): T {
return defaultSupplier.getGlobalApplicationCommandOf(resources.applicationId, commandId)
}


@Suppress("TYPE_INTERSECTION_AS_REIFIED_WARNING")
@Deprecated(
"This function has bad semantics: the type argument for T is effectively ignored. It no longer compiles " +
"without a 'TYPE_INTERSECTION_AS_REIFIED_WARNING' (https://youtrack.jetbrains.com/issue/KT-52469). " +
"The replacement function has a proper bounded reified type parameter that is actually used. This " +
"declaration is kept for binary compatibility, it will be removed in 0.18.0. The replacement function " +
"should then be migrated away from using @JvmName.",
level = DeprecationLevel.HIDDEN,
)
public suspend fun <T> getGlobalApplicationCommandOfOrNull(commandId: Snowflake): T? {
return defaultSupplier.getGlobalApplicationCommandOfOrNull(resources.applicationId, commandId)
}


@JvmName("getGlobalApplicationCommandOfJvmInlineReplacement")
public suspend inline fun <reified T : GlobalApplicationCommand> getGlobalApplicationCommandOf(
commandId: Snowflake,
): T = defaultSupplier.getGlobalApplicationCommandOf(resources.applicationId, commandId)


@JvmName("getGlobalApplicationCommandOfOrNullJvmInlineReplacement")
public suspend inline fun <reified T : GlobalApplicationCommand> getGlobalApplicationCommandOfOrNull(
commandId: Snowflake,
): T? = defaultSupplier.getGlobalApplicationCommandOfOrNull(resources.applicationId, commandId)


public suspend inline fun createGlobalChatInputCommand(
name: String,
description: String,
Expand Down
3 changes: 2 additions & 1 deletion core/src/commonMain/kotlin/entity/VoiceState.kt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public class VoiceState(
*
* @throws [RequestException] if anything went wrong during the request.
*/
public suspend fun getChannelOrNull(): BaseVoiceChannelBehavior? = channelId?.let { supplier.getChannelOfOrNull(it) }
public suspend fun getChannelOrNull(): BaseVoiceChannelBehavior? =
channelId?.let { supplier.getChannelOrNull(it) as? BaseVoiceChannelBehavior }


/**
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]

# api dependencies
kotlin = "2.1.0-Beta1" # https://github.com/JetBrains/kotlin
kotlin = "2.1.0-dev-7621" # https://github.com/JetBrains/kotlin
ktor = "2.3.12" # https://github.com/ktorio/ktor
kotlinx-coroutines = "1.8.1" # https://github.com/Kotlin/kotlinx.coroutines
kotlinx-serialization = "1.7.2" # https://github.com/Kotlin/kotlinx.serialization
Expand All @@ -18,7 +18,7 @@ stately = "2.1.0" # https://github.com/touchlab/Stately
fastZlib = "2.0.1" # https://github.com/timotejroiko/fast-zlib

# code generation
ksp = "2.0.20-1.0.24" # https://github.com/google/ksp
ksp = "2.0.255-SNAPSHOT" # https://github.com/google/ksp
kotlinpoet = "1.18.1" # https://github.com/square/kotlinpoet

# tests
Expand Down
8 changes: 4 additions & 4 deletions kotlin-js-store/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,10 @@ minimatch@^5.0.1, minimatch@^5.1.6:
dependencies:
brace-expansion "^2.0.1"

mocha@10.7.0:
version "10.7.0"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.7.0.tgz#9e5cbed8fa9b37537a25bd1f7fb4f6fc45458b9a"
integrity sha512-v8/rBWr2VO5YkspYINnvu81inSz2y3ODJrhO175/Exzor1RcEZZkizgE2A+w/CAXXoESS8Kys5E62dOHGHzULA==
mocha@10.7.3:
version "10.7.3"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.7.3.tgz#ae32003cabbd52b59aece17846056a68eb4b0752"
integrity sha512-uQWxAu44wwiACGqjbPYmjo7Lg8sFrS3dQe7PP2FQI+woptP4vZXSMcfMyFL/e1yFEeEpV4RtyTpZROOKmxis+A==
dependencies:
ansi-colors "^4.1.3"
browser-stdout "^1.3.1"
Expand Down

0 comments on commit 7161262

Please sign in to comment.