From 3a30cbcc58b3b79357eb312790ada8472c3dd1f5 Mon Sep 17 00:00:00 2001 From: shabinder Date: Wed, 28 Apr 2021 21:34:17 +0530 Subject: [PATCH] Deps-Update and Build Fixes --- buildSrc/buildSrc/src/main/kotlin/Versions.kt | 9 +++++++- .../multiplatform-setup-test.gradle.kts | 13 +++++++++++- .../kotlin/multiplatform-setup.gradle.kts | 21 +++++++++++++------ common/data-models/build.gradle.kts | 1 - common/database/build.gradle.kts | 9 ++++---- 5 files changed, 40 insertions(+), 13 deletions(-) diff --git a/buildSrc/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/buildSrc/src/main/kotlin/Versions.kt index a9df79c4..2e21b160 100644 --- a/buildSrc/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/buildSrc/src/main/kotlin/Versions.kt @@ -28,7 +28,7 @@ object Versions { const val ktLint = "10.0.0" // DI - const val koin = "3.0.1-beta-1" + const val koin = "3.0.1" // Logger const val kermit = "0.1.8" @@ -50,6 +50,13 @@ object Versions { const val targetSdkVersion = 29 const val androidLifecycle = "2.3.0" } +object HostOS { + // Host OS Properties + private val hostOs = System.getProperty("os.name") + val isMingwX64 = hostOs.startsWith("Windows",true) + val isMac = hostOs.startsWith("Mac",true) + val isLinux = hostOs.startsWith("Linux",true) +} object Koin { val core = "io.insert-koin:koin-core:${Versions.koin}" val test = "io.insert-koin:koin-test:${Versions.koin}" diff --git a/buildSrc/src/main/kotlin/multiplatform-setup-test.gradle.kts b/buildSrc/src/main/kotlin/multiplatform-setup-test.gradle.kts index 74ed07e4..d6ec5b69 100644 --- a/buildSrc/src/main/kotlin/multiplatform-setup-test.gradle.kts +++ b/buildSrc/src/main/kotlin/multiplatform-setup-test.gradle.kts @@ -21,6 +21,18 @@ plugins { } kotlin { + + /*IOS Target Can be only built on Mac*/ + if(HostOS.isMac){ + val sdkName: String? = System.getenv("SDK_NAME") + val isiOSDevice = sdkName.orEmpty().startsWith("iphoneos") + if (isiOSDevice) { + iosArm64("ios") + } else { + iosX64("ios") + } + } + jvm("desktop").compilations.all { kotlinOptions { useIR = true @@ -40,7 +52,6 @@ kotlin { // nodejs() binaries.executable() } - ios() sourceSets { named("commonTest") { dependencies { diff --git a/buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts b/buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts index 3eb38da4..0044a427 100644 --- a/buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts +++ b/buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts @@ -23,12 +23,15 @@ plugins { kotlin { - val sdkName: String? = System.getenv("SDK_NAME") - val isiOSDevice = sdkName.orEmpty().startsWith("iphoneos") - if (isiOSDevice) { - iosArm64("ios") - } else { - iosX64("ios") + /*IOS Target Can be only built on Mac*/ + if(HostOS.isMac){ + val sdkName: String? = System.getenv("SDK_NAME") + val isiOSDevice = sdkName.orEmpty().startsWith("iphoneos") + if (isiOSDevice) { + iosArm64("ios") + } else { + iosX64("ios") + } } jvm("desktop").compilations.all { @@ -50,6 +53,7 @@ kotlin { // nodejs() binaries.executable() } + sourceSets { named("commonMain") { dependencies {} @@ -86,6 +90,11 @@ kotlin { implementation("org.jetbrains:kotlin-react-dom:17.0.1-pre.148-kotlin-1.4.30") } } + if(HostOS.isMac){ + named("iosMain"){ + dependencies { } + } + } } tasks.withType { diff --git a/common/data-models/build.gradle.kts b/common/data-models/build.gradle.kts index 3831ca5b..149e0fa0 100644 --- a/common/data-models/build.gradle.kts +++ b/common/data-models/build.gradle.kts @@ -30,6 +30,5 @@ kotlin { api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3-native-mt") } } - val iosMain by getting } } diff --git a/common/database/build.gradle.kts b/common/database/build.gradle.kts index ded9c84b..9b0652c0 100644 --- a/common/database/build.gradle.kts +++ b/common/database/build.gradle.kts @@ -50,10 +50,11 @@ kotlin { implementation(SqlDelight.jdbcDriver) } } - - val iosMain by getting { - dependencies { - implementation(SqlDelight.nativeDriver) + if(HostOS.isMac){ + val iosMain by getting { + dependencies { + implementation(SqlDelight.nativeDriver) + } } } }