Created
December 5, 2020 11:45
-
-
Save hardik-trivedi/d9e91b441f272a6e209d431596a8aeaf to your computer and use it in GitHub Desktop.
KMM :shared module build.gradle.kts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget | |
plugins { | |
kotlin("multiplatform") | |
id("com.android.library") | |
id("kotlin-android-extensions") | |
kotlin("plugin.serialization") version "1.4.10" | |
} | |
group = "com.hardiktrivedi.kmmnovelcovid" | |
version = "1.0-SNAPSHOT" | |
kotlin { | |
val ktorVersion = "1.4.0" | |
val serializationVersion = "1.0.0-RC" | |
val coroutinesVersion = "1.3.9-native-mt" | |
sourceSets { | |
val commonMain by getting { | |
dependencies { | |
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion") | |
implementation("io.ktor:ktor-client-core:$ktorVersion") | |
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$serializationVersion") | |
implementation("io.ktor:ktor-client-serialization:$ktorVersion") | |
} | |
} | |
val androidMain by getting { | |
dependencies { | |
implementation("com.google.android.material:material:1.2.0") | |
implementation("io.ktor:ktor-client-android:$ktorVersion") | |
} | |
} | |
val iosMain by getting { | |
dependencies { | |
implementation("io.ktor:ktor-client-ios:$ktorVersion") | |
} | |
} | |
} | |
} | |
val packForXcode by tasks.creating(Sync::class) { | |
group = "build" | |
val mode = System.getenv("CONFIGURATION") ?: "DEBUG" | |
val sdkName = System.getenv("SDK_NAME") ?: "iphonesimulator" | |
val targetName = "ios" + if (sdkName.startsWith("iphoneos")) "Arm64" else "X64" | |
val framework = | |
kotlin.targets.getByName<KotlinNativeTarget>(targetName).binaries.getFramework(mode) | |
inputs.property("mode", mode) | |
dependsOn(framework.linkTask) | |
val targetDir = File(buildDir, "xcode-frameworks") | |
from({ framework.outputDirectory }) | |
into(targetDir) | |
} | |
tasks.getByName("build").dependsOn(packForXcode) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment