Move generateLibVersion task to kotlin-sdk-core (#274)

fix #272 

## How Has This Been Tested?
Locally

## Breaking Changes
No

## Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation update

## Checklist
- [x] I have read the [MCP
Documentation](https://modelcontextprotocol.io)
- [x] My code follows the repository's style guidelines
- [x] New and existing tests pass locally
- [ ] I have added appropriate error handling
- [ ] I have added or updated documentation as needed
This commit is contained in:
Pavel Gorgulov 2025-09-16 16:17:36 +02:00 • committed by GitHub
commit 41fc351cd2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 20 additions and 33 deletions

View file

@ -10,25 +10,6 @@ plugins {
id("org.jetbrains.kotlinx.atomicfu")
}
// Generation library versions
val generateLibVersion by tasks.registering {
val outputDir = layout.buildDirectory.dir("generated-sources/libVersion")
outputs.dir(outputDir)
doLast {
val sourceFile = outputDir.get().file("io/modelcontextprotocol/kotlin/sdk/LibVersion.kt").asFile
sourceFile.parentFile.mkdirs()
sourceFile.writeText(
"""
package io.modelcontextprotocol.kotlin.sdk
public const val LIB_VERSION: String = "${project.version}"
""".trimIndent()
)
}
}
kotlin {
jvm {
compilerOptions.jvmTarget = JvmTarget.JVM_1_8
@ -41,10 +22,4 @@ kotlin {
explicitApi = ExplicitApiMode.Strict
jvmToolchain(21)
sourceSets {
commonMain {
kotlin.srcDir(generateLibVersion)
}
}
}

View file

@ -1,7 +1,3 @@
public final class io/modelcontextprotocol/kotlin/sdk/LibVersionKt {
public static final field LIB_VERSION Ljava/lang/String;
}
public class io/modelcontextprotocol/kotlin/sdk/client/Client : io/modelcontextprotocol/kotlin/sdk/shared/Protocol {
public fun <init> (Lio/modelcontextprotocol/kotlin/sdk/Implementation;Lio/modelcontextprotocol/kotlin/sdk/client/ClientOptions;)V
public synthetic fun <init> (Lio/modelcontextprotocol/kotlin/sdk/Implementation;Lio/modelcontextprotocol/kotlin/sdk/client/ClientOptions;ILkotlin/jvm/internal/DefaultConstructorMarker;)V

View file

@ -10,6 +10,25 @@ plugins {
alias(libs.plugins.kotlinx.binary.compatibility.validator)
}
// Generation library versions
val generateLibVersion by tasks.registering {
val outputDir = layout.buildDirectory.dir("generated-sources/libVersion")
outputs.dir(outputDir)
doLast {
val sourceFile = outputDir.get().file("io/modelcontextprotocol/kotlin/sdk/LibVersion.kt").asFile
sourceFile.parentFile.mkdirs()
sourceFile.writeText(
"""
package io.modelcontextprotocol.kotlin.sdk
public const val LIB_VERSION: String = "${project.version}"
""".trimIndent(),
)
}
}
kotlin {
iosArm64()
iosX64()
@ -31,6 +50,7 @@ kotlin {
sourceSets {
commonMain {
kotlin.srcDir(generateLibVersion)
dependencies {
api(libs.kotlinx.serialization.json)
api(libs.kotlinx.coroutines.core)

View file

@ -1,7 +1,3 @@
public final class io/modelcontextprotocol/kotlin/sdk/LibVersionKt {
public static final field LIB_VERSION Ljava/lang/String;
}
public final class io/modelcontextprotocol/kotlin/sdk/server/KtorServerKt {
public static final fun MCP (Lio/ktor/server/application/Application;Lkotlin/jvm/functions/Function1;)V
public static final fun mcp (Lio/ktor/server/application/Application;Lkotlin/jvm/functions/Function1;)V