@@ -6,6 +6,7 @@ import java.io.ByteArrayOutputStream
66import java.io.PrintWriter
77import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask
88import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
9+ import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
910import org.jetbrains.kotlin.konan.target.Family
1011
1112plugins {
@@ -35,53 +36,50 @@ java {
3536kotlin {
3637 explicitApi()
3738
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()
4946 }
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+ }
6477 }
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()
7280 }
7381 }
7482 }
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" )
8583 }
8684 }
8785
@@ -107,7 +105,6 @@ kotlin {
107105 kotlinOptions {
108106 sourceMap = true
109107 moduleKind = " umd"
110- metaInfo = true
111108 }
112109 }
113110// compilations["main"].apply {
@@ -131,6 +128,33 @@ kotlin {
131128 nodejs()
132129 }
133130
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+
134158 @OptIn(ExperimentalKotlinGradlePluginApi ::class )
135159 compilerOptions {
136160 freeCompilerArgs.add(" -Xexpect-actual-classes" )
@@ -149,9 +173,6 @@ kotlin {
149173 }
150174
151175 targets.withType< org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget > {
152- compilations[" test" ].kotlinOptions {
153- freeCompilerArgs + = listOf (" -trw" )
154- }
155176 if (konanTarget.family == Family .MINGW ) {
156177 compilations[" test" ].cinterops {
157178 create(" modern_api" ) {
@@ -161,6 +182,7 @@ kotlin {
161182 }
162183 }
163184 }
185+
164186 sourceSets {
165187 commonMain {
166188 dependencies {
@@ -174,78 +196,30 @@ kotlin {
174196 }
175197 }
176198
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 {
196200 dependencies {
197201 api(" org.jetbrains.kotlinx:kotlinx-serialization-core:$serializationVersion " )
198202 implementation(npm(" @js-joda/core" , " 3.2.0" ))
199203 }
200204 }
201205
202- val commonJsTest by creating {
203- dependsOn(commonKotlinTest)
206+ val commonJsTest by getting {
204207 dependencies {
205208 implementation(npm(" @js-joda/timezone" , " 2.3.0" ))
206209 }
207210 }
208211
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+ }
235216 }
236217
237218 val wasmWasiTest by getting {
238- dependsOn(commonKotlinTest)
239219 dependencies {
240220 runtimeOnly(project(" :kotlinx-datetime-zoneinfo" ))
241221 }
242222 }
243-
244- val darwinMain by getting {
245- }
246-
247- val darwinTest by getting {
248- }
249223 }
250224}
251225
0 commit comments