Skip to content

Commit f57a119

Browse files
committed
Feat: migrated logs module to kmp
1 parent 00214ac commit f57a119

File tree

13 files changed

+85
-89
lines changed

13 files changed

+85
-89
lines changed

androidApp/dependencies/demoDebugRuntimeClasspath.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ dev.chrisbanes.snapper:snapper:0.2.2
186186
io.github.mr0xf00:easycrop:0.1.1
187187
io.insert-koin:koin-android:4.0.1-RC1
188188
io.insert-koin:koin-androidx-compose:4.0.1-RC1
189+
io.insert-koin:koin-annotations-jvm:1.4.0-RC4
190+
io.insert-koin:koin-annotations:1.4.0-RC4
191+
io.insert-koin:koin-bom:4.0.1-RC1
189192
io.insert-koin:koin-compose-jvm:4.0.1-RC1
190193
io.insert-koin:koin-compose-viewmodel-jvm:4.0.1-RC1
191194
io.insert-koin:koin-compose-viewmodel:4.0.1-RC1
@@ -212,16 +215,16 @@ org.jetbrains.androidx.lifecycle:lifecycle-viewmodel:2.8.3
212215
org.jetbrains.androidx.savedstate:savedstate:1.2.2
213216
org.jetbrains.compose.animation:animation-core:1.7.0-rc01
214217
org.jetbrains.compose.animation:animation:1.7.0-rc01
215-
org.jetbrains.compose.annotation-internal:annotation:1.7.0-rc01
216-
org.jetbrains.compose.collection-internal:collection:1.7.0-rc01
218+
org.jetbrains.compose.annotation-internal:annotation:1.7.3
219+
org.jetbrains.compose.collection-internal:collection:1.7.3
217220
org.jetbrains.compose.foundation:foundation-layout:1.7.0-rc01
218221
org.jetbrains.compose.foundation:foundation:1.7.0-rc01
219222
org.jetbrains.compose.material3:material3:1.7.0-rc01
220223
org.jetbrains.compose.material:material-icons-core:1.7.0-rc01
221224
org.jetbrains.compose.material:material-ripple:1.7.0-rc01
222225
org.jetbrains.compose.material:material:1.7.0-rc01
223226
org.jetbrains.compose.runtime:runtime-saveable:1.7.0-rc01
224-
org.jetbrains.compose.runtime:runtime:1.7.0-rc01
227+
org.jetbrains.compose.runtime:runtime:1.7.3
225228
org.jetbrains.compose.ui:ui-geometry:1.7.0-rc01
226229
org.jetbrains.compose.ui:ui-graphics:1.7.0-rc01
227230
org.jetbrains.compose.ui:ui-text:1.7.0-rc01

androidApp/dependencies/demoReleaseRuntimeClasspath.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ dev.chrisbanes.snapper:snapper:0.2.2
181181
io.github.mr0xf00:easycrop:0.1.1
182182
io.insert-koin:koin-android:4.0.1-RC1
183183
io.insert-koin:koin-androidx-compose:4.0.1-RC1
184+
io.insert-koin:koin-annotations-jvm:1.4.0-RC4
185+
io.insert-koin:koin-annotations:1.4.0-RC4
186+
io.insert-koin:koin-bom:4.0.1-RC1
184187
io.insert-koin:koin-compose-jvm:4.0.1-RC1
185188
io.insert-koin:koin-compose-viewmodel-jvm:4.0.1-RC1
186189
io.insert-koin:koin-compose-viewmodel:4.0.1-RC1
@@ -207,16 +210,16 @@ org.jetbrains.androidx.lifecycle:lifecycle-viewmodel:2.8.3
207210
org.jetbrains.androidx.savedstate:savedstate:1.2.2
208211
org.jetbrains.compose.animation:animation-core:1.7.0-rc01
209212
org.jetbrains.compose.animation:animation:1.7.0-rc01
210-
org.jetbrains.compose.annotation-internal:annotation:1.7.0-rc01
211-
org.jetbrains.compose.collection-internal:collection:1.7.0-rc01
213+
org.jetbrains.compose.annotation-internal:annotation:1.7.3
214+
org.jetbrains.compose.collection-internal:collection:1.7.3
212215
org.jetbrains.compose.foundation:foundation-layout:1.7.0-rc01
213216
org.jetbrains.compose.foundation:foundation:1.7.0-rc01
214217
org.jetbrains.compose.material3:material3:1.7.0-rc01
215218
org.jetbrains.compose.material:material-icons-core:1.7.0-rc01
216219
org.jetbrains.compose.material:material-ripple:1.7.0-rc01
217220
org.jetbrains.compose.material:material:1.7.0-rc01
218221
org.jetbrains.compose.runtime:runtime-saveable:1.7.0-rc01
219-
org.jetbrains.compose.runtime:runtime:1.7.0-rc01
222+
org.jetbrains.compose.runtime:runtime:1.7.3
220223
org.jetbrains.compose.ui:ui-geometry:1.7.0-rc01
221224
org.jetbrains.compose.ui:ui-graphics:1.7.0-rc01
222225
org.jetbrains.compose.ui:ui-text:1.7.0-rc01

androidApp/dependencies/prodDebugRuntimeClasspath.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ dev.chrisbanes.snapper:snapper:0.2.2
186186
io.github.mr0xf00:easycrop:0.1.1
187187
io.insert-koin:koin-android:4.0.1-RC1
188188
io.insert-koin:koin-androidx-compose:4.0.1-RC1
189+
io.insert-koin:koin-annotations-jvm:1.4.0-RC4
190+
io.insert-koin:koin-annotations:1.4.0-RC4
191+
io.insert-koin:koin-bom:4.0.1-RC1
189192
io.insert-koin:koin-compose-jvm:4.0.1-RC1
190193
io.insert-koin:koin-compose-viewmodel-jvm:4.0.1-RC1
191194
io.insert-koin:koin-compose-viewmodel:4.0.1-RC1
@@ -212,16 +215,16 @@ org.jetbrains.androidx.lifecycle:lifecycle-viewmodel:2.8.3
212215
org.jetbrains.androidx.savedstate:savedstate:1.2.2
213216
org.jetbrains.compose.animation:animation-core:1.7.0-rc01
214217
org.jetbrains.compose.animation:animation:1.7.0-rc01
215-
org.jetbrains.compose.annotation-internal:annotation:1.7.0-rc01
216-
org.jetbrains.compose.collection-internal:collection:1.7.0-rc01
218+
org.jetbrains.compose.annotation-internal:annotation:1.7.3
219+
org.jetbrains.compose.collection-internal:collection:1.7.3
217220
org.jetbrains.compose.foundation:foundation-layout:1.7.0-rc01
218221
org.jetbrains.compose.foundation:foundation:1.7.0-rc01
219222
org.jetbrains.compose.material3:material3:1.7.0-rc01
220223
org.jetbrains.compose.material:material-icons-core:1.7.0-rc01
221224
org.jetbrains.compose.material:material-ripple:1.7.0-rc01
222225
org.jetbrains.compose.material:material:1.7.0-rc01
223226
org.jetbrains.compose.runtime:runtime-saveable:1.7.0-rc01
224-
org.jetbrains.compose.runtime:runtime:1.7.0-rc01
227+
org.jetbrains.compose.runtime:runtime:1.7.3
225228
org.jetbrains.compose.ui:ui-geometry:1.7.0-rc01
226229
org.jetbrains.compose.ui:ui-graphics:1.7.0-rc01
227230
org.jetbrains.compose.ui:ui-text:1.7.0-rc01

androidApp/dependencies/prodReleaseRuntimeClasspath.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ dev.chrisbanes.snapper:snapper:0.2.2
181181
io.github.mr0xf00:easycrop:0.1.1
182182
io.insert-koin:koin-android:4.0.1-RC1
183183
io.insert-koin:koin-androidx-compose:4.0.1-RC1
184+
io.insert-koin:koin-annotations-jvm:1.4.0-RC4
185+
io.insert-koin:koin-annotations:1.4.0-RC4
186+
io.insert-koin:koin-bom:4.0.1-RC1
184187
io.insert-koin:koin-compose-jvm:4.0.1-RC1
185188
io.insert-koin:koin-compose-viewmodel-jvm:4.0.1-RC1
186189
io.insert-koin:koin-compose-viewmodel:4.0.1-RC1
@@ -207,16 +210,16 @@ org.jetbrains.androidx.lifecycle:lifecycle-viewmodel:2.8.3
207210
org.jetbrains.androidx.savedstate:savedstate:1.2.2
208211
org.jetbrains.compose.animation:animation-core:1.7.0-rc01
209212
org.jetbrains.compose.animation:animation:1.7.0-rc01
210-
org.jetbrains.compose.annotation-internal:annotation:1.7.0-rc01
211-
org.jetbrains.compose.collection-internal:collection:1.7.0-rc01
213+
org.jetbrains.compose.annotation-internal:annotation:1.7.3
214+
org.jetbrains.compose.collection-internal:collection:1.7.3
212215
org.jetbrains.compose.foundation:foundation-layout:1.7.0-rc01
213216
org.jetbrains.compose.foundation:foundation:1.7.0-rc01
214217
org.jetbrains.compose.material3:material3:1.7.0-rc01
215218
org.jetbrains.compose.material:material-icons-core:1.7.0-rc01
216219
org.jetbrains.compose.material:material-ripple:1.7.0-rc01
217220
org.jetbrains.compose.material:material:1.7.0-rc01
218221
org.jetbrains.compose.runtime:runtime-saveable:1.7.0-rc01
219-
org.jetbrains.compose.runtime:runtime:1.7.0-rc01
222+
org.jetbrains.compose.runtime:runtime:1.7.3
220223
org.jetbrains.compose.ui:ui-geometry:1.7.0-rc01
221224
org.jetbrains.compose.ui:ui-graphics:1.7.0-rc01
222225
org.jetbrains.compose.ui:ui-text:1.7.0-rc01

build-logic/convention/src/main/kotlin/org/mifos/mobile/KotlinAndroid.kt

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ import org.gradle.kotlin.dsl.assign
88
import org.gradle.kotlin.dsl.configure
99
import org.gradle.kotlin.dsl.dependencies
1010
import org.gradle.kotlin.dsl.provideDelegate
11+
import org.gradle.kotlin.dsl.withType
1112
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
12-
import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension
13-
import org.jetbrains.kotlin.gradle.dsl.KotlinBaseExtension
14-
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
13+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
1514

1615
/**
1716
* Configure base Kotlin with Android options
@@ -35,7 +34,7 @@ internal fun Project.configureKotlinAndroid(
3534
}
3635
}
3736

38-
configureKotlin<KotlinAndroidProjectExtension>()
37+
configureKotlin()
3938

4039
dependencies {
4140
add("coreLibraryDesugaring", libs.findLibrary("android.desugarJdkLibs").get())
@@ -53,30 +52,26 @@ internal fun Project.configureKotlinJvm() {
5352
targetCompatibility = JavaVersion.VERSION_17
5453
}
5554

56-
configureKotlin<KotlinJvmProjectExtension>()
55+
configureKotlin()
5756
}
5857

5958
/**
6059
* Configure base Kotlin options
6160
*/
62-
private inline fun <reified T : KotlinBaseExtension> Project.configureKotlin() = configure<T> {
63-
// Treat all Kotlin warnings as errors (disabled by default)
64-
// Override by setting warningsAsErrors=true in your ~/.gradle/gradle.properties
65-
val warningsAsErrors: String? by project
66-
when (this) {
67-
is KotlinAndroidProjectExtension -> compilerOptions
68-
is KotlinJvmProjectExtension -> compilerOptions
69-
else -> TODO("Unsupported project extension $this ${T::class}")
70-
}.apply {
71-
jvmTarget = JvmTarget.JVM_17
72-
allWarningsAsErrors = warningsAsErrors.toBoolean()
73-
freeCompilerArgs.add(
74-
// Enable experimental coroutines APIs, including Flow
75-
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
76-
)
77-
freeCompilerArgs.add(
78-
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api",
79-
)
61+
private fun Project.configureKotlin() {
62+
// Use withType to workaround https://youtrack.jetbrains.com/issue/KT-55947
63+
tasks.withType<KotlinCompile>().configureEach {
64+
compilerOptions {
65+
// Set JVM target to 17
66+
jvmTarget = JvmTarget.JVM_17
67+
// Treat all Kotlin warnings as errors (disabled by default)
68+
// Override by setting warningsAsErrors=true in your ~/.gradle/gradle.properties
69+
val warningsAsErrors: String? by project
70+
allWarningsAsErrors = warningsAsErrors.toBoolean()
71+
freeCompilerArgs.add(
72+
// Enable experimental coroutines APIs, including Flow
73+
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
74+
)
75+
}
8076
}
81-
}
82-
77+
}

core/logs/build.gradle.kts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,24 @@
88
* See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
99
*/
1010
plugins {
11-
alias(libs.plugins.mifos.android.library)
12-
alias(libs.plugins.mifos.android.library.compose)
13-
alias(libs.plugins.mifos.android.hilt)
11+
alias(libs.plugins.mifos.kmp.library)
12+
alias(libs.plugins.jetbrainsCompose)
13+
alias(libs.plugins.compose.compiler)
14+
1415
}
1516

1617
android {
1718
namespace = "org.mifos.mobile.core.logs"
1819
}
1920

20-
21-
dependencies {
22-
implementation(libs.androidx.compose.runtime)
23-
24-
implementation(platform(libs.firebase.bom))
25-
implementation(libs.firebase.analytics)
26-
27-
testImplementation(libs.junit)
28-
androidTestImplementation(libs.androidx.test.ext.junit)
29-
androidTestImplementation(libs.androidx.test.espresso.core)
21+
kotlin {
22+
sourceSets {
23+
commonMain.dependencies {
24+
implementation(libs.jb.composeRuntime)
25+
}
26+
androidMain.dependencies {
27+
implementation(project.dependencies.platform(libs.firebase.bom))
28+
implementation(libs.firebase.analytics)
29+
}
30+
}
3031
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2024 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
9+
*/
10+
package org.mifos.mobile.core.logs.di
11+
12+
import com.google.firebase.analytics.ktx.analytics
13+
import com.google.firebase.ktx.Firebase
14+
import org.koin.dsl.module
15+
import org.mifos.mobile.core.logs.AnalyticsHelper
16+
17+
val AnalyticsModule = module {
18+
19+
single {
20+
Firebase.analytics
21+
}
22+
single<AnalyticsHelper> {
23+
FirebaseAnalyticsHelper(firebaseAnalytics = get())
24+
}
25+
}

0 commit comments

Comments
 (0)