generated from wzieba/KMM-in-exsiting-project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
131 lines (120 loc) · 3.94 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
plugins {
kotlin("multiplatform")
id("com.android.library")
id("com.prof18.kmp.fatframework.cocoa") version "0.0.1"
id("maven-publish")
id("org.jmailen.kotlinter")
id("com.squareup.sqldelight")
}
val iosFrameworkName = "shared"
val kotlinVersion = "1.4.3-native-mt"
android {
configurations {
create("androidTestApi")
create("androidTestDebugApi")
create("androidTestReleaseApi")
create("testApi")
create("testDebugApi")
create("testReleaseApi")
}
}
kotlin {
android()
ios {
binaries {
framework {
baseName = iosFrameworkName
}
}
}
sourceSets {
val commonMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinVersion") {
version {
strictly(kotlinVersion)
}
}
implementation("com.squareup.sqldelight:coroutines-extensions:1.4.4")
}
}
val commonTest by getting {
dependencies {
implementation("app.cash.turbine:turbine:0.4.0")
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
val androidMain by getting {
dependencies {
implementation("com.google.android.material:material:1.3.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlinVersion")
implementation("com.squareup.sqldelight:android-driver:1.4.4")
}
}
val androidTest by getting {
dependencies {
implementation("androidx.test:core:1.3.0")
implementation("org.robolectric:robolectric:4.4")
implementation(kotlin("test-junit"))
implementation("junit:junit:4.13.2")
}
}
val iosMain by getting {
dependencies {
implementation("com.squareup.sqldelight:native-driver:1.4.4")
}
}
val iosTest by getting
matching {
it.name.endsWith("Test")
}.configureEach {
languageSettings.useExperimentalAnnotation("kotlin.time.ExperimentalTime")
}
all {
languageSettings.apply {
useExperimentalAnnotation("kotlinx.coroutines.ExperimentalCoroutinesApi")
useExperimentalAnnotation("kotlinx.coroutines.ObsoleteCoroutinesApi")
}
}
}
}
android {
compileSdkVersion(29)
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdkVersion(24)
targetSdkVersion(29)
}
}
sqldelight {
database("EventsDatabase") {
this.packageName = "com.automattic.myapplication.shared"
}
}
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)
}
fatFrameworkCocoaConfig {
fatFrameworkName = iosFrameworkName
outputPath = "$rootDir/../test-dest"
versionName = "1.2-SNAPSHOT"
cocoaPodRepoInfo {
summary = "This is a test KMP framework"
homepage = "https://github.com/wzieba/KMM-template"
license = "MIT"
authors = "\"user\" => \"mail@mail.com\""
gitUrl = "git@github.com:wzieba/KMM-template-cocoa.git"
}
}