Skip to content

Commit ff9491a

Browse files
committed
abstract desktop logic into desktop source set
Signed-off-by: Adam Ratzman <[email protected]>
1 parent 235fb46 commit ff9491a

File tree

12 files changed

+47
-23
lines changed

12 files changed

+47
-23
lines changed

build.gradle.kts

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ plugins {
66
`maven-publish`
77
signing
88
id("io.codearte.nexus-staging") version "0.22.0"
9+
id("com.android.library")
910
kotlin("multiplatform") version "1.4.21"
1011
kotlin("plugin.serialization") version "1.4.21"
1112
id("com.diffplug.gradle.spotless") version "4.4.0"
1213
id("com.moowork.node") version "1.3.1"
1314
id("org.jetbrains.dokka") version "1.4.20"
14-
id("com.android.library")
1515
id("kotlin-android-extensions")
1616
}
1717

@@ -148,13 +148,10 @@ kotlin {
148148

149149
val hostOs = System.getProperty("os.name")
150150
val isMingwX64 = hostOs.startsWith("Windows")
151-
val nativeTarget = when {
152-
hostOs == "Mac OS X" -> macosX64("native")
153-
hostOs == "Linux" -> linuxX64("native")
154-
isMingwX64 -> mingwX64("native")
155-
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
156-
}
157151

152+
macosX64()
153+
linuxX64()
154+
mingwX64()
158155

159156
targets {
160157
sourceSets {
@@ -169,9 +166,9 @@ kotlin {
169166
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$serializationVersion")
170167
implementation("io.ktor:ktor-client-core:$ktorVersion")
171168
implementation("org.jetbrains.kotlinx:kotlinx-datetime:$kotlinxDatetimeVersion")
172-
implementation("com.autodesk:coroutineworker:0.6.2")
173169
}
174170
}
171+
175172
val commonTest by getting {
176173
dependencies {
177174
implementation(kotlin("test-common"))
@@ -234,17 +231,44 @@ kotlin {
234231
}
235232
}
236233

237-
val nativeMain by getting {
234+
val desktopMain by creating {
235+
dependsOn(commonMain)
236+
238237
dependencies {
239238
implementation("io.ktor:ktor-client-curl:$ktorVersion")
240239
}
241240
}
242-
val nativeTest by getting {
241+
242+
val desktopTest by creating {
243243
dependencies {
244244

245245
}
246246
}
247247

248+
val linuxX64Main by getting {
249+
dependsOn(desktopMain)
250+
}
251+
252+
val linuxX64Test by getting {
253+
dependsOn(desktopTest)
254+
}
255+
256+
val mingwX64Main by getting {
257+
dependsOn(desktopMain)
258+
}
259+
260+
val mingwX64Test by getting {
261+
dependsOn(desktopTest)
262+
}
263+
264+
val macosX64Main by getting {
265+
dependsOn(desktopMain)
266+
}
267+
268+
val macosX64Test by getting {
269+
dependsOn(desktopTest)
270+
}
271+
248272
all {
249273
languageSettings.useExperimentalAnnotation("kotlin.Experimental")
250274
}
@@ -259,10 +283,10 @@ publishing {
259283
setupPom(artifactId)
260284
}
261285

262-
val metadata by getting(MavenPublication::class) {
286+
/*val metadata by getting(MavenPublication::class) {
263287
artifactId = "spotify-api-kotlin-metadata"
264288
setupPom(artifactId)
265-
}
289+
}*/
266290
}
267291

268292
repositories {

gradle.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
systemProp.org.gradle.internal.publish.checksums.insecure=true
22
org.gradle.daemon=true
3-
org.gradle.jvmargs=-Xmx4000m
3+
org.gradle.jvmargs=-Xmx8000m
4+
kotlin.mpp.enableGranularSourceSetsMetadata=true
5+
kotlin.native.enableDependencyPropagation=false

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ pluginManagement {
2828
}
2929
}
3030

31-
rootProject.name = "spotify-web-api-kotlin"
31+
rootProject.name = "spotify-api-kotlin"
3232

Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/* Spotify Web API, Kotlin Wrapper; MIT License, 2017-2021; Original author: Adam Ratzman */
22
package com.adamratzman.spotify.utils
33

4-
import platform.posix.__sFILE
5-
6-
public actual typealias File = __sFILE
4+
public actual typealias File = String
75

86
internal actual fun convertFileToBufferedImage(file: File): BufferedImage = file
97
internal actual fun convertUrlPathToBufferedImage(url: String): BufferedImage =
10-
throw NotImplementedError("Images not implemented yet.")
8+
throw NotImplementedError("Images not implemented yet.")
9+
1110
internal actual fun convertLocalImagePathToBufferedImage(path: String): BufferedImage =
12-
throw NotImplementedError("Images not implemented yet.")
11+
throw NotImplementedError("Images not implemented yet.")
12+
1313
internal actual fun encodeBufferedImageToBase64String(image: BufferedImage): String =
14-
throw NotImplementedError("Images not implemented yet.")
14+
throw NotImplementedError("Images not implemented yet.")

0 commit comments

Comments
 (0)