-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle.kts
executable file
·138 lines (126 loc) · 4.01 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
132
133
134
135
136
137
138
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.ksp)
alias(libs.plugins.skie)
alias(libs.plugins.kotlinSerialization)
alias(libs.plugins.kover)
alias(libs.plugins.kotlinParcelize)
}
kotlin {
// every class, method, property must declare there visibility
explicitApi()
// Android
androidTarget {
// https://youtrack.jetbrains.com/issue/KT-66448
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
}
}
// iOS
listOf(
// iosX64(),
iosArm64(),
iosSimulatorArm64(),
).forEach {
it.binaries.framework {
baseName = "Shared"
isStatic = false
export(libs.kermit.simple)
export(libs.androidx.lifecycle.viewmodel)
binaryOption("bundleId", "fr.frankois944.kmpviewmodel.shared")
}
}
sourceSets.commonMain {
kotlin.srcDir("build/generated/ksp/metadata")
}
sourceSets {
commonMain.configure {
compilerOptions {
// https://kotlinlang.org/docs/native-objc-interop.html#provide-documentation-with-kdoc-comments
freeCompilerArgs.add("-Xexport-kdoc")
}
}
commonMain.dependencies {
implementation(libs.kotlin.coroutines)
implementation(libs.kotlin.serialization)
implementation(libs.kotlin.datetime)
implementation(project.dependencies.platform(libs.koin.annotation.bom))
implementation(project.dependencies.platform(libs.koin.bom))
implementation(libs.bundles.koin.kmp)
implementation(libs.androidx.datastore.preferences.core)
implementation(libs.androidx.collection)
implementation(libs.okio)
implementation(libs.kermit)
implementation(libs.kermit.koin)
api(libs.androidx.lifecycle.viewmodel)
}
commonTest.dependencies {
implementation(libs.kotlin.test)
implementation(libs.koin.test)
implementation(libs.kotlin.coroutines.test)
implementation(libs.turbine)
implementation(libs.okio.fakefilesystem)
}
iosMain.dependencies {
// implementation(libs.bundles.koin.kmp)
api(libs.kermit.simple)
}
androidMain.dependencies {
// implementation(libs.bundles.koin.android)
}
}
}
android {
namespace = "fr.frankois944.kmpviewmodel"
compileSdk =
libs.versions.compileSdk
.get()
.toInt()
defaultConfig {
minSdk =
libs.versions.minSdk
.get()
.toInt()
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}
dependencies {
add("kspCommonMainMetadata", project.dependencies.platform(libs.koin.annotation.bom))
add("kspCommonMainMetadata", libs.koin.annotation.ksp)
}
tasks.withType<KotlinCompile<*>>().configureEach {
if (name != "kspCommonMainKotlinMetadata") {
dependsOn("kspCommonMainKotlinMetadata")
}
}
ksp {
// https://insert-koin.io/docs/reference/koin-annotations/start#compile-safety---check-your-koin-config-at-compile-time-since-130
arg("KOIN_CONFIG_CHECK", "true")
}
kover {
useJacoco()
reports {
filters {
excludes {
packages("org.koin.ksp.generated")
}
}
}
}
skie {
features {
// https://skie.touchlab.co/features/flows-in-swiftui
enableSwiftUIObservingPreview = true
// https://skie.touchlab.co/features/combine
enableFutureCombineExtensionPreview = true
enableFlowCombineConvertorPreview = true
}
}