@@ -5,6 +5,7 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
5
5
import org.gradle.api.tasks.testing.logging.TestLogEvent
6
6
import org.jetbrains.dokka.gradle.DokkaTask
7
7
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
8
+ import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
8
9
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetWithTests
9
10
import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType
10
11
import java.net.URL
@@ -60,22 +61,18 @@ kotlin {
60
61
}
61
62
}
62
63
browser {
63
- testTask(
64
- Action {
65
- useMocha {
66
- timeout = " 10s"
67
- }
68
- },
69
- )
64
+ testTask {
65
+ useMocha {
66
+ timeout = " 10s"
67
+ }
68
+ }
70
69
}
71
70
nodejs {
72
- testTask(
73
- Action {
74
- useMocha {
75
- timeout = " 10s"
76
- }
77
- },
78
- )
71
+ testTask {
72
+ useMocha {
73
+ timeout = " 10s"
74
+ }
75
+ }
79
76
}
80
77
}
81
78
@@ -107,130 +104,28 @@ kotlin {
107
104
androidNativeX64()
108
105
109
106
sourceSets {
110
- val commonMain by getting {
107
+ commonMain {
111
108
dependencies {
112
109
api(" org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion " )
113
110
}
114
111
}
115
- val commonTest by getting {
112
+ commonTest {
116
113
dependencies {
117
114
implementation(kotlin(" test-common" ))
118
115
implementation(kotlin(" test-annotations-common" ))
119
116
implementation(" org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion " )
120
117
}
121
118
}
122
- val jvmMain by getting {
123
- dependsOn(commonMain)
124
- }
125
- val jvmTest by getting {
126
- dependsOn(commonTest)
127
-
119
+ jvmTest {
128
120
dependencies {
129
121
implementation(kotlin(" test-junit" ))
130
122
}
131
123
}
132
- val jsMain by getting {
133
- dependsOn(commonMain)
134
- }
135
- val jsTest by getting {
124
+ jsTest {
136
125
dependencies {
137
126
implementation(kotlin(" test-js" ))
138
127
}
139
128
}
140
-
141
- val nativeMain by creating {
142
- dependsOn(commonMain)
143
- }
144
- val nativeTest by creating {
145
- dependsOn(commonTest)
146
- }
147
-
148
- val darwinMain by creating {
149
- dependsOn(nativeMain)
150
- }
151
- val darwinTest by creating {
152
- dependsOn(nativeTest)
153
- }
154
-
155
- val linuxMain by creating {
156
- dependsOn(nativeMain)
157
- }
158
- val linuxTest by creating {
159
- dependsOn(nativeTest)
160
- }
161
-
162
- val pthreadAndroidMain by creating {
163
- dependsOn(nativeMain)
164
- }
165
- val pthreadAndroidTest by creating {
166
- dependsOn(nativeTest)
167
- }
168
-
169
- val appleTargets =
170
- listOf (
171
- " iosX64" ,
172
- " iosSimulatorArm64" ,
173
- " iosArm64" ,
174
- " macosX64" ,
175
- " macosArm64" ,
176
- " tvosArm64" ,
177
- " tvosX64" ,
178
- " tvosSimulatorArm64" ,
179
- " watchosArm32" ,
180
- " watchosArm64" ,
181
- " watchosSimulatorArm64" ,
182
- " watchosX64" ,
183
- " watchosSimulatorArm64" ,
184
- " watchosDeviceArm64" ,
185
- )
186
-
187
- val linuxTargets =
188
- listOf (
189
- " linuxX64" ,
190
- " linuxArm64" ,
191
- )
192
-
193
- val androidNativeTargets =
194
- listOf (
195
- " androidNativeArm32" ,
196
- " androidNativeArm64" ,
197
- " androidNativeX86" ,
198
- " androidNativeX64" ,
199
- )
200
-
201
- appleTargets.forEach {
202
- getByName(" ${it} Main" ) {
203
- dependsOn(darwinMain)
204
- }
205
- getByName(" ${it} Test" ) {
206
- dependsOn(darwinTest)
207
- }
208
- }
209
-
210
- linuxTargets.forEach {
211
- getByName(" ${it} Main" ) {
212
- dependsOn(linuxMain)
213
- }
214
- getByName(" ${it} Test" ) {
215
- dependsOn(linuxTest)
216
- }
217
- }
218
-
219
- androidNativeTargets.forEach {
220
- getByName(" ${it} Main" ) {
221
- dependsOn(pthreadAndroidMain)
222
- }
223
- getByName(" ${it} Test" ) {
224
- dependsOn(pthreadAndroidTest)
225
- }
226
- }
227
-
228
- getByName(" mingwX64Main" ) {
229
- dependsOn(nativeMain)
230
- }
231
- getByName(" mingwX64Test" ) {
232
- dependsOn(nativeTest)
233
- }
234
129
}
235
130
236
131
// enable running ios tests on a background thread as well
@@ -250,6 +145,19 @@ kotlin {
250
145
}
251
146
}
252
147
148
+ tasks.withType<KotlinCompile <* >>().configureEach {
149
+ kotlinOptions {
150
+ // 'expect'/'actual' classes (including interfaces, objects, annotations, enums,
151
+ // and 'actual' typealiases) are in Beta.
152
+ // You can use -Xexpect-actual-classes flag to suppress this warning.
153
+ // Also see: https://youtrack.jetbrains.com/issue/KT-61573
154
+ freeCompilerArgs + =
155
+ listOf (
156
+ " -Xexpect-actual-classes" ,
157
+ )
158
+ }
159
+ }
160
+
253
161
spotless {
254
162
kotlin {
255
163
target(" **/*.kt" )
0 commit comments