Skip to content

Commit 65f0045

Browse files
committed
Downgrade Kotlin to 2.1.21
- Downgrade Kotlin 2.2.0->2.1.21 to make broader adoption possible. Update Kotlin compiler configuration - Add [kotlinx-datetime](https://github.com/Kotlin/kotlinx-datetime) dependency. Switch from `kotlin.time.Instant` to `kotlinx.datetime.Instant`. - Downgrade atomicfu 0.29.0->0.28.0 - Downgrade kotlinx-serialization 1.9.0->1.8.1
1 parent a23856e commit 65f0045

File tree

9 files changed

+171
-221
lines changed

9 files changed

+171
-221
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ See [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/
7373

7474
* To build MCP Kotlin SDK, JDK version 21 or higher is required. Make sure this is your default JDK (`JAVA_HOME` is set
7575
accordingly)
76+
* To build for MacOS/iOS targets, Xcode/Command Line Tools should be installed. See Apple Developer [documentation](https://developer.apple.com/documentation/xcode/downloading-and-installing-additional-xcode-components) for details.
77+
* To build JS/Wasm targets, [Node.js](https://nodejs.org/) must be installed.
7678
* The project can be opened in IntelliJ IDEA without additional prerequisites.
7779

7880
### Building MCP Kotlin SDK from source

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# MCP Kotlin SDK
22

3+
[![Kotlin](https://img.shields.io/badge/kotlin-2.1-blue.svg?logo=kotlin)](http://kotlinlang.org)
34
[![Kotlin Multiplatform](https://img.shields.io/badge/Kotlin-Multiplatform-blueviolet?logo=kotlin)](https://kotlinlang.org/docs/multiplatform.html)
4-
[![Platforms](https://img.shields.io/badge/Platforms-JVM%20%7C%20Wasm%2FJS%20%7C%20Native%20(iOS%2FiOS%20Simulator)-blue)](https://kotlinlang.org/docs/multiplatform.html)
5+
[![Platforms](https://img.shields.io/badge/Platforms-JVM%20%7C%20Wasm%2FJS%20%7C%20Native-blue)](https://kotlinlang.org/docs/multiplatform.html)
56
[![Maven Central](https://img.shields.io/maven-central/v/io.modelcontextprotocol/kotlin-sdk.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:io.modelcontextprotocol%20a:kotlin-sdk)
67
[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
78

buildSrc/src/main/kotlin/mcp.multiplatform.gradle.kts

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
44
import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
55
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
6+
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_1
67

78
plugins {
89
kotlin("multiplatform")
@@ -24,18 +25,40 @@ val generateLibVersion by tasks.registering {
2425
2526
public const val LIB_VERSION: String = "${project.version}"
2627
27-
""".trimIndent()
28+
""".trimIndent(),
2829
)
2930
}
3031
}
3132

3233
kotlin {
34+
35+
compilerOptions {
36+
languageVersion = KOTLIN_2_1
37+
apiVersion = KOTLIN_2_1
38+
// TODO: allWarningsAsErrors = true
39+
extraWarnings = true
40+
freeCompilerArgs =
41+
listOf(
42+
"-Xwhen-guards",
43+
)
44+
}
45+
coreLibrariesVersion = "2.1.21"
46+
3347
jvm {
34-
compilerOptions.jvmTarget = JvmTarget.JVM_1_8
48+
compilerOptions {
49+
jvmTarget = JvmTarget.JVM_1_8
50+
javaParameters = true
51+
}
3552
}
36-
macosX64(); macosArm64()
37-
linuxX64(); linuxArm64()
53+
54+
macosX64()
55+
macosArm64()
56+
57+
linuxX64()
58+
linuxArm64()
59+
3860
mingwX64()
61+
3962
js { nodejs() }
4063
wasmJs { nodejs() }
4164

gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,9 @@ org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true
77
# Kotlin
88
kotlin.code.style=official
99
kotlin.daemon.jvmargs=-Xmx4G
10+
kotlin.native.ignoreDisabledTargets=true
1011
# MPP
1112
kotlin.mpp.enableCInteropCommonization=true
13+
14+
# Build JS targets using npm package manager https://kotlinlang.org/docs/js-project-setup.html#npm-dependencies
15+
kotlin.js.yarn=false

gradle/libs.versions.toml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
[versions]
22
# plugins version
3-
kotlin = "2.2.0"
3+
kotlin = "2.1.21"
44
dokka = "2.0.0"
5-
atomicfu = "0.29.0"
5+
atomicfu = "0.28.0"
66
ktlint = "13.0.0"
77

88
# libraries version
9-
serialization = "1.9.0"
9+
binaryCompatibilityValidatorPlugin = "0.18.1"
1010
collections-immutable = "0.4.0"
1111
coroutines = "1.10.2"
12-
kotlinx-io = "0.8.0"
12+
jreleaser = "1.19.0"
13+
kotest = "5.9.1"
14+
kotlinx-datetime = "0.6.2"
15+
kotlinx-io = "0.7.0"
1316
ktor = "3.2.3"
1417
logging = "7.0.7"
15-
jreleaser = "1.19.0"
16-
binaryCompatibilityValidatorPlugin = "0.18.1"
18+
serialization = "1.8.1"
1719
slf4j = "2.0.17"
18-
kotest = "5.9.1"
1920

2021
# Samples
2122
mcp-kotlin = "0.6.0"
@@ -31,11 +32,13 @@ dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref
3132
jreleaser-gradle = { module = "org.jreleaser:jreleaser-gradle-plugin", version.ref = "jreleaser" }
3233

3334
# Kotlinx libraries
34-
kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "serialization" }
35+
kotlin-logging = { group = "io.github.oshai", name = "kotlin-logging", version.ref = "logging" }
36+
kotlinx-collections-immutable = { group = "org.jetbrains.kotlinx", name = "kotlinx-collections-immutable", version.ref = "collections-immutable" }
3537
kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutines" }
38+
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" }
3639
kotlinx-io-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-io-core", version.ref = "kotlinx-io" }
37-
kotlinx-collections-immutable = { group = "org.jetbrains.kotlinx", name = "kotlinx-collections-immutable", version.ref = "collections-immutable" }
38-
kotlin-logging = { group = "io.github.oshai", name = "kotlin-logging", version.ref = "logging" }
40+
kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "serialization" }
41+
3942

4043
# Ktor
4144
ktor-client-cio = { group = "io.ktor", name = "ktor-client-cio", version.ref = "ktor" }

0 commit comments

Comments
 (0)