diff --git a/build.gradle.kts b/build.gradle.kts index a57cbff30fa..5acbc04134c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -21,7 +21,7 @@ buildscript { plugins { id("org.jetbrains.kotlin.jvm") version Versions.kotlin - id("org.jetbrains.dokka") version "1.4.0" + id("org.jetbrains.dokka") version "1.4.30" id("org.ajoberstar.git-publish") version "2.1.3" signing @@ -33,7 +33,6 @@ apply(plugin = "binary-compatibility-validator") repositories { mavenCentral() - jcenter() mavenLocal() } @@ -219,7 +218,6 @@ tasks { dokkaHtmlMultiModule.configure { dependsOn(clean) outputDirectory.set(file(dokkaOutputDir)) - documentationFileName.set("DokkaDescription.md") } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 03e1bb944d0..240797827ad 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -11,7 +11,7 @@ repositories { } dependencies { - implementation(kotlin("gradle-plugin-api", version = "1.4.0")) + implementation(kotlin("gradle-plugin-api", version = "1.5.0")) implementation(gradleApi()) implementation(localGroovy()) } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Compiler.kt b/buildSrc/src/main/kotlin/Compiler.kt index 102a1449365..237192819a2 100644 --- a/buildSrc/src/main/kotlin/Compiler.kt +++ b/buildSrc/src/main/kotlin/Compiler.kt @@ -1,5 +1,4 @@ object CompilerArguments { - const val inlineClasses = "-XXLanguage:+InlineClasses" const val coroutines = "-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi" const val time = "-Xopt-in=kotlin.time.ExperimentalTime" const val stdLib = "-Xopt-in=kotlin.ExperimentalStdlibApi" diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index db8f0d25d0a..96c440f0cbf 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -2,9 +2,9 @@ object Versions { const val kotlin = "1.5.0" const val kotlinxSerialization = "1.0.0" const val ktor = "1.5.3" - const val kotlinxCoroutines = "1.4.3" + const val kotlinxCoroutines = "1.5.0-RC" const val kotlinLogging = "2.0.4" - const val atomicFu = "0.15.2" + const val atomicFu = "0.16.1" const val binaryCompatibilityValidator = "0.4.0" //test deps diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 93413505262..24d2dca3bed 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -17,7 +17,6 @@ tasks.withType { kotlinOptions { jvmTarget = Jvm.target freeCompilerArgs = listOf( - CompilerArguments.inlineClasses, CompilerArguments.coroutines, CompilerArguments.time, CompilerArguments.optIn diff --git a/core/build.gradle.kts b/core/build.gradle.kts index c0005177513..00dbed06cd7 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -37,7 +37,6 @@ tasks.withType { kotlinOptions { jvmTarget = Jvm.target freeCompilerArgs = listOf( - CompilerArguments.inlineClasses, CompilerArguments.coroutines, CompilerArguments.time, CompilerArguments.stdLib, diff --git a/core/src/test/kotlin/KordTest.kt b/core/src/test/kotlin/KordTest.kt index a82ed4423b0..1b377e6928c 100644 --- a/core/src/test/kotlin/KordTest.kt +++ b/core/src/test/kotlin/KordTest.kt @@ -12,7 +12,7 @@ import java.util.concurrent.CountDownLatch internal class KordTest { @Test - @OptIn(KordExperimental::class) + @OptIn(KordExperimental::class, kotlinx.coroutines.DelicateCoroutinesApi::class) fun `Kord life cycle is correctly ended on shutdown`() { val kord = Kord.restOnly(System.getenv("KORD_TEST_TOKEN")) val lock = CountDownLatch(1) diff --git a/gateway/build.gradle.kts b/gateway/build.gradle.kts index a0ab67a0fb0..28b7028a7c2 100644 --- a/gateway/build.gradle.kts +++ b/gateway/build.gradle.kts @@ -27,7 +27,6 @@ tasks.withType { kotlinOptions { jvmTarget = Jvm.target freeCompilerArgs = listOf( - CompilerArguments.inlineClasses, CompilerArguments.coroutines, CompilerArguments.time, CompilerArguments.optIn diff --git a/gateway/src/main/kotlin/DefaultGateway.kt b/gateway/src/main/kotlin/DefaultGateway.kt index 61ece591a80..b9813834ade 100644 --- a/gateway/src/main/kotlin/DefaultGateway.kt +++ b/gateway/src/main/kotlin/DefaultGateway.kt @@ -59,7 +59,6 @@ data class DefaultGatewayData( /** * The default Gateway implementation of Kord, using an [HttpClient] for the underlying webSocket */ -@ObsoleteCoroutinesApi class DefaultGateway(private val data: DefaultGatewayData) : Gateway { override val coroutineContext: CoroutineContext = data.dispatcher + SupervisorJob() diff --git a/gateway/src/main/kotlin/handler/HeartbeatHandler.kt b/gateway/src/main/kotlin/handler/HeartbeatHandler.kt index 0f057a9738c..6e85bcdef94 100644 --- a/gateway/src/main/kotlin/handler/HeartbeatHandler.kt +++ b/gateway/src/main/kotlin/handler/HeartbeatHandler.kt @@ -5,9 +5,11 @@ import kotlinx.atomicfu.atomic import kotlinx.atomicfu.update import kotlinx.coroutines.ObsoleteCoroutinesApi import kotlinx.coroutines.flow.Flow -import kotlin.time.* +import kotlin.time.Duration +import kotlin.time.TimeMark +import kotlin.time.TimeSource -@ObsoleteCoroutinesApi +@OptIn(ObsoleteCoroutinesApi::class) internal class HeartbeatHandler( flow: Flow, private val send: suspend (Command) -> Unit, diff --git a/gateway/src/samples/kotlin/EventListener.kt b/gateway/src/samples/kotlin/EventListener.kt index 3497ac46fea..be089651b22 100644 --- a/gateway/src/samples/kotlin/EventListener.kt +++ b/gateway/src/samples/kotlin/EventListener.kt @@ -2,23 +2,21 @@ import dev.kord.common.entity.* import dev.kord.common.ratelimit.BucketRateLimiter import dev.kord.gateway.* import dev.kord.gateway.retry.LinearRetry -import io.ktor.client.HttpClient -import io.ktor.client.engine.cio.CIO -import io.ktor.client.features.json.JsonFeature +import io.ktor.client.* +import io.ktor.client.engine.cio.* +import io.ktor.client.features.json.* import io.ktor.client.features.json.serializer.* -import io.ktor.client.features.websocket.WebSockets -import io.ktor.util.KtorExperimentalAPI +import io.ktor.client.features.websocket.* import kotlinx.coroutines.* import kotlinx.coroutines.flow.filterIsInstance import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import kotlinx.serialization.json.Json -import java.time.Duration +import kotlin.time.Duration import kotlin.time.ExperimentalTime -import kotlin.time.seconds -import kotlin.time.toKotlinDuration +@OptIn(DelicateCoroutinesApi::class) @FlowPreview @ExperimentalTime @ExperimentalCoroutinesApi @@ -34,8 +32,8 @@ suspend fun main(args: Array) { } } - reconnectRetry = LinearRetry(2.seconds, 20.seconds, 10) - sendRateLimiter = BucketRateLimiter(120, Duration.ofSeconds(60).toKotlinDuration()) + reconnectRetry = LinearRetry(Duration.seconds(2), Duration.seconds(20), 10) + sendRateLimiter = BucketRateLimiter(120, Duration.seconds(60)) } gateway.events.filterIsInstance().flowOn(Dispatchers.Default).onEach { @@ -59,7 +57,7 @@ suspend fun main(args: Array) { afk = false, activities = listOf( DiscordBotActivity( - "Ping is ${gateway.ping.value?.toLongMilliseconds()}", + "Ping is ${gateway.ping.value?.inWholeMilliseconds}", ActivityType.Game ) ), diff --git a/gateway/src/test/kotlin/gateway/DefaultGatewayTest.kt b/gateway/src/test/kotlin/gateway/DefaultGatewayTest.kt index d5b4ed6c261..db73b1898ab 100644 --- a/gateway/src/test/kotlin/gateway/DefaultGatewayTest.kt +++ b/gateway/src/test/kotlin/gateway/DefaultGatewayTest.kt @@ -30,6 +30,7 @@ import kotlin.time.toKotlinDuration @ObsoleteCoroutinesApi @ExperimentalCoroutinesApi class DefaultGatewayTest { + @OptIn(DelicateCoroutinesApi::class) @Test @Disabled @ExperimentalTime @@ -57,7 +58,7 @@ class DefaultGatewayTest { "!status" -> when (words.getOrNull(1)) { "playing" -> gateway.send(UpdateStatus(status = PresenceStatus.Online, afk = false, activities = listOf(DiscordBotActivity("Kord", ActivityType.Game)), since = null)) } - "!ping" -> gateway.send(UpdateStatus(status = PresenceStatus.Online, afk = false, activities = listOf(DiscordBotActivity("Ping is ${gateway.ping.value?.toLongMilliseconds()}", ActivityType.Game)), since = null)) + "!ping" -> gateway.send(UpdateStatus(status = PresenceStatus.Online, afk = false, activities = listOf(DiscordBotActivity("Ping is ${gateway.ping.value?.inWholeMilliseconds}", ActivityType.Game)), since = null)) } }.launchIn(GlobalScope) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3758bba6e0e..851d0ca6f70 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ #Tue Dec 31 15:02:18 CET 2019 -distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStorePath=wrapper/dists diff --git a/rest/build.gradle.kts b/rest/build.gradle.kts index 05e21b43a7f..7fa8ed96913 100644 --- a/rest/build.gradle.kts +++ b/rest/build.gradle.kts @@ -28,7 +28,6 @@ tasks.withType { kotlinOptions { jvmTarget = Jvm.target freeCompilerArgs = listOf( - CompilerArguments.inlineClasses, CompilerArguments.coroutines, CompilerArguments.time, CompilerArguments.optIn diff --git a/settings.gradle.kts b/settings.gradle.kts index 5c776ef82f6..cae69e5d4c9 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -8,6 +8,7 @@ pluginManagement { } repositories { mavenLocal() + mavenCentral() maven(url = "https://dl.bintray.com/kotlin/kotlin-dev") gradlePluginPortal() }