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

misc: Upgrade to Kotlin 2.1.0 #1196

Merged
merged 13 commits into from
Dec 17, 2024
2 changes: 1 addition & 1 deletion .brazil.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dependencies": {
"org.jetbrains.kotlin:kotlin-stdlib:2.0.*": "KotlinStdlib-2.x",
"org.jetbrains.kotlin:kotlin-stdlib:2.*": "KotlinStdlib-2.x",
"org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.*": "KotlinxCoroutinesCoreJvm-1.x",

"com.squareup.okhttp3:okhttp-coroutines:5.*": "OkHttp3Coroutines-5.x",
Expand Down
6 changes: 6 additions & 0 deletions .changes/1a68d0b7-00e7-45c0-88f6-95e5c39c9c61.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"id": "1a68d0b7-00e7-45c0-88f6-95e5c39c9c61",
"type": "misc",
"description": "⚠️ **IMPORTANT**: Upgrade to Kotlin 2.1.0",
"requiresMinorVersionBump": true
}
16 changes: 8 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
[versions]
kotlin-version = "2.0.21"
kotlin-version = "2.1.0"
dokka-version = "1.9.10"

aws-kotlin-repo-tools-version = "0.4.16"
aws-kotlin-repo-tools-version = "0.4.17"

# libs
coroutines-version = "1.9.0"
atomicfu-version = "0.25.0"
okhttp-version = "5.0.0-alpha.14"
okhttp4-version = "4.12.0"
okio-version = "3.9.1"
otel-version = "1.43.0"
otel-version = "1.45.0"
slf4j-version = "2.0.16"
slf4j-v1x-version = "1.7.36"
crt-kotlin-version = "0.8.10"
micrometer-version = "1.13.6"
micrometer-version = "1.14.2"
binary-compatibility-validator-version = "0.16.3"

# codegen
smithy-version = "1.51.0"
smithy-gradle-version = "0.9.0"

# testing
junit-version = "5.10.5"
kotest-version = "5.9.1"
kotlin-compile-testing-version = "1.6.0"
kotlin-compile-testing-version = "0.7.0"
kotlinx-benchmark-version = "0.4.12"
kotlinx-serialization-version = "1.7.3"
docker-java-version = "3.4.0"
Expand Down Expand Up @@ -80,7 +80,7 @@ smithy-smoke-test-traits = { module = "software.amazon.smithy:smithy-smoke-test-
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-version" }
junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit-version" }

kotlin-compile-testing = {module = "com.github.tschuchortdev:kotlin-compile-testing", version.ref = "kotlin-compile-testing-version" }
kotlin-compile-testing = {module = "dev.zacsweers.kctfork:core", version.ref = "kotlin-compile-testing-version" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Why are we changing this dependency?

Copy link
Contributor Author

@lauzadis lauzadis Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're frequently blocked on com.github.tschuchortdev:kotlin-compile-testing because its Kotlin version is not upgraded often enough, leading to mismatched Kotlin compiler errors.

tschuchortdev/kotlin-compile-testing#411

dev.zacsweers.kctfork:core is a fork of the project that's updated more frequently:

NOTE This project is a fork of the original tschuchortdev/kotlin-compile-testing, which itself started as a fork of Moshi's compile test infra. The goal of this fork is to better track the latest Kotlin releases.

We can either take this fork or disable the tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh okay, I think taking the fork is fine

kotest-assertions-core = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest-version" }
kotest-assertions-core-jvm = { module = "io.kotest:kotest-assertions-core-jvm", version.ref = "kotest-version" }
kotlinx-benchmark-runtime = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime", version.ref = "kotlinx-benchmark-version" }
Expand All @@ -104,7 +104,7 @@ dokka = { id = "org.jetbrains.dokka", version.ref = "dokka-version"}
kotlin-jvm = {id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin-version" }
kotlin-multiplatform = {id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin-version" }
kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kotlinx-benchmark-version" }
kotlinx-binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.13.2" }
kotlinx-binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binary-compatibility-validator-version" }
kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin-version"}
aws-kotlin-repo-tools-kmp = { id = "aws.sdk.kotlin.gradle.kmp", version.ref = "aws-kotlin-repo-tools-version" }
aws-kotlin-repo-tools-smithybuild = { id = "aws.sdk.kotlin.gradle.smithybuild", version.ref = "aws-kotlin-repo-tools-version" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import io.ktor.util.*
import io.ktor.utils.io.*
import io.ktor.utils.io.core.*
import kotlinx.coroutines.runBlocking
import kotlinx.io.readByteArray
import kotlinx.serialization.json.*
import org.junit.jupiter.api.Assumptions.assumeTrue
import org.junit.jupiter.api.Test
Expand Down Expand Up @@ -383,7 +384,7 @@ public actual abstract class SigningSuiteTestBase : HasSigner {
}

if (hasBody) {
val bytes = runBlocking { chan.readRemaining().readBytes() }
val bytes = runBlocking { chan.readRemaining().readByteArray() }
builder.body = HttpBody.fromBytes(bytes)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

package software.amazon.smithy.kotlin.codegen.util

import com.tschuchort.compiletesting.JvmCompilationResult
import com.tschuchort.compiletesting.KotlinCompilation
import com.tschuchort.compiletesting.SourceFile
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
Expand Down Expand Up @@ -36,8 +37,8 @@ private fun String.slashEscape(char: Char) = this.replace(char.toString(), """\$
* Captures the result of a model transformation test
*/
data class ModelChangeTestResult(
val originalModelCompilationResult: KotlinCompilation.Result,
val updatedModelCompilationResult: KotlinCompilation.Result,
val originalModelCompilationResult: JvmCompilationResult,
val updatedModelCompilationResult: JvmCompilationResult,
val compileSuccess: Boolean,
val compileOutput: String,
)
Expand Down Expand Up @@ -88,7 +89,7 @@ fun compileSdkAndTest(
testSource: String? = null,
outputSink: OutputStream = System.out,
emitSourcesToTmp: Boolean = false,
): KotlinCompilation.Result {
): JvmCompilationResult {
val sdkFileManifest = generateSdk(model)

if (emitSourcesToTmp) {
Expand Down
Loading