98 lines
No EOL
2.8 KiB
Text
98 lines
No EOL
2.8 KiB
Text
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"
|
|
id("com.squareup.sqldelight")
|
|
}
|
|
group = "com.wbrawner.twigs"
|
|
version = "1.0-SNAPSHOT"
|
|
|
|
repositories {
|
|
gradlePluginPortal()
|
|
google()
|
|
jcenter()
|
|
mavenCentral()
|
|
}
|
|
kotlin {
|
|
android()
|
|
ios {
|
|
binaries {
|
|
framework {
|
|
baseName = "twigs"
|
|
}
|
|
}
|
|
}
|
|
sourceSets {
|
|
val commonMain by getting {
|
|
dependencies {
|
|
implementation("io.ktor:ktor-client-core:1.4.2")
|
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.1")
|
|
implementation("io.ktor:ktor-client-serialization:1.4.2")
|
|
}
|
|
}
|
|
val commonTest by getting {
|
|
dependencies {
|
|
implementation(kotlin("test-common"))
|
|
implementation(kotlin("test-annotations-common"))
|
|
}
|
|
}
|
|
val androidMain by getting {
|
|
dependencies {
|
|
implementation("com.google.android.material:material:1.2.0")
|
|
implementation("com.squareup.sqldelight:android-driver:1.4.3")
|
|
api("io.ktor:ktor-client-android:1.4.2")
|
|
}
|
|
}
|
|
val androidTest by getting {
|
|
dependencies {
|
|
implementation(kotlin("test-junit"))
|
|
implementation("junit:junit:4.12")
|
|
}
|
|
}
|
|
val iosMain by getting {
|
|
dependencies {
|
|
implementation("io.ktor:ktor-client-ios:1.4.2")
|
|
implementation("com.squareup.sqldelight:native-driver:1.4.3")
|
|
}
|
|
}
|
|
val iosTest by getting
|
|
}
|
|
}
|
|
|
|
sqldelight {
|
|
database("TwigsDatabase") {
|
|
packageName = "com.wbrawner.twigs"
|
|
}
|
|
}
|
|
|
|
android {
|
|
compileSdkVersion(30)
|
|
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
|
|
defaultConfig {
|
|
minSdkVersion(23)
|
|
targetSdkVersion(30)
|
|
versionCode = 1
|
|
versionName = "1.0"
|
|
}
|
|
buildTypes {
|
|
getByName("release") {
|
|
isMinifyEnabled = false
|
|
}
|
|
}
|
|
}
|
|
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) |