Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Kotlin to 1.9.20 #888

Merged
merged 1 commit into from
Nov 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/Compiler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ object Jvm {
fun KotlinCommonCompilerOptions.applyKordCompilerOptions() {
allWarningsAsErrors = true
progressiveMode = true
freeCompilerArgs.add("-Xexpect-actual-classes")
}

fun KotlinSourceSet.applyKordOptIns() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ repositories {

kotlin {
jvm()
js(IR) {
js {
nodejs()
}
jvmToolchain(Jvm.target)

targets {
all {
compilations.all {
compilerOptions.options.applyKordCompilerOptions()
}
targets.all {
compilations.all {
compilerOptions.options.applyKordCompilerOptions()
}
}
}
1 change: 0 additions & 1 deletion buildSrc/src/main/kotlin/kord-module.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
org.jetbrains.kotlin.jvm
Expand Down
15 changes: 6 additions & 9 deletions buildSrc/src/main/kotlin/kord-multiplatform-module.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ kotlin {
explicitApi()

jvm()
js(IR) {
js {
nodejs()
}
jvmToolchain(Jvm.target)
Expand All @@ -37,6 +37,8 @@ kotlin {
}
}

applyDefaultHierarchyTemplate()

sourceSets {
all {
applyKordOptIns()
Expand All @@ -53,14 +55,9 @@ kotlin {
val nonJvmMain by creating {
dependsOn(commonMain.get())
}
targets
.map { it.name }
.filter { it != "jvm" && it != "metadata" }
.forEach { target ->
sourceSets.getByName("${target}Main") {
dependsOn(nonJvmMain)
}
}
jsMain {
dependsOn(nonJvmMain)
}
}
}

Expand Down
242 changes: 6 additions & 236 deletions common/api/common.api

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion common/src/commonMain/kotlin/ConcurrentHashMap.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ import dev.kord.common.annotation.KordInternal
* @suppress
*/
@KordInternal
public expect class ConcurrentHashMap<K, V>() : MutableMap<K, V>
public expect fun <K, V> concurrentHashMap(): MutableMap<K, V>
2 changes: 1 addition & 1 deletion common/src/commonMain/kotlin/http/HttpEngine.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ import io.ktor.client.engine.*

/** @suppress */
@KordInternal
public expect object HttpEngine : HttpClientEngineFactory<HttpClientEngineConfig>
public expect fun httpEngine(): HttpClientEngineFactory<HttpClientEngineConfig>
3 changes: 2 additions & 1 deletion common/src/jsMain/kotlin/HttpEngine.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package dev.kord.common.http

import dev.kord.common.annotation.KordInternal
import io.ktor.client.engine.*
import io.ktor.client.engine.js.*

/** @suppress */
@KordInternal
public actual typealias HttpEngine = Js
public actual fun httpEngine(): HttpClientEngineFactory<HttpClientEngineConfig> = Js
3 changes: 2 additions & 1 deletion common/src/jvmMain/kotlin/ConcurrentHashMap.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package dev.kord.common

import dev.kord.common.annotation.KordInternal
import java.util.concurrent.ConcurrentHashMap

/** @suppress */
@KordInternal
public actual typealias ConcurrentHashMap<K, V> = java.util.concurrent.ConcurrentHashMap<K, V>
public actual fun <K, V> concurrentHashMap(): MutableMap<K, V> = ConcurrentHashMap()
2 changes: 1 addition & 1 deletion common/src/jvmMain/kotlin/http/HttpEngine.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import io.ktor.client.engine.cio.*

/** @suppress */
@KordInternal
public actual object HttpEngine : HttpClientEngineFactory<HttpClientEngineConfig> by CIO
public actual fun httpEngine(): HttpClientEngineFactory<HttpClientEngineConfig> = CIO
4 changes: 1 addition & 3 deletions common/src/nonJvmMain/kotlin/ConcurrentHashMap.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@ import dev.kord.common.annotation.KordInternal

/** @suppress */
@KordInternal
// using an actual typealias seems to be broken in Kotlin/JS 1.9.0
// public actual typealias ConcurrentHashMap<K, V> = ConcurrentMutableMap<K, V>
public actual class ConcurrentHashMap<K, V> : MutableMap<K, V> by ConcurrentMutableMap()
public actual fun <K, V> concurrentHashMap(): MutableMap<K, V> = ConcurrentMutableMap()
146 changes: 0 additions & 146 deletions core/api/core.api

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ plugins {
kotlin {
js {
nodejs {
testTask(Action {
testTask {
useMocha {
timeout = "10000" // KordEventDropTest is too slow for default 2 seconds timeout
}
})
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/commonMain/kotlin/builder/kord/KordBuilderUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package dev.kord.core.builder.kord

import dev.kord.common.annotation.KordInternal
import dev.kord.common.entity.Snowflake
import dev.kord.common.http.HttpEngine
import dev.kord.common.http.httpEngine
import io.ktor.client.*
import io.ktor.client.plugins.contentnegotiation.*
import io.ktor.client.plugins.websocket.*
Expand Down Expand Up @@ -33,7 +33,7 @@ public fun HttpClient?.configure(): HttpClient {
isLenient = true
}

return HttpClient(HttpEngine) {
return HttpClient(httpEngine()) {
defaultConfig()
install(ContentNegotiation) {
json(json)
Expand Down
4 changes: 2 additions & 2 deletions core/src/commonMain/kotlin/cache/KordCache.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import dev.kord.cache.api.delegate.DelegatingDataCache
import dev.kord.cache.api.delegate.EntrySupplier
import dev.kord.cache.map.MapLikeCollection
import dev.kord.cache.map.internal.MapEntryCache
import dev.kord.common.ConcurrentHashMap
import dev.kord.common.concurrentHashMap
import dev.kord.common.entity.Snowflake
import dev.kord.core.cache.data.*

Expand All @@ -16,7 +16,7 @@ public typealias Generator<I, T> = (cache: DataCache, description: DataDescripti
public class KordCacheBuilder {

/**
* The default behavior for all types not explicitly configured, by default a [ConcurrentHashMap] is supplied.
* The default behavior for all types not explicitly configured, by default a [concurrentHashMap] is supplied.
*/
public var defaultGenerator: Generator<Any, Any> = { cache, description ->
MapEntryCache(cache, description, MapLikeCollection.concurrentHashMap())
Expand Down
Loading