Skip to content

Commit 8a9f4a5

Browse files
authored
Update kotlin to 1.9.10 (#3761)
* Fix mingwX64 compilation * Update kotlin to 1.9.10 * Fix CallLogging tests * Fix js compilation
1 parent ed3392d commit 8a9f4a5

File tree

13 files changed

+58
-38
lines changed

13 files changed

+58
-38
lines changed

buildSrc/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ sourceSets.main {
2424
val ktor_version = "2.3.3"
2525

2626
dependencies {
27-
implementation(kotlin("gradle-plugin", "1.9.0"))
28-
implementation(kotlin("serialization", "1.9.0"))
27+
implementation(kotlin("gradle-plugin", "1.9.10"))
28+
implementation(kotlin("serialization", "1.9.10"))
2929

3030
val ktlint_version = libs.versions.ktlint.version.get()
3131
implementation("org.jmailen.gradle:kotlinter-gradle:$ktlint_version")

buildSrc/src/main/kotlin/CommonConfig.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ import org.gradle.kotlin.dsl.*
77
fun Project.configureCommon() {
88
kotlin {
99
sourceSets {
10-
val commonMain by getting {
10+
commonMain {
1111
dependencies {
1212
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.coroutines}")
1313
}
1414
}
1515

16-
val commonTest by getting {
16+
commonTest {
1717
dependencies {
1818
implementation(kotlin("test"))
1919
}

buildSrc/src/main/kotlin/JsConfig.kt

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,24 @@ private fun Project.configureJsTasks() {
2727
kotlin {
2828
js(IR) {
2929
nodejs {
30-
testTask {
31-
useMocha {
32-
timeout = "10000"
30+
testTask(
31+
Action {
32+
useMocha {
33+
timeout = "10000"
34+
}
3335
}
34-
}
36+
)
3537
}
3638

3739
browser {
38-
testTask {
39-
useKarma {
40-
useChromeHeadless()
41-
useConfigDirectory(File(project.rootProject.projectDir, "karma"))
40+
testTask(
41+
Action {
42+
useKarma {
43+
useChromeHeadless()
44+
useConfigDirectory(File(project.rootProject.projectDir, "karma"))
45+
}
4246
}
43-
}
47+
)
4448
}
4549

4650
binaries.library()

buildSrc/src/main/kotlin/KotlinExtensions.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ fun KotlinMultiplatformExtension.createCInterop(
2727
}
2828
}
2929

30+
fun NamedDomainObjectContainer<KotlinSourceSet>.commonMain(block: KotlinSourceSet.() -> Unit) {
31+
val sourceSet = getByName("commonMain")
32+
block(sourceSet)
33+
}
34+
35+
fun NamedDomainObjectContainer<KotlinSourceSet>.commonTest(block: KotlinSourceSet.() -> Unit) {
36+
val sourceSet = getByName("commonTest")
37+
block(sourceSet)
38+
}
39+
3040
fun NamedDomainObjectContainer<KotlinSourceSet>.jvmAndNixMain(block: KotlinSourceSet.() -> Unit) {
3141
val sourceSet = findByName("jvmAndNixMain") ?: getByName("jvmMain")
3242
block(sourceSet)

buildSrc/src/main/kotlin/Versions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
object Versions {
6-
val kotlin = "1.9.0"
6+
val kotlin = "1.9.10"
77
val coroutines = "1.7.2"
88
val slf4j = "1.7.36"
99
val junit = "4.13.2"

buildSrc/src/main/kotlin/test/server/ServerUtils.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ fun List<PartData>.makeString(): String = buildString {
2929
}
3030
}
3131

32+
@Suppress("DEPRECATION")
3233
private fun filenameContentTypeAndContentString(provider: () -> Input, headers: Headers): String {
3334
val dispositionHeader: String = headers.getAll(HttpHeaders.ContentDisposition)!!.joinToString(";")
3435
val disposition: ContentDisposition = ContentDisposition.parse(dispositionHeader)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/plugins/ServerSentEventsTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import kotlinx.coroutines.*
1414
import kotlinx.coroutines.flow.*
1515
import kotlin.test.*
1616

17-
class ServerSentEventsTest : ClientLoader() {
17+
class ServerSentEventsTest : ClientLoader(timeoutSeconds = 120) {
1818

1919
@Test
2020
fun testExceptionIfSseIsNotInstalled() = testSuspend {

ktor-client/ktor-client-winhttp/windows/src/io/ktor/client/engine/winhttp/WinHttpClientEngine.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import io.ktor.client.request.*
1313
import io.ktor.util.date.*
1414
import io.ktor.utils.io.*
1515
import kotlinx.coroutines.*
16+
import kotlin.coroutines.*
1617

1718
internal class WinHttpClientEngine(
1819
override val config: WinHttpClientEngineConfig
@@ -30,6 +31,8 @@ internal class WinHttpClientEngine(
3031
}
3132
}
3233

34+
override fun toString(): String = "WinHttp"
35+
3336
@OptIn(InternalAPI::class)
3437
override suspend fun execute(data: HttpRequestData): HttpResponseData {
3538
val callContext = callContext()

ktor-io/posix/src/io/ktor/utils/io/locks/Synchronized.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import io.ktor.utils.io.*
88
import io.ktor.utils.io.interop.mutex.*
99
import kotlinx.cinterop.*
1010
import platform.posix.*
11+
import kotlin.concurrent.AtomicNativePtr
12+
import kotlin.concurrent.AtomicReference
1113
import kotlin.native.concurrent.*
1214
import kotlin.native.internal.NativePtr
1315

ktor-server/ktor-server-plugins/ktor-server-call-logging/jvm/test/io/ktor/server/plugins/callloging/CallLoggingTest.kt

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -73,26 +73,26 @@ class CallLoggingTest {
7373
testApplication {
7474
environment { environment() }
7575
application {
76-
hash = this.toString()
76+
hash = hashCode().toString(radix = 16)
7777
}
7878
}
7979

8080
assertTrue(messages.size >= 3, "It should be at least 3 message logged:\n$messages")
81-
assertEquals(
82-
"INFO: Application started: $hash",
83-
messages[messages.size - 3],
84-
"No started message logged:\n$messages"
85-
)
86-
assertEquals(
87-
"INFO: Application stopping: $hash",
88-
messages[messages.size - 2],
89-
"No stopping message logged:\n$messages"
90-
)
91-
assertEquals(
92-
"INFO: Application stopped: $hash",
93-
messages[messages.size - 1],
94-
"No stopped message logged:\n$messages"
95-
)
81+
assertTrue {
82+
messages[messages.size - 3].startsWith(
83+
"INFO: Application started: class io.ktor.server.application.Application(0x$hash)"
84+
)
85+
}
86+
assertTrue {
87+
messages[messages.size - 2].startsWith(
88+
"INFO: Application stopping: class io.ktor.server.application.Application(0x$hash)"
89+
)
90+
}
91+
assertTrue {
92+
messages[messages.size - 1].startsWith(
93+
"INFO: Application stopped: class io.ktor.server.application.Application(0x$hash)"
94+
)
95+
}
9696
}
9797

9898
@Test
@@ -374,7 +374,7 @@ class CallLoggingTest {
374374
}
375375
}
376376
}
377-
var hash: String? = null
377+
lateinit var hash: String
378378

379379
testApplication {
380380
environment {
@@ -385,11 +385,11 @@ class CallLoggingTest {
385385
}
386386
}
387387
}
388-
application { hash = this.toString() }
388+
application { hash = hashCode().toString(radix = 16) }
389389
}
390390

391391
assertTrue(customMessages.isNotEmpty())
392-
assertTrue(customMessages.all { it.startsWith("CUSTOM TRACE:") && it.contains(hash!!) })
392+
assertTrue(customMessages.all { it.startsWith("CUSTOM TRACE:") && it.contains(hash) })
393393
assertTrue(messages.isEmpty())
394394
}
395395

ktor-server/ktor-server-plugins/ktor-server-jte/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
kotlin.sourceSets {
66
val jteVersion = "2.3.2"
7-
val jvmMain by getting {
7+
jvmMain {
88
dependencies {
99
api("gg.jte:jte:$jteVersion")
1010
}
1111
}
12-
val jvmTest by getting {
12+
jvmTest {
1313
dependencies {
1414
api(project(":ktor-server:ktor-server-plugins:ktor-server-status-pages"))
1515
api(project(":ktor-server:ktor-server-plugins:ktor-server-compression"))

ktor-utils/common/src/io/ktor/util/pipeline/Pipeline.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public open class Pipeline<TSubject : Any, TContext : Any>(
248248
val interceptors = interceptorsForTests()
249249
.joinToString("\n") { " " + it::class.toString() }
250250

251-
return "${this::class.simpleName} [\n$interceptors\n]"
251+
return "${this::class}(0x${hashCode().toString(16)}) [\n$interceptors\n]"
252252
}
253253

254254
internal fun phaseInterceptors(phase: PipelinePhase): List<PipelineInterceptorFunction<TSubject, TContext>> =

0 commit comments

Comments
 (0)