141 lines
3.9 KiB
Kotlin
141 lines
3.9 KiB
Kotlin
|
|
plugins {
|
|
kotlin("multiplatform")
|
|
id("kotlinx-serialization")
|
|
id("com.android.library")
|
|
id("org.jetbrains.kotlin.native.cocoapods")
|
|
id("com.squareup.sqldelight")
|
|
id("com.rickclephas.kmp.nativecoroutines")
|
|
}
|
|
|
|
// CocoaPods requires the podspec to have a version.
|
|
version = "1.0"
|
|
|
|
|
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
|
kotlinOptions {
|
|
jvmTarget = "1.8"
|
|
freeCompilerArgs = listOf("-Xuse-experimental=kotlin.time.ExperimentalTime", "-Xobjc-generics")
|
|
}
|
|
}
|
|
|
|
|
|
android {
|
|
compileSdk = Versions.androidCompileSdk
|
|
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
|
|
defaultConfig {
|
|
minSdk = Versions.androidMinSdk
|
|
targetSdk = Versions.androidTargetSdk
|
|
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
}
|
|
}
|
|
|
|
|
|
kotlin {
|
|
targets {
|
|
val iosTarget: (String, org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget.() -> Unit) -> org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget = when {
|
|
System.getenv("SDK_NAME")?.startsWith("iphoneos") == true -> ::iosArm64
|
|
System.getenv("NATIVE_ARCH")?.startsWith("arm") == true -> ::iosSimulatorArm64 // available to KT 1.5.30
|
|
else -> ::iosX64
|
|
}
|
|
iosTarget("iOS") {}
|
|
|
|
macosX64("macOS")
|
|
android()
|
|
jvm()
|
|
}
|
|
|
|
cocoapods {
|
|
// Configure fields required by CocoaPods.
|
|
summary = "Some description for a Kotlin/Native module"
|
|
homepage = "Link to a Kotlin/Native module homepage"
|
|
}
|
|
|
|
|
|
sourceSets {
|
|
val commonMain by getting {
|
|
dependencies {
|
|
with(Deps.Kotlinx) {
|
|
implementation(Deps.Kotlinx.coroutinesCore)
|
|
implementation(serializationCore)
|
|
implementation(dateTime)
|
|
}
|
|
|
|
with(Deps.Ktor) {
|
|
implementation(clientCore)
|
|
implementation(clientJson)
|
|
implementation(clientLogging)
|
|
implementation(contentNegotiation)
|
|
implementation(json)
|
|
}
|
|
|
|
with(Deps.SqlDelight) {
|
|
implementation(runtime)
|
|
implementation(coroutineExtensions)
|
|
}
|
|
|
|
with(Deps.Koin) {
|
|
api(core)
|
|
api(test)
|
|
}
|
|
|
|
with(Deps.Log) {
|
|
api(kermit)
|
|
}
|
|
|
|
api(Deps.multiplatformSettings)
|
|
api(Deps.multiplatformSettingsCoroutines)
|
|
}
|
|
}
|
|
|
|
val androidMain by getting {
|
|
dependencies {
|
|
implementation("io.ktor:ktor-client-android:${Versions.ktor}")
|
|
implementation("com.squareup.sqldelight:android-driver:${Versions.sqlDelight}")
|
|
}
|
|
}
|
|
|
|
val iOSMain by getting {
|
|
dependencies {
|
|
implementation("io.ktor:ktor-client-ios:${Versions.ktor}")
|
|
implementation("com.squareup.sqldelight:native-driver:${Versions.sqlDelight}")
|
|
}
|
|
}
|
|
|
|
val macOSMain by getting {
|
|
dependencies {
|
|
implementation("io.ktor:ktor-client-ios:${Versions.ktor}")
|
|
implementation("com.squareup.sqldelight:native-driver-macosx64:${Versions.sqlDelight}")
|
|
}
|
|
}
|
|
|
|
|
|
val jvmMain by getting {
|
|
dependencies {
|
|
implementation(Deps.Ktor.clientJava)
|
|
//implementation(Ktor.slf4j)
|
|
implementation("com.squareup.sqldelight:sqlite-driver:${Versions.sqlDelight}")
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
kotlin {
|
|
sourceSets.all {
|
|
languageSettings {
|
|
optIn("kotlin.RequiresOptIn")
|
|
}
|
|
}
|
|
}
|
|
|
|
sqldelight {
|
|
database("MyDatabase") {
|
|
packageName = "com.surrus.galwaybus.db"
|
|
sourceFolders = listOf("sqldelight")
|
|
}
|
|
}
|
|
|