@@ -56,7 +56,6 @@ android {
5656 }
5757 defaultConfig {
5858 minSdk = 23
59- targetSdk = 31
6059 setCompileSdkVersion(30 )
6160 testInstrumentationRunner = " android.support.test.runner.AndroidJUnitRunner"
6261 }
@@ -138,9 +137,18 @@ kotlin {
138137 mavenPublication { setupPom(artifactId) }
139138 }
140139
141- ios {
140+ iosX64 {
142141 binaries { framework { baseName = " spotify" } }
142+ mavenPublication { setupPom(artifactId) }
143+ }
144+
145+ iosArm64 {
146+ binaries { framework { baseName = " spotify" } }
147+ mavenPublication { setupPom(artifactId) }
148+ }
143149
150+ iosSimulatorArm64 {
151+ binaries { framework { baseName = " spotify" } }
144152 mavenPublication { setupPom(artifactId) }
145153 }
146154
@@ -158,146 +166,145 @@ kotlin {
158166 mavenPublication { setupPom(artifactId) }
159167 }*/
160168
161- targets {
162- sourceSets {
163- val kotlinxDatetimeVersion : String by project
164- val kotlinxSerializationVersion : String by project
165- val kotlinxCoroutinesVersion : String by project
166- val ktorVersion : String by project
167-
168- val sparkVersion : String by project
169- val korlibsVersion : String by project
170-
171- val commonMain by getting {
172- dependencies {
173- implementation( " org.jetbrains.kotlinx:kotlinx-serialization-json: $kotlinxSerializationVersion " )
174- implementation(" io.ktor:ktor-client-core: $ktorVersion " )
175- implementation(" com.soywiz.korlibs.krypto:krypto: $korlibsVersion " )
176- implementation(" com.soywiz.korlibs.korim:korim :$korlibsVersion " )
177- implementation(" org.jetbrains.kotlinx:kotlinx-datetime: $kotlinxDatetimeVersion " )
178- implementation(" org.jetbrains.kotlinx:kotlinx-coroutines-core: $kotlinxCoroutinesVersion " )
179- }
169+ applyDefaultHierarchyTemplate()
170+
171+ sourceSets {
172+ val kotlinxDatetimeVersion : String by project
173+ val kotlinxSerializationVersion : String by project
174+ val kotlinxCoroutinesVersion : String by project
175+ val ktorVersion : String by project
176+
177+ val sparkVersion : String by project
178+ val korlibsVersion : String by project
179+
180+ commonMain {
181+ dependencies {
182+ implementation(" org.jetbrains.kotlinx:kotlinx-serialization-json: $kotlinxSerializationVersion " )
183+ implementation(" io.ktor:ktor-client-core: $ktorVersion " )
184+ implementation(" com.soywiz.korlibs.krypto:krypto :$korlibsVersion " )
185+ implementation(" com.soywiz.korlibs.korim:korim: $korlibsVersion " )
186+ implementation(" org.jetbrains.kotlinx:kotlinx-datetime: $kotlinxDatetimeVersion " )
187+ implementation( " org.jetbrains.kotlinx:kotlinx-coroutines-core: $kotlinxCoroutinesVersion " )
180188 }
189+ }
181190
182- val commonTest by getting {
183- dependencies {
184- implementation(" org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinxCoroutinesVersion " )
185- implementation(kotlin(" test-common" ))
186- implementation(kotlin(" test-annotations-common" ))
187- }
191+ commonTest {
192+ dependencies {
193+ implementation(" org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinxCoroutinesVersion " )
194+ implementation(kotlin(" test-common" ))
195+ implementation(kotlin(" test-annotations-common" ))
188196 }
197+ }
189198
190- val commonJvmLikeMain by creating {
191- dependsOn(commonMain)
199+ val commonJvmLikeMain by creating {
200+ dependsOn(commonMain.get() )
192201
193- dependencies {
194- implementation(" net.sourceforge.streamsupport:android-retrofuture:1.7.3" )
195- }
202+ dependencies {
203+ implementation(" net.sourceforge.streamsupport:android-retrofuture:1.7.3" )
196204 }
205+ }
197206
198- val commonJvmLikeTest by creating {
199- dependencies {
200- implementation(kotlin(" test-junit" ))
201- implementation(" com.sparkjava:spark-core:$sparkVersion " )
202- runtimeOnly(kotlin(" reflect" ))
203- }
207+ val commonJvmLikeTest by creating {
208+ dependencies {
209+ implementation(kotlin(" test-junit" ))
210+ implementation(" com.sparkjava:spark-core:$sparkVersion " )
211+ runtimeOnly(kotlin(" reflect" ))
204212 }
213+ }
205214
206- val commonNonJvmTargetsTest by creating {
207- dependsOn(commonTest)
208- }
215+ val commonNonJvmTargetsTest by creating {
216+ dependsOn(commonTest.get() )
217+ }
209218
210- val jvmMain by getting {
211- dependsOn(commonJvmLikeMain)
212- repositories {
213- mavenCentral()
214- }
219+ jvmMain {
220+ dependsOn(commonJvmLikeMain)
215221
216- dependencies {
217- implementation(" io.ktor:ktor-client-cio:$ktorVersion " )
218- }
222+ repositories {
223+ mavenCentral()
219224 }
220225
221- val jvmTest by getting {
222- dependsOn(commonJvmLikeTest )
226+ dependencies {
227+ implementation( " io.ktor:ktor-client-cio: $ktorVersion " )
223228 }
229+ }
224230
225- val jsMain by getting {
226- dependencies {
227- implementation(" io.ktor:ktor-client-js:$ktorVersion " )
228- implementation(kotlin(" stdlib-js" ))
229- }
231+ jvmTest.get().dependsOn(commonJvmLikeTest)
232+
233+ jsMain {
234+ dependencies {
235+ implementation(" io.ktor:ktor-client-js:$ktorVersion " )
236+ implementation(kotlin(" stdlib-js" ))
230237 }
238+ }
231239
232- val jsTest by getting {
233- dependsOn(commonNonJvmTargetsTest)
240+ jsTest {
241+ dependsOn(commonNonJvmTargetsTest)
234242
235- dependencies {
236- implementation(kotlin(" test-js" ))
237- }
243+ dependencies {
244+ implementation(kotlin(" test-js" ))
238245 }
246+ }
239247
240- val androidMain by getting {
241- dependsOn(commonJvmLikeMain)
248+ androidMain {
249+ dependsOn(commonJvmLikeMain)
242250
243- repositories {
244- mavenCentral()
245- }
251+ repositories {
252+ mavenCentral()
253+ }
246254
247- dependencies {
248- val androidSpotifyAuthVersion: String by project
249- val androidCryptoVersion: String by project
250- val androidxCompatVersion: String by project
255+ dependencies {
256+ val androidSpotifyAuthVersion: String by project
257+ val androidCryptoVersion: String by project
258+ val androidxCompatVersion: String by project
251259
252- api(" com.spotify.android:auth:$androidSpotifyAuthVersion " )
253- implementation(" io.ktor:ktor-client-okhttp:$ktorVersion " )
254- implementation(" androidx.security:security-crypto:$androidCryptoVersion " )
255- implementation(" androidx.appcompat:appcompat:$androidxCompatVersion " )
256- }
260+ api(" com.spotify.android:auth:$androidSpotifyAuthVersion " )
261+ implementation(" io.ktor:ktor-client-okhttp:$ktorVersion " )
262+ implementation(" androidx.security:security-crypto:$androidCryptoVersion " )
263+ implementation(" androidx.appcompat:appcompat:$androidxCompatVersion " )
257264 }
265+ }
258266
259- val androidUnitTest by getting {
260- dependsOn(commonJvmLikeTest)
261- }
267+ val androidUnitTest by getting {
268+ dependsOn(commonJvmLikeTest)
269+ }
262270
263- // as kotlin/native, they require special ktor versions
264- val desktopMain by creating {
265- dependsOn(commonMain)
271+ // desktop targets
272+ // as kotlin/native, they require special ktor versions
273+ val desktopMain by creating {
274+ dependsOn(commonMain.get())
266275
267- dependencies {
268- implementation(" io.ktor:ktor-client-curl:$ktorVersion " )
269- }
276+ dependencies {
277+ implementation(" io.ktor:ktor-client-curl:$ktorVersion " )
270278 }
279+ }
271280
272- val nativeDarwinMain by creating {
273- dependsOn(commonMain)
281+ linuxMain.get().dependsOn(desktopMain)
282+ mingwMain.get().dependsOn(desktopMain)
283+ macosMain.get().dependsOn(desktopMain)
274284
275- dependencies {
276- implementation(" io.ktor:ktor-client-ios:$ktorVersion " )
277- }
285+ val desktopTest by creating { dependsOn(commonNonJvmTargetsTest) }
286+ linuxTest.get().dependsOn(desktopTest)
287+ mingwTest.get().dependsOn(desktopTest)
288+ macosTest.get().dependsOn(desktopTest)
289+
290+ // darwin targets
291+
292+ val nativeDarwinMain by creating {
293+ dependsOn(commonMain.get())
294+
295+ dependencies {
296+ implementation(" io.ktor:ktor-client-ios:$ktorVersion " )
278297 }
298+ }
299+
300+ val nativeDarwinTest by creating { dependsOn(commonNonJvmTargetsTest) }
301+
302+ iosMain.get().dependsOn(nativeDarwinMain)
303+ iosTest.get().dependsOn(nativeDarwinTest)
279304
280- // desktop targets
281- val desktopTest by creating { dependsOn(commonNonJvmTargetsTest) }
282- val linuxX64Main by getting { dependsOn(desktopMain) }
283- val linuxX64Test by getting { dependsOn(desktopTest) }
284- val mingwX64Main by getting { dependsOn(desktopMain) }
285- val mingwX64Test by getting { dependsOn(desktopTest) }
286- val macosX64Main by getting { dependsOn(desktopMain) }
287- val macosX64Test by getting { dependsOn(desktopTest) }
288-
289- // darwin targets
290- val nativeDarwinTest by creating { dependsOn(commonNonJvmTargetsTest) }
291- val iosMain by getting { dependsOn(nativeDarwinMain) }
292- val iosTest by getting { dependsOn(nativeDarwinTest) }
293-
294- // !! unable to include currently due to korlibs not being available !!
295- // val tvosMain by getting { dependsOn(nativeDarwinMain) }
296- // val tvosTest by getting { dependsOn(nativeDarwinTest) }
297- // val watchosMain by getting { dependsOn(nativeDarwinMain) }
298- // val watchosTest by getting { dependsOn(nativeDarwinTest) }
299-
300- all { languageSettings.optIn(" kotlin.RequiresOptIn" ) }
305+ all {
306+ languageSettings.optIn(" kotlin.RequiresOptIn" )
307+ languageSettings.optIn(" kotlinx.serialization.ExperimentalSerializationApi" )
301308 }
302309 }
303310
@@ -307,7 +314,7 @@ kotlin {
307314}
308315
309316tasks {
310- val dokkaHtml by getting( DokkaTask :: class ) {
317+ dokkaHtml {
311318 outputDirectory.set(projectDir.resolve(" docs" ))
312319
313320 dokkaSourceSets {
@@ -352,7 +359,7 @@ tasks {
352359 val framework = kotlin.targets.getByName<KotlinNativeTarget >(targetName).binaries.getFramework(mode)
353360 inputs.property(" mode" , mode)
354361 dependsOn(framework.linkTask)
355- val targetDir = File (buildDir , " xcode-frameworks" )
362+ val targetDir = File (layout.buildDirectory.asFile.get() , " xcode-frameworks" )
356363 from({ framework.outputDirectory })
357364 into(targetDir)
358365 }
0 commit comments