Skip to content

Commit 2c5e654

Browse files
committed
Kotlin 2.2.10, DSL update, 2025-08 Library updates
1 parent da5eda3 commit 2c5e654

22 files changed

Lines changed: 236 additions & 276 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ build
1919
.cxx
2020
local.properties
2121
/kotlin-js-store/yarn.lock
22+
/kotlin-js-store/wasm/yarn.lock

build.gradle

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2-
31
/*
42
* Copyright 2022 Nikolai Kotchetkov.
53
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -38,10 +36,10 @@ allprojects {
3836
ext {
3937
versionCode = buildVersionCode()
4038
versionName = buildVersionName()
41-
androidBuildToolsVersion = '34.0.0'
39+
androidBuildToolsVersion = '35.0.0'
4240
androidMinSdkVersion = 24
43-
androidTargetSdkVersion = 34
44-
androidCompileSdkVersion = 34
41+
androidTargetSdkVersion = 36
42+
androidCompileSdkVersion = 36
4543

4644
developerId = 'motorro'
4745
developerName = 'Nikolai Kotchetkov'
@@ -51,15 +49,6 @@ allprojects {
5149
projectUrl = 'https://github.com/motorro/CommonStateMachine'
5250
}
5351

54-
tasks.withType(KotlinCompile).configureEach {
55-
kotlinOptions {
56-
freeCompilerArgs += [
57-
"-opt-in=kotlin.RequiresOptIn",
58-
"-Xinline-classes"
59-
]
60-
}
61-
}
62-
6352
tasks.withType(Test).configureEach {
6453
forkEvery = 100
6554
testLogging {
@@ -134,20 +123,18 @@ tasks.register('displayVersion', Task) {
134123
}
135124
}
136125

137-
task runUnitTests(
138-
type: Task,
139-
dependsOn: [
126+
tasks.register('runUnitTests', Task) {
127+
it.dependsOn( [
140128
'runStateMachineTests',
141129
'runCoroutinesTests',
142130
'runLoginUnitTests',
143131
'runRegisterUnitTests',
144132
'runLceUnitTests',
145133
'runWelcomeUnitTests',
146134
'runTimerUnitTests'
147-
],
148-
group: 'verification'
149-
) {
150-
description 'Run unit tests for all modules.'
135+
])
136+
it.group = 'verification'
137+
it.description = 'Run unit tests for all modules.'
151138
}
152139

153140
def ossrhUsername = ext['ossrhUsername']

commonstatemachine/build.gradle.kts

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@
1111
* limitations under the License.
1212
*/
1313

14+
@file:Suppress("unused")
15+
@file:OptIn(ExperimentalWasmDsl::class)
16+
1417
import org.jetbrains.dokka.gradle.DokkaTask
18+
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
19+
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
20+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
1521

1622
plugins {
1723
id("org.jetbrains.kotlin.multiplatform")
@@ -33,25 +39,29 @@ println("== Project version: $versionName ==")
3339

3440
kotlin {
3541

36-
jvm {
37-
compilations.all {
38-
kotlinOptions.jvmTarget = "17"
39-
}
40-
testRuns["test"].executionTask.configure {
41-
useJUnitPlatform()
42-
}
43-
}
42+
jvm()
4443

4544
androidTarget {
45+
@OptIn(ExperimentalKotlinGradlePluginApi::class)
46+
compilerOptions {
47+
jvmTarget.set(JvmTarget.JVM_17)
48+
}
4649
publishLibraryVariants("release", "debug")
4750
}
4851

4952
js(IR) {
50-
compilations.all {
51-
kotlinOptions.freeCompilerArgs += listOf(
52-
"-Xopt-in=kotlin.js.ExperimentalJsExport"
53-
)
53+
binaries.library()
54+
useCommonJs()
55+
browser {
56+
testTask(Action {
57+
useMocha {
58+
timeout = "10s"
59+
}
60+
})
5461
}
62+
}
63+
64+
wasmJs {
5565
binaries.library()
5666
useCommonJs()
5767
browser {
@@ -70,6 +80,7 @@ kotlin {
7080
).forEach {
7181
it.binaries.framework {
7282
baseName = "commonstatemachine"
83+
isStatic = true
7384
}
7485
}
7586

@@ -109,15 +120,6 @@ kotlin {
109120
val iosSimulatorArm64Test by getting
110121
val iosTest by creating
111122
}
112-
targets.all {
113-
compilations.all {
114-
kotlinOptions {
115-
freeCompilerArgs = freeCompilerArgs + listOf(
116-
"-opt-in=kotlin.RequiresOptIn"
117-
)
118-
}
119-
}
120-
}
121123
}
122124

123125
android {
@@ -141,7 +143,7 @@ android {
141143
}
142144
val dokkaHtml by tasks.getting(DokkaTask::class)
143145

144-
val javadocJar by tasks.creating(Jar::class) {
146+
val javadocJar by tasks.registering(Jar::class) {
145147
dependsOn(dokkaHtml)
146148
group = "documentation"
147149
archiveClassifier.set("javadoc")

coroutines/build.gradle.kts

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
* limitations under the License.
1212
*/
1313

14-
@file:Suppress("DSL_SCOPE_VIOLATION")
14+
@file:Suppress("unused")
1515

1616
import org.jetbrains.dokka.gradle.DokkaTask
17+
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
18+
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
19+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
1720

1821
plugins {
1922
id("org.jetbrains.kotlin.multiplatform")
@@ -34,26 +37,30 @@ version = rootProject.version
3437
println("== Project version: $versionName ==")
3538

3639
kotlin {
37-
38-
jvm {
39-
compilations.all {
40-
kotlinOptions.jvmTarget = "17"
41-
}
42-
testRuns["test"].executionTask.configure {
43-
useJUnitPlatform()
44-
}
45-
}
40+
jvm()
4641

4742
androidTarget {
43+
@OptIn(ExperimentalKotlinGradlePluginApi::class)
44+
compilerOptions {
45+
jvmTarget.set(JvmTarget.JVM_17)
46+
}
4847
publishLibraryVariants("release", "debug")
4948
}
5049

5150
js(IR) {
52-
compilations.all {
53-
kotlinOptions.freeCompilerArgs += listOf(
54-
"-Xopt-in=kotlin.js.ExperimentalJsExport"
55-
)
51+
binaries.library()
52+
useCommonJs()
53+
browser {
54+
testTask(Action {
55+
useMocha {
56+
timeout = "10s"
57+
}
58+
})
5659
}
60+
}
61+
62+
@OptIn(ExperimentalWasmDsl::class)
63+
wasmJs {
5764
binaries.library()
5865
useCommonJs()
5966
browser {
@@ -72,6 +79,7 @@ kotlin {
7279
).forEach {
7380
it.binaries.framework {
7481
baseName = "coroutines"
82+
isStatic = true
7583
}
7684
}
7785

@@ -103,15 +111,6 @@ kotlin {
103111
val iosSimulatorArm64Test by getting
104112
val iosTest by creating
105113
}
106-
targets.all {
107-
compilations.all {
108-
kotlinOptions {
109-
freeCompilerArgs = freeCompilerArgs + listOf(
110-
"-opt-in=kotlin.RequiresOptIn"
111-
)
112-
}
113-
}
114-
}
115114
}
116115

117116
android {
@@ -135,7 +134,7 @@ android {
135134
}
136135
val dokkaHtml by tasks.getting(DokkaTask::class)
137136

138-
val javadocJar by tasks.creating(Jar::class) {
137+
val javadocJar by tasks.registering(Jar::class) {
139138
dependsOn(dokkaHtml)
140139
group = "documentation"
141140
archiveClassifier.set("javadoc")

coroutines/src/commonMain/kotlin/com/motorro/commonstatemachine/coroutines/CoroutineState.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ abstract class CoroutineState<G: Any, U: Any>: CommonMachineState<G, U>() {
2626
/**
2727
* Internal coroutine context bound to state lifecycle
2828
*/
29-
protected val stateScope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
29+
protected val stateScope by lazy {
30+
CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
31+
}
3032

3133
/**
3234
* A part of [clear] template to clean-up state

examples/androidcore/build.gradle

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2+
13
/*
24
* Copyright 2022 Nikolai Kotchetkov.
35
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -40,8 +42,10 @@ android {
4042
targetCompatibility JavaVersion.VERSION_17
4143
coreLibraryDesugaringEnabled true
4244
}
43-
kotlinOptions {
44-
jvmTarget = "17"
45+
kotlin {
46+
compilerOptions {
47+
jvmTarget.set(JvmTarget.JVM_17)
48+
}
4549
}
4650
buildFeatures {
4751
compose true

examples/commoncore/build.gradle.kts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* limitations under the License.
1212
*/
1313

14-
@file:Suppress("DSL_SCOPE_VIOLATION")
14+
@file:Suppress("DSL_SCOPE_VIOLATION", "unused")
1515

1616
plugins {
1717
id("org.jetbrains.kotlin.multiplatform")
@@ -32,11 +32,6 @@ kotlin {
3232
}
3333

3434
js(IR) {
35-
compilations.all {
36-
kotlinOptions.freeCompilerArgs += listOf(
37-
"-Xopt-in=kotlin.js.ExperimentalJsExport"
38-
)
39-
}
4035
binaries.library()
4136
useCommonJs()
4237
browser {
@@ -69,15 +64,6 @@ kotlin {
6964
val jsMain by getting
7065
val jsTest by getting
7166
}
72-
targets.all {
73-
compilations.all {
74-
kotlinOptions {
75-
freeCompilerArgs = freeCompilerArgs + listOf(
76-
"-opt-in=kotlin.RequiresOptIn"
77-
)
78-
}
79-
}
80-
}
8167
}
8268

8369
android {

examples/lce/build.gradle

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2+
13
/*
24
* Copyright 2022 Nikolai Kotchetkov.
35
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -44,8 +46,10 @@ android {
4446
sourceCompatibility JavaVersion.VERSION_17
4547
targetCompatibility JavaVersion.VERSION_17
4648
}
47-
kotlinOptions {
48-
jvmTarget = "17"
49+
kotlin {
50+
compilerOptions {
51+
jvmTarget.set(JvmTarget.JVM_17)
52+
}
4953
}
5054
buildFeatures {
5155
compose true

examples/lifecycle/build.gradle.kts

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1+
@file:Suppress("unused")
2+
3+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
4+
5+
16
/*
2-
* Copyright 2023 Nikolai Kotchetkov.
3-
* Licensed under the Apache License, Version 2.0 (the "License");
4-
* you may not use this file except in compliance with the License.
5-
* You may obtain a copy of the License at
6-
* http://www.apache.org/licenses/LICENSE-2.0
7-
* Unless required by applicable law or agreed to in writing, software
8-
* distributed under the License is distributed on an "AS IS" BASIS,
9-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10-
* See the License for the specific language governing permissions and
11-
* limitations under the License.
12-
*/
7+
* Copyright 2023 Nikolai Kotchetkov.
8+
* Licensed under the Apache License, Version 2.0 (the "License");
9+
* you may not use this file except in compliance with the License.
10+
* You may obtain a copy of the License at
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
1318

1419
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
1520
plugins {
@@ -55,8 +60,10 @@ android {
5560
sourceCompatibility = JavaVersion.VERSION_17
5661
targetCompatibility = JavaVersion.VERSION_17
5762
}
58-
kotlinOptions {
59-
jvmTarget = "17"
63+
kotlin {
64+
compilerOptions {
65+
jvmTarget.set(JvmTarget.JVM_17)
66+
}
6067
}
6168
buildFeatures {
6269
compose = true

0 commit comments

Comments
 (0)