From 68151da564eb32009a6a1878cccdde1f9b9e025e Mon Sep 17 00:00:00 2001 From: Michael Rittmeister Date: Sun, 17 Apr 2022 17:44:04 +0200 Subject: [PATCH] Update to ktor 2.0.0 --- .gitignore | 4 +- .idea/compiler.xml | 5 +++ build.gradle.kts | 2 +- buildSrc/build.gradle.kts | 8 ++-- core/build.gradle.kts | 3 +- .../audio/internal/AbstractLavakord.kt | 12 +++--- .../lavakord/audio/internal/NodeImpl.kt | 18 ++++---- .../audio/internal/WebsocketPlayer.kt | 1 + .../schlaubi/lavakord/audio/player/Track.kt | 1 - .../lavakord/rest/InternalLinkExtensions.kt | 9 +++- .../rest/LinkRoutePlannerExtensions.kt | 3 +- .../lavakord/rest/LinkTrackExtensions.kt | 3 +- .../kotlin/rest/RoutePlannerTest.kt | 2 +- example/src/main/java/Javakord.java | 17 ++++---- java/build.gradle.kts | 2 +- .../schlaubi/lavakord/interop/JavaPlayer.kt | 4 +- jda/build.gradle.kts | 2 +- kotlin-js-store/yarn.lock | 43 ++++++++++++------- settings.gradle.kts | 41 +++++++++--------- 19 files changed, 105 insertions(+), 75 deletions(-) diff --git a/.gitignore b/.gitignore index 69190762..c4af036e 100644 --- a/.gitignore +++ b/.gitignore @@ -131,4 +131,6 @@ gradle-app.setting ## Docs are only supposed to be there on gh-pages branch or on CI runners docs/ -!docs/index.html \ No newline at end of file +!docs/index.html + +.idea/artifacts diff --git a/.idea/compiler.xml b/.idea/compiler.xml index b589d56e..32d94a6b 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -3,4 +3,9 @@ + + + \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 5ec49bf1..3d24f90e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,7 @@ plugins { } group = "dev.schlaubi.lavakord" -version = "3.5.1" +version = "3.6.0" allprojects { repositories { diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 84088295..51c93de5 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -12,10 +12,10 @@ repositories { } dependencies { - implementation(kotlin("gradle-plugin", version = "1.6.10")) - implementation(kotlin("serialization", version = "1.6.10")) - implementation("org.jetbrains.dokka", "dokka-gradle-plugin", "1.6.10") - implementation(kotlin("gradle-plugin-api", version = "1.6.10")) + implementation(kotlin("gradle-plugin", version = "1.6.20")) + implementation(kotlin("serialization", version = "1.6.20")) + implementation("org.jetbrains.dokka", "dokka-gradle-plugin", "1.6.20") + implementation(kotlin("gradle-plugin-api", version = "1.6.20")) implementation(gradleApi()) implementation(localGroovy()) } diff --git a/core/build.gradle.kts b/core/build.gradle.kts index e0abeb2a..2e729ca7 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -20,7 +20,8 @@ kotlin { implementation(libs.ktor.utils) implementation(libs.ktor.client.websockets) implementation(libs.ktor.client.core) - implementation(libs.ktor.client.serialization) + implementation(libs.ktor.serialization.kotlinx.json) + implementation(libs.ktor.client.content.negotiation) implementation(libs.ktor.client.logging) implementation(libs.kotlinlogging) diff --git a/core/src/commonMain/kotlin/dev/schlaubi/lavakord/audio/internal/AbstractLavakord.kt b/core/src/commonMain/kotlin/dev/schlaubi/lavakord/audio/internal/AbstractLavakord.kt index e4f0b8ba..aaf83bdf 100644 --- a/core/src/commonMain/kotlin/dev/schlaubi/lavakord/audio/internal/AbstractLavakord.kt +++ b/core/src/commonMain/kotlin/dev/schlaubi/lavakord/audio/internal/AbstractLavakord.kt @@ -12,11 +12,11 @@ import dev.schlaubi.lavakord.internal.RestNodeImpl import dev.schlaubi.lavakord.rest.RoutePlannerModule import io.ktor.client.* import io.ktor.client.engine.* -import io.ktor.client.features.json.* -import io.ktor.client.features.json.serializer.* -import io.ktor.client.features.logging.* -import io.ktor.client.features.websocket.* +import io.ktor.client.plugins.contentnegotiation.* +import io.ktor.client.plugins.logging.* +import io.ktor.client.plugins.websocket.* import io.ktor.http.* +import io.ktor.serialization.kotlinx.json.* import kotlinx.atomicfu.atomic import kotlinx.coroutines.launch import kotlinx.serialization.modules.plus @@ -57,8 +57,8 @@ public abstract class AbstractLavakord internal constructor( internal val restClient = HttpClient(httpClientEngine) { - install(JsonFeature) { - serializer = KotlinxSerializer(json) + install(ContentNegotiation) { + json(json) } install(Logging) { diff --git a/core/src/commonMain/kotlin/dev/schlaubi/lavakord/audio/internal/NodeImpl.kt b/core/src/commonMain/kotlin/dev/schlaubi/lavakord/audio/internal/NodeImpl.kt index 0efaf124..a43b019f 100644 --- a/core/src/commonMain/kotlin/dev/schlaubi/lavakord/audio/internal/NodeImpl.kt +++ b/core/src/commonMain/kotlin/dev/schlaubi/lavakord/audio/internal/NodeImpl.kt @@ -1,15 +1,18 @@ package dev.schlaubi.lavakord.audio.internal import dev.schlaubi.lavakord.audio.* -import io.ktor.client.features.* -import io.ktor.client.features.websocket.* +import io.ktor.client.network.sockets.* +import io.ktor.client.plugins.* +import io.ktor.client.plugins.websocket.* import io.ktor.client.request.* import io.ktor.http.* -import io.ktor.http.cio.websocket.* -import io.ktor.network.sockets.* -import kotlinx.coroutines.* +import io.ktor.websocket.* +import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.channels.Channel -import kotlinx.coroutines.flow.* +import kotlinx.coroutines.flow.MutableSharedFlow +import kotlinx.coroutines.flow.SharedFlow +import kotlinx.coroutines.flow.asSharedFlow +import kotlinx.coroutines.launch import kotlinx.serialization.SerializationException import kotlinx.serialization.decodeFromString import kotlinx.serialization.encodeToString @@ -17,7 +20,6 @@ import mu.KotlinLogging internal val LOG = KotlinLogging.logger { } -@OptIn(ExperimentalCoroutinesApi::class) internal class NodeImpl( override val host: Url, override val name: String, @@ -37,11 +39,9 @@ internal class NodeImpl( override val coroutineScope: CoroutineScope get() = lavakord - @OptIn(FlowPreview::class) override val events: SharedFlow get() = eventPublisher.asSharedFlow() - @OptIn(InternalCoroutinesApi::class) internal suspend fun connect(resume: Boolean = false) { session = try { lavakord.gatewayClient.webSocketSession { diff --git a/core/src/commonMain/kotlin/dev/schlaubi/lavakord/audio/internal/WebsocketPlayer.kt b/core/src/commonMain/kotlin/dev/schlaubi/lavakord/audio/internal/WebsocketPlayer.kt index 4fc11056..28072b8e 100644 --- a/core/src/commonMain/kotlin/dev/schlaubi/lavakord/audio/internal/WebsocketPlayer.kt +++ b/core/src/commonMain/kotlin/dev/schlaubi/lavakord/audio/internal/WebsocketPlayer.kt @@ -93,6 +93,7 @@ internal class WebsocketPlayer(internal val node: NodeImpl, internal val guildId node.send(GatewayPayload.SeekCommand(guildId.toString(), position)) } + @Deprecated("Please use the new filters system to specify volume") override suspend fun setVolume(volume: Int) { require(volume >= 0) { "Volume can't be negative" } require(volume <= 500) { "Volume can't be greater than 500" } // Volume <= 5.0 diff --git a/core/src/commonMain/kotlin/dev/schlaubi/lavakord/audio/player/Track.kt b/core/src/commonMain/kotlin/dev/schlaubi/lavakord/audio/player/Track.kt index ac2aba45..dd45646b 100644 --- a/core/src/commonMain/kotlin/dev/schlaubi/lavakord/audio/player/Track.kt +++ b/core/src/commonMain/kotlin/dev/schlaubi/lavakord/audio/player/Track.kt @@ -40,7 +40,6 @@ public data class Track constructor( * * @see Track.track */ - @OptIn(InternalAPI::class) @Suppress("ReplaceNotNullAssertionWithElvisReturn") public suspend fun fromLavalink(encoded: String): Track { val bytes = encoded.decodeBase64Bytes() diff --git a/core/src/commonMain/kotlin/dev/schlaubi/lavakord/rest/InternalLinkExtensions.kt b/core/src/commonMain/kotlin/dev/schlaubi/lavakord/rest/InternalLinkExtensions.kt index 0aab9a48..cf63885b 100644 --- a/core/src/commonMain/kotlin/dev/schlaubi/lavakord/rest/InternalLinkExtensions.kt +++ b/core/src/commonMain/kotlin/dev/schlaubi/lavakord/rest/InternalLinkExtensions.kt @@ -3,18 +3,23 @@ package dev.schlaubi.lavakord.rest import dev.schlaubi.lavakord.audio.RestNode import dev.schlaubi.lavakord.audio.internal.AbstractLavakord import io.ktor.client.* +import io.ktor.client.call.* import io.ktor.client.request.* import io.ktor.http.* import kotlinx.serialization.json.Json internal suspend inline fun RestNode.get(noinline urlBuilder: URLBuilder.() -> Unit): T = - restClient.get(buildUrl(urlBuilder).build()) { addHeader(this@get); accept(ContentType.Application.JavaScript) } + restClient.get(buildUrl(urlBuilder).build()) { + addHeader(this@get); accept(ContentType.Application.JavaScript) + }.body() internal suspend inline fun RestNode.post( urlBuilder: URLBuilder, block: HttpRequestBuilder.() -> Unit ) = - restClient.get(urlBuilder.build()) { addHeader(this@post); accept(ContentType.Application.JavaScript); block(this) } + restClient.get(urlBuilder.build()) { + addHeader(this@post); accept(ContentType.Application.JavaScript); block(this) + }.body() private fun HttpRequestBuilder.addHeader(socket: RestNode) { header(HttpHeaders.Authorization, socket.authenticationHeader) diff --git a/core/src/commonMain/kotlin/dev/schlaubi/lavakord/rest/LinkRoutePlannerExtensions.kt b/core/src/commonMain/kotlin/dev/schlaubi/lavakord/rest/LinkRoutePlannerExtensions.kt index bd16f3d0..7a13e10a 100644 --- a/core/src/commonMain/kotlin/dev/schlaubi/lavakord/rest/LinkRoutePlannerExtensions.kt +++ b/core/src/commonMain/kotlin/dev/schlaubi/lavakord/rest/LinkRoutePlannerExtensions.kt @@ -4,6 +4,7 @@ import dev.schlaubi.lavakord.NoRoutePlannerException import dev.schlaubi.lavakord.audio.Link import dev.schlaubi.lavakord.audio.Node import dev.schlaubi.lavakord.audio.RestNode +import io.ktor.client.request.* import io.ktor.http.* import kotlinx.serialization.Serializable import kotlinx.serialization.SerializationException @@ -89,7 +90,7 @@ public suspend fun RestNode.unmarkAddress(address: String) { return post(url) { contentType(ContentType.Application.Json) - body = UnmarkAddressBody(address) + setBody(UnmarkAddressBody(address)) } } diff --git a/core/src/commonMain/kotlin/dev/schlaubi/lavakord/rest/LinkTrackExtensions.kt b/core/src/commonMain/kotlin/dev/schlaubi/lavakord/rest/LinkTrackExtensions.kt index dc34aee2..b81df131 100644 --- a/core/src/commonMain/kotlin/dev/schlaubi/lavakord/rest/LinkTrackExtensions.kt +++ b/core/src/commonMain/kotlin/dev/schlaubi/lavakord/rest/LinkTrackExtensions.kt @@ -4,7 +4,7 @@ import dev.schlaubi.lavakord.audio.Link import dev.schlaubi.lavakord.audio.Node import dev.schlaubi.lavakord.audio.RestNode import dev.schlaubi.lavakord.audio.player.Track -import io.ktor.util.* +import io.ktor.http.* /** * Maps a [List] of [TrackResponse.PartialTrack]s to a List of [Track]s. @@ -30,7 +30,6 @@ public suspend fun Link.loadItem(query: String): TrackResponse = node.loadItem(q * * @see TrackResponse */ -@OptIn(InternalAPI::class) // There is no other way for parameters public suspend fun RestNode.loadItem(query: String): TrackResponse = get { path("loadtracks") parameters.append("identifier", query) diff --git a/core/src/commonTest/kotlin/rest/RoutePlannerTest.kt b/core/src/commonTest/kotlin/rest/RoutePlannerTest.kt index 8908d758..86fc513e 100644 --- a/core/src/commonTest/kotlin/rest/RoutePlannerTest.kt +++ b/core/src/commonTest/kotlin/rest/RoutePlannerTest.kt @@ -28,7 +28,7 @@ class RoutePlannerTest { private val engine = RestHttpEngine { addHandler { request -> checkAuth(request) { - when (request.url.fullPath.substringAfter('/').substringBefore('?')) { + when (request.url.fullPath) { "/routeplanner/free/all" -> respond("", HttpStatusCode.NoContent) "/routeplanner/free/address" -> { val body = request.body.toByteArray().decodeToString() diff --git a/example/src/main/java/Javakord.java b/example/src/main/java/Javakord.java index e1a6b307..8dbf19f2 100644 --- a/example/src/main/java/Javakord.java +++ b/example/src/main/java/Javakord.java @@ -3,10 +3,10 @@ import dev.schlaubi.lavakord.interop.TrackUtil; import dev.schlaubi.lavakord.interop.jda.LavakordJDABuilder; import net.dv8tion.jda.api.JDABuilder; -import net.dv8tion.jda.api.events.interaction.SlashCommandEvent; +import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent; import net.dv8tion.jda.api.hooks.ListenerAdapter; import net.dv8tion.jda.api.interactions.commands.OptionType; -import net.dv8tion.jda.api.interactions.commands.build.CommandData; +import net.dv8tion.jda.api.interactions.commands.build.Commands; import org.jetbrains.annotations.NotNull; public class Javakord extends ListenerAdapter { @@ -27,17 +27,17 @@ public Javakord() { var jda = container.getJda(); jda.updateCommands() .addCommands( - new CommandData("connect", "Joins the current channel"), - new CommandData("play", "Plays a new song") + Commands.slash("connect", "Joins the current channel"), + Commands.slash("play", "Plays a new song") .addOption(OptionType.STRING, "query", "The query you want to play"), - new CommandData("destroy", "Let the bot leave the channel"), - new CommandData("pause", "Pauses or unpauses playpack") + Commands.slash("destroy", "Let the bot leave the channel"), + Commands.slash("pause", "Pauses or unpauses playpack") ) .queue(); } @Override - public void onSlashCommand(@NotNull SlashCommandEvent event) { + public void onSlashCommandInteraction(@NotNull SlashCommandInteractionEvent event) { var invoke = event.getName(); var link = lavakord.getLink(event.getGuild().getIdLong()); var player = link.getPlayer(); @@ -61,7 +61,8 @@ public void onSlashCommand(@NotNull SlashCommandEvent event) { case TRACK_LOADED -> player.playTrack(track.getTrack()); case PLAYLIST_LOADED, SEARCH_RESULT -> player.playTrack(track.getTracks().get(0)); case NO_MATCHES -> event.getChannel().sendMessage("No tracks found!").queue(); - case LOAD_FAILED -> event.getChannel().sendMessage("Load failed: %s".formatted(track.getException().getMessage())).queue(); + case LOAD_FAILED -> + event.getChannel().sendMessage("Load failed: %s".formatted(track.getException().getMessage())).queue(); } }); } diff --git a/java/build.gradle.kts b/java/build.gradle.kts index ce2b70b3..3316f14b 100644 --- a/java/build.gradle.kts +++ b/java/build.gradle.kts @@ -20,7 +20,7 @@ kotlin { dependencies { api(projects.core) api(projects.jda) - api("net.dv8tion:JDA:5.0.0-alpha.4") { + api("net.dv8tion:JDA:5.0.0-alpha.5") { exclude(module = "opus-java") } implementation(libs.kotlinx.coroutines.jdk8) diff --git a/java/src/jvmMain/kotlin/dev/schlaubi/lavakord/interop/JavaPlayer.kt b/java/src/jvmMain/kotlin/dev/schlaubi/lavakord/interop/JavaPlayer.kt index 45860eb0..c196cc05 100644 --- a/java/src/jvmMain/kotlin/dev/schlaubi/lavakord/interop/JavaPlayer.kt +++ b/java/src/jvmMain/kotlin/dev/schlaubi/lavakord/interop/JavaPlayer.kt @@ -71,7 +71,7 @@ public class JavaPlayer(internal val suspendingPlayer: Player) : CoroutineScope /** * Seeks to a specific [position] in the current playback. */ - public suspend fun seekTo(position: Duration): CompletableFuture = seekTo(position.toMillis()) + public fun seekTo(position: Duration): CompletableFuture = seekTo(position.toMillis()) /** * Seeks to a specific [position] in the current playback. @@ -83,6 +83,8 @@ public class JavaPlayer(internal val suspendingPlayer: Player) : CoroutineScope /** * Changes the volume of the current player. */ + @Suppress("DeprecatedCallableAddReplaceWith", "DEPRECATION") + @Deprecated("Please use the new filters system to specify volume") public fun setVolume(volume: Int): CompletableFuture = run { suspendingPlayer.setVolume(volume) } /** diff --git a/jda/build.gradle.kts b/jda/build.gradle.kts index f4c9f9c5..001f4d67 100644 --- a/jda/build.gradle.kts +++ b/jda/build.gradle.kts @@ -15,7 +15,7 @@ kotlin { api(projects.core) api(libs.kotlinlogging) api(libs.kotlinx.coroutines.jdk8) - implementation("net.dv8tion:JDA:5.0.0-alpha.4") { + implementation("net.dv8tion:JDA:5.0.0-alpha.5") { exclude(module = "opus-java") } } diff --git a/kotlin-js-store/yarn.lock b/kotlin-js-store/yarn.lock index 9e218a84..c3a05527 100644 --- a/kotlin-js-store/yarn.lock +++ b/kotlin-js-store/yarn.lock @@ -49,11 +49,6 @@ argparse@^2.0.1: resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== -async-limiter@~1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" - integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== - balanced-match@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" @@ -398,10 +393,12 @@ nanoid@3.1.25: resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.25.tgz#09ca32747c0e543f0e1814b7d3793477f9c8e152" integrity sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q== -node-fetch@2.6.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" - integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== +node-fetch@2.6.7: + version "2.6.7" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" + integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== + dependencies: + whatwg-url "^5.0.0" normalize-path@^3.0.0, normalize-path@~3.0.0: version "3.0.0" @@ -530,11 +527,29 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= + typescript@3.9.5: version "3.9.5" resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.5.tgz#586f0dba300cde8be52dd1ac4f7e1009c1b13f36" integrity sha512-hSAifV3k+i6lEoCJ2k6R2Z/rp/H3+8sdmcn5NrS3/3kE7+RyZXm9aqvxWqjEXHAd8b0pShatpcdMTvEdvAJltQ== +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= + +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0= + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + which@2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" @@ -561,12 +576,10 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -ws@6.2.1: - version "6.2.1" - resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.1.tgz#442fdf0a47ed64f59b6a5d8ff130f4748ed524fb" - integrity sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA== - dependencies: - async-limiter "~1.0.0" +ws@8.5.0: + version "8.5.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f" + integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg== y18n@^5.0.5: version "5.0.8" diff --git a/settings.gradle.kts b/settings.gradle.kts index 4d20d326..aabccd44 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -31,32 +31,33 @@ dependencyResolutionManagement { create("libs") { kotlinx() ktor() - alias("kord-core").to("dev.kord", "kord-core").version("0.8.x-SNAPSHOT") - alias("junit-jupiter-engine").to("org.junit.jupiter", "junit-jupiter-engine").version("5.8.2") - alias("kotlinlogging").to("io.github.microutils", "kotlin-logging").version("2.1.21") - alias("sl4fj-simple").to("org.slf4j", "slf4j-simple").version("1.7.30") + library("kord-core", "dev.kord", "kord-core").version("0.8.0-M13") + library("junit-jupiter-engine", "org.junit.jupiter", "junit-jupiter-engine").version("5.8.2") + library("kotlinlogging", "io.github.microutils", "kotlin-logging").version("2.1.21") + library("sl4fj-simple", "org.slf4j", "slf4j-simple").version("1.7.30") } } } fun VersionCatalogBuilder.kotlinx() { - val coroutines = version("coroutines", "1.6.0") - alias("kotlinx-coroutines-core").to("org.jetbrains.kotlinx", "kotlinx-coroutines-core").versionRef(coroutines) - alias("kotlinx-coroutines-jdk8").to("org.jetbrains.kotlinx", "kotlinx-coroutines-jdk8").versionRef(coroutines) - alias("kotlinx-coroutines-test").to("org.jetbrains.kotlinx", "kotlinx-coroutines-test").versionRef(coroutines) - alias("kotlinx-serialization-json").to("org.jetbrains.kotlinx", "kotlinx-serialization-json").version("1.3.2") - alias("kotlinx-datetime").to("org.jetbrains.kotlinx", "kotlinx-datetime").version("0.3.2") + val coroutines = version("coroutines", "1.6.1") + library("kotlinx-coroutines-core", "org.jetbrains.kotlinx", "kotlinx-coroutines-core").versionRef(coroutines) + library("kotlinx-coroutines-jdk8", "org.jetbrains.kotlinx", "kotlinx-coroutines-jdk8").versionRef(coroutines) + library("kotlinx-coroutines-test", "org.jetbrains.kotlinx", "kotlinx-coroutines-test").versionRef(coroutines) + library("kotlinx-serialization-json", "org.jetbrains.kotlinx", "kotlinx-serialization-json").version("1.3.2") + library("kotlinx-datetime", "org.jetbrains.kotlinx", "kotlinx-datetime").version("0.3.2") } fun VersionCatalogBuilder.ktor() { - val ktor = version("ktor", "1.6.7") - alias("ktor-io").to("io.ktor", "ktor-io").versionRef(ktor) - alias("ktor-utils").to("io.ktor", "ktor-utils").versionRef(ktor) - alias("ktor-client-websockets").to("io.ktor", "ktor-client-websockets").versionRef(ktor) - alias("ktor-client-core").to("io.ktor", "ktor-client-core").versionRef(ktor) - alias("ktor-client-serialization").to("io.ktor", "ktor-client-serialization").versionRef(ktor) - alias("ktor-client-logging").to("io.ktor", "ktor-client-logging").versionRef(ktor) - alias("ktor-client-cio").to("io.ktor", "ktor-client-cio").versionRef(ktor) - alias("ktor-client-js").to("io.ktor", "ktor-client-js").versionRef(ktor) - alias("ktor-client-mock").to("io.ktor", "ktor-client-mock").versionRef(ktor) + val ktor = version("ktor", "2.0.0") + library("ktor-io", "io.ktor", "ktor-io").versionRef(ktor) + library("ktor-utils", "io.ktor", "ktor-utils").versionRef(ktor) + library("ktor-client-websockets", "io.ktor", "ktor-client-websockets").versionRef(ktor) + library("ktor-client-core", "io.ktor", "ktor-client-core").versionRef(ktor) + library("ktor-serialization-kotlinx-json", "io.ktor", "ktor-serialization-kotlinx-json").versionRef(ktor) + library("ktor-client-content-negotiation", "io.ktor", "ktor-client-content-negotiation").versionRef(ktor) + library("ktor-client-logging", "io.ktor", "ktor-client-logging").versionRef(ktor) + library("ktor-client-cio", "io.ktor", "ktor-client-cio").versionRef(ktor) + library("ktor-client-js", "io.ktor", "ktor-client-js").versionRef(ktor) + library("ktor-client-mock", "io.ktor", "ktor-client-mock").versionRef(ktor) }