Skip to content

Commit 8958f4c

Browse files
authored
Capture version at configuration time to avoid configuration cache issue (#291)
Moves capture of the project version to execution time to avoid a gradle configuration cache issue
1 parent d868136 commit 8958f4c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

kotlin-sdk-core/build.gradle.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,17 @@ val generateLibVersion by tasks.registering {
1414
val outputDir = layout.buildDirectory.dir("generated-sources/libVersion")
1515
outputs.dir(outputDir)
1616

17+
// Capture version at configuration time to avoid configuration cache issues
18+
val projectVersion = project.version.toString()
19+
1720
doLast {
1821
val sourceFile = outputDir.get().file("io/modelcontextprotocol/kotlin/sdk/LibVersion.kt").asFile
1922
sourceFile.parentFile.mkdirs()
2023
sourceFile.writeText(
2124
"""
2225
package io.modelcontextprotocol.kotlin.sdk
2326
24-
public const val LIB_VERSION: String = "${project.version}"
27+
public const val LIB_VERSION: String = "$projectVersion"
2528
2629
""".trimIndent(),
2730
)

0 commit comments

Comments
 (0)