Skip to content

Commit b60bbb6

Browse files
committed
Lower supported KotlinVersion to 1.8 (wasmJs >> 1.9)
1 parent 681acc2 commit b60bbb6

4 files changed

Lines changed: 27 additions & 10 deletions

File tree

build-logic/src/main/kotlin/-KmpConfigurationExtension.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import io.matthewnelson.kmp.configuration.extension.KmpConfigurationExtension
1717
import io.matthewnelson.kmp.configuration.extension.container.target.KmpConfigurationContainerDsl
1818
import org.gradle.api.Action
1919
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
20+
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
2021
import org.jetbrains.kotlin.konan.target.HostManager
2122

2223
fun KmpConfigurationExtension.configureShared(
@@ -51,6 +52,14 @@ fun KmpConfigurationExtension.configureShared(
5152
target {
5253
browser()
5354
nodejs()
55+
56+
if (publish) {
57+
@Suppress("DEPRECATION")
58+
compilerOptions {
59+
apiVersion.set(KotlinVersion.KOTLIN_1_9)
60+
languageVersion.set(KotlinVersion.KOTLIN_1_9)
61+
}
62+
}
5463
}
5564
}
5665
@OptIn(ExperimentalWasmDsl::class)
@@ -82,6 +91,15 @@ fun KmpConfigurationExtension.configureShared(
8291

8392
if (publish) kotlin { explicitApi() }
8493

94+
if (publish) kotlin {
95+
@Suppress("DEPRECATION")
96+
compilerOptions {
97+
freeCompilerArgs.add("-Xsuppress-version-warnings")
98+
apiVersion.set(KotlinVersion.KOTLIN_1_8)
99+
languageVersion.set(KotlinVersion.KOTLIN_1_8)
100+
}
101+
}
102+
85103
action.execute(this)
86104
}
87105
}

library/crypto-rand/src/jsMain/kotlin/org/kotlincrypto/random/internal/JsPlatform.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ internal actual fun ByteArray.cryptoRandFill() {
7979
// chunk
8080
while (needed > BUFFER_SIZE) {
8181
jsCryptoFill(bufDynamic)
82-
for (i in 0..<BUFFER_SIZE) {
82+
for (i in 0 until BUFFER_SIZE) {
8383
this[pos++] = (bufDynamic[i] as Number).toByte()
8484
}
8585
needed -= BUFFER_SIZE
@@ -89,13 +89,13 @@ internal actual fun ByteArray.cryptoRandFill() {
8989
if (needed > 0) {
9090
jsCryptoFill(buf.subarray(0, needed).asDynamic())
9191

92-
for (i in 0..<needed) {
92+
for (i in 0 until needed) {
9393
this[pos++] = (bufDynamic[i] as Number).toByte()
9494
bufDynamic[i] = 0 // Always ensure buffer is zeroed out
9595
}
9696
}
9797

98-
for (i in needed..<BUFFER_SIZE) {
98+
for (i in needed until BUFFER_SIZE) {
9999
bufDynamic[i] = 0 // Always ensure buffer is zeroed out
100100
}
101101
} catch (t: Throwable) {

library/crypto-rand/src/linuxAndroidMain/kotlin/org/kotlincrypto/random/internal/URandom.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
**/
16-
@file:Suppress("KotlinRedundantDiagnosticSuppress", "NOTHING_TO_INLINE", "SpellCheckingInspection", "UnnecessaryOptInAnnotation")
16+
@file:Suppress("NOTHING_TO_INLINE")
1717

1818
package org.kotlincrypto.random.internal
1919

@@ -33,8 +33,7 @@ private inline fun <T: Any?> openRDONLY(path: String, block: (fd: Int) -> T): T
3333
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
3434
}
3535

36-
@Suppress("VariableInitializerIsRedundant")
37-
var fd = -1
36+
var fd: Int
3837
do {
3938
fd = open(path, O_RDONLY or O_CLOEXEC, 0)
4039
} while (fd == -1 && errno == EINTR)

library/crypto-rand/src/wasmJsMain/kotlin/org/kotlincrypto/random/internal/WasmJsPlatform.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
**/
16-
@file:Suppress("ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT", "KotlinRedundantDiagnosticSuppress")
16+
@file:Suppress("ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT", "KotlinRedundantDiagnosticSuppress", "UNUSED")
1717

1818
package org.kotlincrypto.random.internal
1919

@@ -88,7 +88,7 @@ internal actual fun ByteArray.cryptoRandFill() {
8888
// chunk
8989
while (needed > BUFFER_SIZE) {
9090
jsCryptoFill(buf)
91-
for (i in 0..<BUFFER_SIZE) {
91+
for (i in 0 until BUFFER_SIZE) {
9292
this[pos++] = buf[i]
9393
}
9494
needed -= BUFFER_SIZE
@@ -98,13 +98,13 @@ internal actual fun ByteArray.cryptoRandFill() {
9898
if (needed > 0) {
9999
jsCryptoFill(buf.subarray(0, needed))
100100

101-
for (i in 0..<needed) {
101+
for (i in 0 until needed) {
102102
this[pos++] = buf[i]
103103
buf[i] = 0 // Always ensure buffer is zeroed out
104104
}
105105
}
106106

107-
for (i in needed..<BUFFER_SIZE) {
107+
for (i in needed until BUFFER_SIZE) {
108108
buf[i] = 0 // Always ensure buffer is zeroed out
109109
}
110110
} catch (t: Throwable) {

0 commit comments

Comments
 (0)