@@ -6,6 +6,7 @@ import java.io.ByteArrayOutputStream
6
6
import java.io.PrintWriter
7
7
import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask
8
8
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
9
+ import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
9
10
import org.jetbrains.kotlin.konan.target.Family
10
11
11
12
plugins {
@@ -35,53 +36,50 @@ java {
35
36
kotlin {
36
37
explicitApi()
37
38
38
- infra {
39
- common(" tzfile" ) {
40
- // Tiers are in accordance with <https://kotlinlang.org/docs/native-target-support.html>
41
- common(" tzdbOnFilesystem" ) {
42
- common(" linux" ) {
43
- // Tier 1
44
- target(" linuxX64" )
45
- // Tier 2
46
- target(" linuxArm64" )
47
- // Tier 4 (deprecated, but still in demand)
48
- target(" linuxArm32Hfp" )
39
+ @OptIn(ExperimentalKotlinGradlePluginApi ::class )
40
+ applyDefaultHierarchyTemplate {
41
+ common {
42
+ group(" commonKotlin" ) {
43
+ group(" commonJs" ) {
44
+ withJs()
45
+ withWasmJs()
49
46
}
50
- common(" darwin" ) {
51
- common(" darwinDevices" ) {
52
- // Tier 1
53
- target(" macosX64" )
54
- target(" macosArm64" )
55
- // Tier 2
56
- target(" watchosX64" )
57
- target(" watchosArm32" )
58
- target(" watchosArm64" )
59
- target(" tvosX64" )
60
- target(" tvosArm64" )
61
- target(" iosArm64" )
62
- // Tier 3
63
- target(" watchosDeviceArm64" )
47
+ withWasmWasi()
48
+ group(" native" ) {
49
+ group(" tzfile" ) {
50
+ group(" tzdbOnFilesystem" ) {
51
+ group(" linux" ) {
52
+ withLinux()
53
+ }
54
+ group(" darwin" ) {
55
+ group(" darwinDevices" ) {
56
+ withMacosX64()
57
+ withMacosArm64()
58
+ withWatchosX64()
59
+ withWatchosArm32()
60
+ withWatchosArm64()
61
+ withTvosX64()
62
+ withTvosArm64()
63
+ withIosArm64()
64
+ withWatchosDeviceArm64()
65
+ }
66
+ group(" darwinSimulator" ) {
67
+ withIosSimulatorArm64()
68
+ withIosX64()
69
+ withWatchosSimulatorArm64()
70
+ withTvosSimulatorArm64()
71
+ }
72
+ }
73
+ }
74
+ group(" androidNative" ) {
75
+ withAndroidNative()
76
+ }
64
77
}
65
- common(" darwinSimulator" ) {
66
- // Tier 1
67
- target(" iosSimulatorArm64" )
68
- target(" iosX64" )
69
- // Tier 2
70
- target(" watchosSimulatorArm64" )
71
- target(" tvosSimulatorArm64" )
78
+ group(" windows" ) {
79
+ withMingw()
72
80
}
73
81
}
74
82
}
75
- common(" androidNative" ) {
76
- target(" androidNativeArm32" )
77
- target(" androidNativeArm64" )
78
- target(" androidNativeX86" )
79
- target(" androidNativeX64" )
80
- }
81
- }
82
- // Tier 3
83
- common(" windows" ) {
84
- target(" mingwX64" )
85
83
}
86
84
}
87
85
@@ -107,7 +105,6 @@ kotlin {
107
105
kotlinOptions {
108
106
sourceMap = true
109
107
moduleKind = " umd"
110
- metaInfo = true
111
108
}
112
109
}
113
110
// compilations["main"].apply {
@@ -131,6 +128,33 @@ kotlin {
131
128
nodejs()
132
129
}
133
130
131
+ // Tiers are in accordance with <https://kotlinlang.org/docs/native-target-support.html>
132
+ // Tier 1
133
+ macosX64()
134
+ macosArm64()
135
+ iosSimulatorArm64()
136
+ iosX64()
137
+ iosArm64()
138
+ // Tier 2
139
+ linuxX64()
140
+ linuxArm64()
141
+ watchosSimulatorArm64()
142
+ watchosX64()
143
+ watchosArm32()
144
+ watchosArm64()
145
+ tvosSimulatorArm64()
146
+ tvosX64()
147
+ tvosArm64()
148
+ // Tier 3
149
+ androidNativeArm32()
150
+ androidNativeArm64()
151
+ androidNativeX86()
152
+ androidNativeX64()
153
+ mingwX64()
154
+ watchosDeviceArm64()
155
+ // Deprecated
156
+ @Suppress(" DEPRECATION" ) linuxArm32Hfp()
157
+
134
158
@OptIn(ExperimentalKotlinGradlePluginApi ::class )
135
159
compilerOptions {
136
160
freeCompilerArgs.add(" -Xexpect-actual-classes" )
@@ -149,9 +173,6 @@ kotlin {
149
173
}
150
174
151
175
targets.withType< org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget > {
152
- compilations[" test" ].kotlinOptions {
153
- freeCompilerArgs + = listOf (" -trw" )
154
- }
155
176
if (konanTarget.family == Family .MINGW ) {
156
177
compilations[" test" ].cinterops {
157
178
create(" modern_api" ) {
@@ -161,6 +182,7 @@ kotlin {
161
182
}
162
183
}
163
184
}
185
+
164
186
sourceSets {
165
187
commonMain {
166
188
dependencies {
@@ -174,78 +196,30 @@ kotlin {
174
196
}
175
197
}
176
198
177
- val commonKotlinMain by creating {
178
- dependsOn(commonMain.get())
179
- dependencies {
180
- api(" org.jetbrains.kotlinx:kotlinx-serialization-core:$serializationVersion " )
181
- }
182
- }
183
-
184
- val commonKotlinTest by creating {
185
- dependsOn(commonTest.get())
186
- }
187
-
188
- val jvmMain by getting {
189
- }
190
-
191
- val jvmTest by getting {
192
- }
193
-
194
- val commonJsMain by creating {
195
- dependsOn(commonKotlinMain)
199
+ val commonJsMain by getting {
196
200
dependencies {
197
201
api(" org.jetbrains.kotlinx:kotlinx-serialization-core:$serializationVersion " )
198
202
implementation(npm(" @js-joda/core" , " 3.2.0" ))
199
203
}
200
204
}
201
205
202
- val commonJsTest by creating {
203
- dependsOn(commonKotlinTest)
206
+ val commonJsTest by getting {
204
207
dependencies {
205
208
implementation(npm(" @js-joda/timezone" , " 2.3.0" ))
206
209
}
207
210
}
208
211
209
- val jsMain by getting {
210
- dependsOn(commonJsMain)
211
- }
212
-
213
- val jsTest by getting {
214
- dependsOn(commonJsTest)
215
- }
216
-
217
- val wasmJsMain by getting {
218
- dependsOn(commonJsMain)
219
- }
220
-
221
- val wasmJsTest by getting {
222
- dependsOn(commonJsTest)
223
- }
224
-
225
- val nativeMain by getting {
226
- dependsOn(commonKotlinMain)
227
- }
228
-
229
- val nativeTest by getting {
230
- dependsOn(commonKotlinTest)
231
- }
232
-
233
- val wasmWasiMain by getting {
234
- dependsOn(commonKotlinMain)
212
+ val commonKotlinMain by getting {
213
+ dependencies {
214
+ api(" org.jetbrains.kotlinx:kotlinx-serialization-core:$serializationVersion " )
215
+ }
235
216
}
236
217
237
218
val wasmWasiTest by getting {
238
- dependsOn(commonKotlinTest)
239
219
dependencies {
240
220
runtimeOnly(project(" :kotlinx-datetime-zoneinfo" ))
241
221
}
242
222
}
243
-
244
- val darwinMain by getting {
245
- }
246
-
247
- val darwinTest by getting {
248
- }
249
223
}
250
224
}
251
225
0 commit comments