Skip to content

Commit

Permalink
Update kotlin to 1.9.10 (#3761)
Browse files Browse the repository at this point in the history
* Fix mingwX64 compilation

* Update kotlin to 1.9.10

* Fix CallLogging tests

* Fix js compilation

(cherry picked from commit 8a9f4a5)
  • Loading branch information
e5l committed Oct 2, 2023
1 parent 5fd1d2f commit eff0636
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 38 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ apply(from = "gradle/compatibility.gradle")

plugins {
id("org.jetbrains.dokka") version "1.7.20" apply false
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.12.1"
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2"
id("kotlinx-atomicfu") version "0.19.0" apply false
id("com.osacky.doctor") version "0.8.1"
}
Expand Down
8 changes: 4 additions & 4 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
*/

plugins {
id("org.gradle.kotlin.kotlin-dsl") version "3.2.4"
kotlin("plugin.serialization") version "1.7.21"
id("org.gradle.kotlin.kotlin-dsl") version "4.1.0"
kotlin("plugin.serialization") version "1.9.0"
}

val buildSnapshotTrain = properties["build_snapshot_train"]?.toString()?.toBoolean() == true
Expand All @@ -24,8 +24,8 @@ sourceSets.main {
val ktor_version = "2.3.2"

dependencies {
implementation(kotlin("gradle-plugin", "1.8.22"))
implementation(kotlin("serialization", "1.8.22"))
implementation(kotlin("gradle-plugin", "1.9.10"))
implementation(kotlin("serialization", "1.9.10"))

val ktlint_version = libs.versions.ktlint.version.get()
implementation("org.jmailen.gradle:kotlinter-gradle:$ktlint_version")
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/CommonConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ fun Project.configureCommon() {

kotlin {
sourceSets {
val commonMain by getting {
commonMain {
dependencies {
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
}
}

val commonTest by getting {
commonTest {
dependencies {
implementation(kotlin("test"))
}
Expand Down
22 changes: 13 additions & 9 deletions buildSrc/src/main/kotlin/JsConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,24 @@ private fun Project.configureJsTasks() {
kotlin {
js(IR) {
nodejs {
testTask {
useMocha {
timeout = "10000"
testTask(
Action {
useMocha {
timeout = "10000"
}
}
}
)
}

browser {
testTask {
useKarma {
useChromeHeadless()
useConfigDirectory(File(project.rootProject.projectDir, "karma"))
testTask(
Action {
useKarma {
useChromeHeadless()
useConfigDirectory(File(project.rootProject.projectDir, "karma"))
}
}
}
)
}

binaries.library()
Expand Down
10 changes: 10 additions & 0 deletions buildSrc/src/main/kotlin/KotlinExtensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ fun KotlinMultiplatformExtension.createCInterop(
}
}

fun NamedDomainObjectContainer<KotlinSourceSet>.commonMain(block: KotlinSourceSet.() -> Unit) {
val sourceSet = getByName("commonMain")
block(sourceSet)
}

fun NamedDomainObjectContainer<KotlinSourceSet>.commonTest(block: KotlinSourceSet.() -> Unit) {
val sourceSet = getByName("commonTest")
block(sourceSet)
}

fun NamedDomainObjectContainer<KotlinSourceSet>.jvmAndNixMain(block: KotlinSourceSet.() -> Unit) {
val sourceSet = findByName("jvmAndNixMain") ?: getByName("jvmMain")
block(sourceSet)
Expand Down
11 changes: 11 additions & 0 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright 2014-2023 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

object Versions {
val kotlin = "1.9.10"
val coroutines = "1.7.2"
val slf4j = "1.7.36"
val junit = "4.13.2"
val logback = "1.2.11"
}
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/test/server/ServerUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ fun List<PartData>.makeString(): String = buildString {
}
}

@Suppress("DEPRECATION")
private fun filenameContentTypeAndContentString(provider: () -> Input, headers: Headers): String {
val dispositionHeader: String = headers.getAll(HttpHeaders.ContentDisposition)!!.joinToString(";")
val disposition: ContentDisposition = ContentDisposition.parse(dispositionHeader)
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import io.ktor.client.request.*
import io.ktor.util.*
import io.ktor.util.date.*
import kotlinx.coroutines.*
import kotlin.coroutines.*

internal class WinHttpClientEngine(
override val config: WinHttpClientEngineConfig
Expand All @@ -29,6 +30,8 @@ internal class WinHttpClientEngine(
}
}

override fun toString(): String = "WinHttp"

@OptIn(InternalAPI::class)
override suspend fun execute(data: HttpRequestData): HttpResponseData {
val callContext = callContext()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,26 +73,26 @@ class CallLoggingTest {
testApplication {
environment { environment() }
application {
hash = this.toString()
hash = hashCode().toString(radix = 16)
}
}

assertTrue(messages.size >= 3, "It should be at least 3 message logged:\n$messages")
assertEquals(
"INFO: Application started: $hash",
messages[messages.size - 3],
"No started message logged:\n$messages"
)
assertEquals(
"INFO: Application stopping: $hash",
messages[messages.size - 2],
"No stopping message logged:\n$messages"
)
assertEquals(
"INFO: Application stopped: $hash",
messages[messages.size - 1],
"No stopped message logged:\n$messages"
)
assertTrue {
messages[messages.size - 3].startsWith(
"INFO: Application started: class io.ktor.server.application.Application(0x$hash)"
)
}
assertTrue {
messages[messages.size - 2].startsWith(
"INFO: Application stopping: class io.ktor.server.application.Application(0x$hash)"
)
}
assertTrue {
messages[messages.size - 1].startsWith(
"INFO: Application stopped: class io.ktor.server.application.Application(0x$hash)"
)
}
}

@Test
Expand Down Expand Up @@ -374,7 +374,7 @@ class CallLoggingTest {
}
}
}
var hash: String? = null
lateinit var hash: String

testApplication {
environment {
Expand All @@ -385,11 +385,11 @@ class CallLoggingTest {
}
}
}
application { hash = this.toString() }
application { hash = hashCode().toString(radix = 16) }
}

assertTrue(customMessages.isNotEmpty())
assertTrue(customMessages.all { it.startsWith("CUSTOM TRACE:") && it.contains(hash!!) })
assertTrue(customMessages.all { it.startsWith("CUSTOM TRACE:") && it.contains(hash) })
assertTrue(messages.isEmpty())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

kotlin.sourceSets {
val jteVersion = "2.3.2"
val jvmMain by getting {
jvmMain {
dependencies {
api("gg.jte:jte:$jteVersion")
}
}
val jvmTest by getting {
jvmTest {
dependencies {
api(project(":ktor-server:ktor-server-plugins:ktor-server-status-pages"))
api(project(":ktor-server:ktor-server-plugins:ktor-server-compression"))
Expand Down

0 comments on commit eff0636

Please sign in to comment.