Skip to content

Commit 9593260

Browse files
authored
[kotlin-client][multiplatform] update Kotlin and libraries versions (#21353)
1 parent 1f8787e commit 9593260

File tree

12 files changed

+72
-90
lines changed

12 files changed

+72
-90
lines changed

modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/build.gradle.kts.mustache

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
22

33
plugins {
4-
kotlin("multiplatform"){{^omitGradlePluginVersions}} version "2.0.21" // kotlin_version{{/omitGradlePluginVersions}}
5-
kotlin("plugin.serialization"){{^omitGradlePluginVersions}} version "2.0.21" // kotlin_version{{/omitGradlePluginVersions}}
4+
kotlin("multiplatform"){{^omitGradlePluginVersions}} version "2.1.21" // kotlin_version{{/omitGradlePluginVersions}}
5+
kotlin("plugin.serialization"){{^omitGradlePluginVersions}} version "2.1.21" // kotlin_version{{/omitGradlePluginVersions}}
66
}
77

88
group = "{{groupId}}"
99
version = "{{artifactVersion}}"
1010

11-
val kotlin_version = "2.0.21"
12-
val coroutines_version = "1.9.0"
13-
val serialization_version = "1.7.3"
14-
val ktor_version = "3.0.3"
11+
val kotlin_version = "2.1.21"
12+
val coroutines_version = "1.10.2"
13+
val serialization_version = "1.8.1"
14+
val ktor_version = "3.1.3"
1515

1616
repositories {
1717
mavenCentral()
@@ -43,7 +43,7 @@ kotlin {
4343
api("io.ktor:ktor-serialization-kotlinx-json:$ktor_version")
4444
4545
{{#kotlinx-datetime}}
46-
api("org.jetbrains.kotlinx:kotlinx-datetime:0.4.1")
46+
api("org.jetbrains.kotlinx:kotlinx-datetime:0.6.2")
4747
{{/kotlinx-datetime}}
4848
}
4949
}
@@ -79,12 +79,6 @@ kotlin {
7979
api("io.ktor:ktor-client-js:$ktor_version")
8080
}
8181
}
82-
83-
all {
84-
languageSettings.apply {
85-
optIn("kotlin.Experimental")
86-
}
87-
}
8882
}
8983
}
9084

modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/infrastructure/Bytes.kt.mustache

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package {{packageName}}.infrastructure
22

33
import io.ktor.utils.io.core.*
4+
import kotlinx.io.Source
5+
import kotlinx.io.readByteArray
46
import kotlin.experimental.and
57

68
private val digits = "0123456789abcdef".toCharArray()
@@ -14,7 +16,8 @@ private fun ByteArray.clearFrom(from: Int) = (from until size).forEach { this[it
1416
private fun Int.toBase64(): Char = BASE64_ALPHABET[this]
1517
private fun Byte.fromBase64(): Byte = BASE64_INVERSE_ALPHABET[toInt() and 0xff].toByte() and BASE64_MASK
1618
internal fun ByteArray.encodeBase64(): String = buildPacket { writeFully(this@encodeBase64) }.encodeBase64()
17-
internal fun String.decodeBase64Bytes(): ByteArray = buildPacket { writeText(dropLastWhile { it == BASE64_PAD }) }.decodeBase64Bytes().readBytes()
19+
internal fun String.decodeBase64Bytes(): ByteArray =
20+
buildPacket { writeText(dropLastWhile { it == BASE64_PAD }) }.decodeBase64Bytes().readByteArray()
1821

1922
/**
2023
* Encode [bytes] as a HEX string with no spaces, newlines and `0x` prefixes.
@@ -57,7 +60,7 @@ internal fun hex(s: String): ByteArray {
5760
*
5861
* Taken from https://github.com/ktorio/ktor/blob/424d1d2cfaa3281302c60af9500f738c8c2fc846/ktor-utils/common/src/io/ktor/util/Base64.kt
5962
*/
60-
private fun ByteReadPacket.encodeBase64(): String = buildString {
63+
private fun Source.encodeBase64(): String = buildString {
6164
val data = ByteArray(3)
6265
while (remaining > 0) {
6366
val read = readAvailable(data)

samples/client/petstore/kotlin-array-simple-string-multiplatform/build.gradle.kts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
22

33
plugins {
4-
kotlin("multiplatform") version "2.0.21" // kotlin_version
5-
kotlin("plugin.serialization") version "2.0.21" // kotlin_version
4+
kotlin("multiplatform") version "2.1.21" // kotlin_version
5+
kotlin("plugin.serialization") version "2.1.21" // kotlin_version
66
}
77

88
group = "org.openapitools"
99
version = "1.0.0"
1010

11-
val kotlin_version = "2.0.21"
12-
val coroutines_version = "1.9.0"
13-
val serialization_version = "1.7.3"
14-
val ktor_version = "3.0.3"
11+
val kotlin_version = "2.1.21"
12+
val coroutines_version = "1.10.2"
13+
val serialization_version = "1.8.1"
14+
val ktor_version = "3.1.3"
1515

1616
repositories {
1717
mavenCentral()
@@ -38,7 +38,7 @@ kotlin {
3838
api("io.ktor:ktor-client-content-negotiation:$ktor_version")
3939
api("io.ktor:ktor-serialization-kotlinx-json:$ktor_version")
4040

41-
api("org.jetbrains.kotlinx:kotlinx-datetime:0.4.1")
41+
api("org.jetbrains.kotlinx:kotlinx-datetime:0.6.2")
4242
}
4343
}
4444

@@ -73,12 +73,6 @@ kotlin {
7373
api("io.ktor:ktor-client-js:$ktor_version")
7474
}
7575
}
76-
77-
all {
78-
languageSettings.apply {
79-
optIn("kotlin.Experimental")
80-
}
81-
}
8276
}
8377
}
8478

samples/client/petstore/kotlin-array-simple-string-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package org.openapitools.client.infrastructure
22

33
import io.ktor.utils.io.core.*
4+
import kotlinx.io.Source
5+
import kotlinx.io.readByteArray
46
import kotlin.experimental.and
57

68
private val digits = "0123456789abcdef".toCharArray()
@@ -14,7 +16,8 @@ private fun ByteArray.clearFrom(from: Int) = (from until size).forEach { this[it
1416
private fun Int.toBase64(): Char = BASE64_ALPHABET[this]
1517
private fun Byte.fromBase64(): Byte = BASE64_INVERSE_ALPHABET[toInt() and 0xff].toByte() and BASE64_MASK
1618
internal fun ByteArray.encodeBase64(): String = buildPacket { writeFully(this@encodeBase64) }.encodeBase64()
17-
internal fun String.decodeBase64Bytes(): ByteArray = buildPacket { writeText(dropLastWhile { it == BASE64_PAD }) }.decodeBase64Bytes().readBytes()
19+
internal fun String.decodeBase64Bytes(): ByteArray =
20+
buildPacket { writeText(dropLastWhile { it == BASE64_PAD }) }.decodeBase64Bytes().readByteArray()
1821

1922
/**
2023
* Encode [bytes] as a HEX string with no spaces, newlines and `0x` prefixes.
@@ -57,7 +60,7 @@ internal fun hex(s: String): ByteArray {
5760
*
5861
* Taken from https://github.com/ktorio/ktor/blob/424d1d2cfaa3281302c60af9500f738c8c2fc846/ktor-utils/common/src/io/ktor/util/Base64.kt
5962
*/
60-
private fun ByteReadPacket.encodeBase64(): String = buildString {
63+
private fun Source.encodeBase64(): String = buildString {
6164
val data = ByteArray(3)
6265
while (remaining > 0) {
6366
val read = readAvailable(data)

samples/client/petstore/kotlin-bigdecimal-default-multiplatform/build.gradle.kts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
22

33
plugins {
4-
kotlin("multiplatform") version "2.0.21" // kotlin_version
5-
kotlin("plugin.serialization") version "2.0.21" // kotlin_version
4+
kotlin("multiplatform") version "2.1.21" // kotlin_version
5+
kotlin("plugin.serialization") version "2.1.21" // kotlin_version
66
}
77

88
group = "org.openapitools"
99
version = "1.0.0"
1010

11-
val kotlin_version = "2.0.21"
12-
val coroutines_version = "1.9.0"
13-
val serialization_version = "1.7.3"
14-
val ktor_version = "3.0.3"
11+
val kotlin_version = "2.1.21"
12+
val coroutines_version = "1.10.2"
13+
val serialization_version = "1.8.1"
14+
val ktor_version = "3.1.3"
1515

1616
repositories {
1717
mavenCentral()
@@ -38,7 +38,7 @@ kotlin {
3838
api("io.ktor:ktor-client-content-negotiation:$ktor_version")
3939
api("io.ktor:ktor-serialization-kotlinx-json:$ktor_version")
4040

41-
api("org.jetbrains.kotlinx:kotlinx-datetime:0.4.1")
41+
api("org.jetbrains.kotlinx:kotlinx-datetime:0.6.2")
4242
}
4343
}
4444

@@ -73,12 +73,6 @@ kotlin {
7373
api("io.ktor:ktor-client-js:$ktor_version")
7474
}
7575
}
76-
77-
all {
78-
languageSettings.apply {
79-
optIn("kotlin.Experimental")
80-
}
81-
}
8276
}
8377
}
8478

samples/client/petstore/kotlin-bigdecimal-default-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package org.openapitools.client.infrastructure
22

33
import io.ktor.utils.io.core.*
4+
import kotlinx.io.Source
5+
import kotlinx.io.readByteArray
46
import kotlin.experimental.and
57

68
private val digits = "0123456789abcdef".toCharArray()
@@ -14,7 +16,8 @@ private fun ByteArray.clearFrom(from: Int) = (from until size).forEach { this[it
1416
private fun Int.toBase64(): Char = BASE64_ALPHABET[this]
1517
private fun Byte.fromBase64(): Byte = BASE64_INVERSE_ALPHABET[toInt() and 0xff].toByte() and BASE64_MASK
1618
internal fun ByteArray.encodeBase64(): String = buildPacket { writeFully(this@encodeBase64) }.encodeBase64()
17-
internal fun String.decodeBase64Bytes(): ByteArray = buildPacket { writeText(dropLastWhile { it == BASE64_PAD }) }.decodeBase64Bytes().readBytes()
19+
internal fun String.decodeBase64Bytes(): ByteArray =
20+
buildPacket { writeText(dropLastWhile { it == BASE64_PAD }) }.decodeBase64Bytes().readByteArray()
1821

1922
/**
2023
* Encode [bytes] as a HEX string with no spaces, newlines and `0x` prefixes.
@@ -57,7 +60,7 @@ internal fun hex(s: String): ByteArray {
5760
*
5861
* Taken from https://github.com/ktorio/ktor/blob/424d1d2cfaa3281302c60af9500f738c8c2fc846/ktor-utils/common/src/io/ktor/util/Base64.kt
5962
*/
60-
private fun ByteReadPacket.encodeBase64(): String = buildString {
63+
private fun Source.encodeBase64(): String = buildString {
6164
val data = ByteArray(3)
6265
while (remaining > 0) {
6366
val read = readAvailable(data)

samples/client/petstore/kotlin-default-values-multiplatform/build.gradle.kts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
22

33
plugins {
4-
kotlin("multiplatform") version "2.0.21" // kotlin_version
5-
kotlin("plugin.serialization") version "2.0.21" // kotlin_version
4+
kotlin("multiplatform") version "2.1.21" // kotlin_version
5+
kotlin("plugin.serialization") version "2.1.21" // kotlin_version
66
}
77

88
group = "org.openapitools"
99
version = "1.0.0"
1010

11-
val kotlin_version = "2.0.21"
12-
val coroutines_version = "1.9.0"
13-
val serialization_version = "1.7.3"
14-
val ktor_version = "3.0.3"
11+
val kotlin_version = "2.1.21"
12+
val coroutines_version = "1.10.2"
13+
val serialization_version = "1.8.1"
14+
val ktor_version = "3.1.3"
1515

1616
repositories {
1717
mavenCentral()
@@ -38,7 +38,7 @@ kotlin {
3838
api("io.ktor:ktor-client-content-negotiation:$ktor_version")
3939
api("io.ktor:ktor-serialization-kotlinx-json:$ktor_version")
4040

41-
api("org.jetbrains.kotlinx:kotlinx-datetime:0.4.1")
41+
api("org.jetbrains.kotlinx:kotlinx-datetime:0.6.2")
4242
}
4343
}
4444

@@ -73,12 +73,6 @@ kotlin {
7373
api("io.ktor:ktor-client-js:$ktor_version")
7474
}
7575
}
76-
77-
all {
78-
languageSettings.apply {
79-
optIn("kotlin.Experimental")
80-
}
81-
}
8276
}
8377
}
8478

samples/client/petstore/kotlin-default-values-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package org.openapitools.client.infrastructure
22

33
import io.ktor.utils.io.core.*
4+
import kotlinx.io.Source
5+
import kotlinx.io.readByteArray
46
import kotlin.experimental.and
57

68
private val digits = "0123456789abcdef".toCharArray()
@@ -14,7 +16,8 @@ private fun ByteArray.clearFrom(from: Int) = (from until size).forEach { this[it
1416
private fun Int.toBase64(): Char = BASE64_ALPHABET[this]
1517
private fun Byte.fromBase64(): Byte = BASE64_INVERSE_ALPHABET[toInt() and 0xff].toByte() and BASE64_MASK
1618
internal fun ByteArray.encodeBase64(): String = buildPacket { writeFully(this@encodeBase64) }.encodeBase64()
17-
internal fun String.decodeBase64Bytes(): ByteArray = buildPacket { writeText(dropLastWhile { it == BASE64_PAD }) }.decodeBase64Bytes().readBytes()
19+
internal fun String.decodeBase64Bytes(): ByteArray =
20+
buildPacket { writeText(dropLastWhile { it == BASE64_PAD }) }.decodeBase64Bytes().readByteArray()
1821

1922
/**
2023
* Encode [bytes] as a HEX string with no spaces, newlines and `0x` prefixes.
@@ -57,7 +60,7 @@ internal fun hex(s: String): ByteArray {
5760
*
5861
* Taken from https://github.com/ktorio/ktor/blob/424d1d2cfaa3281302c60af9500f738c8c2fc846/ktor-utils/common/src/io/ktor/util/Base64.kt
5962
*/
60-
private fun ByteReadPacket.encodeBase64(): String = buildString {
63+
private fun Source.encodeBase64(): String = buildString {
6164
val data = ByteArray(3)
6265
while (remaining > 0) {
6366
val read = readAvailable(data)

samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/build.gradle.kts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
22

33
plugins {
4-
kotlin("multiplatform") version "2.0.21" // kotlin_version
5-
kotlin("plugin.serialization") version "2.0.21" // kotlin_version
4+
kotlin("multiplatform") version "2.1.21" // kotlin_version
5+
kotlin("plugin.serialization") version "2.1.21" // kotlin_version
66
}
77

88
group = "org.openapitools"
99
version = "1.0.0"
1010

11-
val kotlin_version = "2.0.21"
12-
val coroutines_version = "1.9.0"
13-
val serialization_version = "1.7.3"
14-
val ktor_version = "3.0.3"
11+
val kotlin_version = "2.1.21"
12+
val coroutines_version = "1.10.2"
13+
val serialization_version = "1.8.1"
14+
val ktor_version = "3.1.3"
1515

1616
repositories {
1717
mavenCentral()
@@ -38,7 +38,7 @@ kotlin {
3838
api("io.ktor:ktor-client-content-negotiation:$ktor_version")
3939
api("io.ktor:ktor-serialization-kotlinx-json:$ktor_version")
4040

41-
api("org.jetbrains.kotlinx:kotlinx-datetime:0.4.1")
41+
api("org.jetbrains.kotlinx:kotlinx-datetime:0.6.2")
4242
}
4343
}
4444

@@ -73,12 +73,6 @@ kotlin {
7373
api("io.ktor:ktor-client-js:$ktor_version")
7474
}
7575
}
76-
77-
all {
78-
languageSettings.apply {
79-
optIn("kotlin.Experimental")
80-
}
81-
}
8276
}
8377
}
8478

samples/client/petstore/kotlin-multiplatform-kotlinx-datetime/src/commonMain/kotlin/org/openapitools/client/infrastructure/Bytes.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package org.openapitools.client.infrastructure
22

33
import io.ktor.utils.io.core.*
4+
import kotlinx.io.Source
5+
import kotlinx.io.readByteArray
46
import kotlin.experimental.and
57

68
private val digits = "0123456789abcdef".toCharArray()
@@ -14,7 +16,8 @@ private fun ByteArray.clearFrom(from: Int) = (from until size).forEach { this[it
1416
private fun Int.toBase64(): Char = BASE64_ALPHABET[this]
1517
private fun Byte.fromBase64(): Byte = BASE64_INVERSE_ALPHABET[toInt() and 0xff].toByte() and BASE64_MASK
1618
internal fun ByteArray.encodeBase64(): String = buildPacket { writeFully(this@encodeBase64) }.encodeBase64()
17-
internal fun String.decodeBase64Bytes(): ByteArray = buildPacket { writeText(dropLastWhile { it == BASE64_PAD }) }.decodeBase64Bytes().readBytes()
19+
internal fun String.decodeBase64Bytes(): ByteArray =
20+
buildPacket { writeText(dropLastWhile { it == BASE64_PAD }) }.decodeBase64Bytes().readByteArray()
1821

1922
/**
2023
* Encode [bytes] as a HEX string with no spaces, newlines and `0x` prefixes.
@@ -57,7 +60,7 @@ internal fun hex(s: String): ByteArray {
5760
*
5861
* Taken from https://github.com/ktorio/ktor/blob/424d1d2cfaa3281302c60af9500f738c8c2fc846/ktor-utils/common/src/io/ktor/util/Base64.kt
5962
*/
60-
private fun ByteReadPacket.encodeBase64(): String = buildString {
63+
private fun Source.encodeBase64(): String = buildString {
6164
val data = ByteArray(3)
6265
while (remaining > 0) {
6366
val read = readAvailable(data)

0 commit comments

Comments
 (0)