Skip to content

Commit

Permalink
Feat: [:feature:auth] - Migrated to Kotlin Multiplatform (#1782)
Browse files Browse the repository at this point in the history
* Feat: [:feature:auth] - Migrated to Kotlin Multiplatform

* Added Support For Web
  • Loading branch information
niyajali authored Oct 7, 2024
1 parent 69a04d8 commit ae2b15b
Show file tree
Hide file tree
Showing 279 changed files with 11,515 additions and 7,199 deletions.
32 changes: 0 additions & 32 deletions .github/workflows/feature_branch_ci.yml

This file was deleted.

11 changes: 6 additions & 5 deletions .github/workflows/master_dev_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
- name: Check Dependency Guard
id: dependencyguard_verify
continue-on-error: true
run: ./gradlew dependencyGuard
run: ./gradlew :mifospay-android:dependencyGuard

- name: Prevent updating Dependency Guard baselines if this is a fork
id: checkfork_dependencyguard
Expand All @@ -88,7 +88,7 @@ jobs:
id: dependencyguard_baseline
if: steps.dependencyguard_verify.outcome == 'failure' && github.event_name == 'pull_request'
run: |
./gradlew dependencyGuardBaseline
./gradlew :mifospay-android:dependencyGuardBaseline
- name: Push new Dependency Guard baselines if available
uses: stefanzweifel/git-auto-commit-action@v5
Expand All @@ -109,7 +109,8 @@ jobs:
java-version: 17
- name: Run tests
run: |
./gradlew testDemoDebug :lint:test :mifospay:lintProdRelease :lint:lint
./gradlew :mifospay-android:testDemoDebug
# ./gradlew testDemoDebug :lint:test :mifospay-android:lintProdRelease :lint:lint
- name: Upload reports
if: always()
uses: actions/upload-artifact@v4
Expand All @@ -130,12 +131,12 @@ jobs:
java-version: 17

- name: Build APKs
run: ./gradlew :mifospay:assembleDemoDebug
run: ./gradlew :mifospay-android:assembleDemoDebug

- name: Check badging
# This step is allowed to fail, as it's not critical for the build
continue-on-error: true
run: ./gradlew :mifospay:checkProdReleaseBadging
run: ./gradlew :mifospay-android:checkProdReleaseBadging

- name: Upload APKs
uses: actions/upload-artifact@v4
Expand Down
70 changes: 70 additions & 0 deletions .run/mifospay-android.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="mifospay-android" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
<module name="mobile-wallet.mifospay-android.main" />
<option name="DEPLOY" value="true" />
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
<option name="DEPLOY_AS_INSTANT" value="false" />
<option name="ARTIFACT_NAME" value="" />
<option name="PM_INSTALL_OPTIONS" value="" />
<option name="ALL_USERS" value="false" />
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
<option name="CLEAR_APP_STORAGE" value="false" />
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="" />
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
<option name="MODE" value="default_activity" />
<option name="RESTORE_ENABLED" value="false" />
<option name="RESTORE_FILE" value="" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
<option name="TARGET_SELECTION_MODE" value="DEVICE_AND_SNAPSHOT_COMBO_BOX" />
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
<option name="DEBUGGER_TYPE" value="Auto" />
<Auto>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
<option name="ATTACH_ON_WAIT_FOR_DEBUGGER" value="false" />
<option name="DEBUG_SANDBOX_SDK" value="false" />
</Auto>
<Hybrid>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
<option name="ATTACH_ON_WAIT_FOR_DEBUGGER" value="false" />
<option name="DEBUG_SANDBOX_SDK" value="false" />
</Hybrid>
<Java>
<option name="ATTACH_ON_WAIT_FOR_DEBUGGER" value="false" />
<option name="DEBUG_SANDBOX_SDK" value="false" />
</Java>
<Native>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
<option name="ATTACH_ON_WAIT_FOR_DEBUGGER" value="false" />
<option name="DEBUG_SANDBOX_SDK" value="false" />
</Native>
<Profilers>
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
<option name="STARTUP_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Java/Kotlin Method Sample (legacy)" />
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED" value="false" />
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
</Profilers>
<option name="DEEP_LINK" value="" />
<option name="ACTIVITY_CLASS" value="" />
<option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" />
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
<method v="2">
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
</method>
</configuration>
</component>
24 changes: 24 additions & 0 deletions .run/mifospay-desktop.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="mifospay-desktop" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="-DmainClass=MainKt --quiet" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":mifospay-desktop:desktopRun" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
24 changes: 24 additions & 0 deletions .run/mifospay-web-js.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="mifospay-web-js" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":mifospay-web:jsBrowserRun" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
24 changes: 24 additions & 0 deletions .run/mifospay-web-wasm.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="mifospay-web-wasm" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":mifospay-web:wasmJsBrowserRun" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class CMPFeatureConventionPlugin : Plugin<Project> {
with(target) {
pluginManager.apply {
apply("mifospay.kmp.library")
apply("mifospay.kmp.inject")
apply("mifospay.kmp.koin")
apply("org.jetbrains.kotlin.plugin.compose")
apply("org.jetbrains.compose")
}
Expand All @@ -18,11 +18,15 @@ class CMPFeatureConventionPlugin : Plugin<Project> {
add("commonMainImplementation", project(":core:ui"))
add("commonMainImplementation", project(":core:designsystem"))
add("commonMainImplementation", project(":core:data"))
add("commonMainImplementation", libs.findLibrary("jetbrains.compose.viewmodel").get())
add("commonMainImplementation", libs.findLibrary("jetbrains.compose.navigation").get())
add("commonMainImplementation", libs.findLibrary("kotlinx.collections.immutable").get())

add("androidMainImplementation", project(":libs:material3-navigation"))
add("commonMainImplementation", libs.findLibrary("jb.composeRuntime").get())
add("commonMainImplementation", libs.findLibrary("jb.composeViewmodel").get())
add("commonMainImplementation", libs.findLibrary("jb.lifecycleViewmodel").get())
add("commonMainImplementation", libs.findLibrary("jb.lifecycleViewmodelSavedState").get())
add("commonMainImplementation", libs.findLibrary("jb.savedstate").get())
add("commonMainImplementation", libs.findLibrary("jb.bundle").get())
add("commonMainImplementation", libs.findLibrary("jb.composeNavigation").get())
add("commonMainImplementation", libs.findLibrary("kotlinx.collections.immutable").get())

add("androidMainImplementation", libs.findLibrary("androidx.lifecycle.runtimeCompose").get())
add("androidMainImplementation", libs.findLibrary("androidx.lifecycle.viewModelCompose").get())
Expand All @@ -39,15 +43,9 @@ class CMPFeatureConventionPlugin : Plugin<Project> {

add("androidTestImplementation", libs.findLibrary("koin.test.junit4").get())

add("androidDebugImplementation", libs.findLibrary("androidx.compose.ui.test.manifest").get())
add("androidInstrumentedTestImplementation", libs.findLibrary("androidx.navigation.testing").get())
add("androidInstrumentedTestImplementation", libs.findLibrary("androidx.compose.ui.test").get())
add("androidInstrumentedTestImplementation", libs.findLibrary("androidx.lifecycle.runtimeTesting").get())
add("androidInstrumentedTestImplementation", libs.findLibrary("androidx.test.core").get())
add("androidInstrumentedTestImplementation", libs.findLibrary("androidx.test.ext").get())
add("androidInstrumentedTestImplementation", libs.findLibrary("androidx.test.junit").get())
add("androidInstrumentedTestImplementation", libs.findLibrary("androidx.test.runner").get())
add("androidInstrumentedTestImplementation", libs.findLibrary("androidx.test.espresso.core").get())
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class KMPKoinConventionPlugin : Plugin<Project> {

add("commonMainImplementation", libs.findLibrary("koin.annotations").get())
add("kspCommonMainMetadata", libs.findLibrary("koin.ksp.compiler").get())
add("ksp", libs.findLibrary("koin.ksp.compiler").get())
// add("kspAndroid", libs.findLibrary("koin.ksp.compiler").get())
// add("kspWasmJs", libs.findLibrary("koin.ksp.compiler").get())
// add("kspJvm", libs.findLibrary("koin.ksp.compiler").get())
// add("kspIosX64", libs.findLibrary("koin.ksp.compiler").get())
Expand All @@ -32,8 +32,6 @@ class KMPKoinConventionPlugin : Plugin<Project> {

extensions.configure<KspExtension> {
arg("KOIN_CONFIG_CHECK","true")
arg("USE_COMPOSE_VIEWMODEL", "false")
arg("KOIN_USE_COMPOSE_VIEWMODEL", "true")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ class KMPLibraryConventionPlugin: Plugin<Project> {
configureFlavors(this)
// The resource prefix is derived from the module name,
// so resources inside ":core:module1" must be prefixed with "core_module1_"
resourcePrefix = path.split("""\W""".toRegex()).drop(1).distinct().joinToString(separator = "_").lowercase() + "_"
resourcePrefix = path
.split("""\W""".toRegex())
.drop(1).distinct()
.joinToString(separator = "_")
.lowercase() + "_"
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class KotlinInjectConventionPlugin: Plugin<Project> {
add("kspIosSimulatorArm64", libs.findLibrary("kotlin.inject.compiler.ksp").get())
// add("kspWasmJs", libs.findLibrary("kotlin.inject.compiler.ksp").get())
add("kspAndroid", libs.findLibrary("kotlin.inject.compiler.ksp").get())
add("kspJvm", libs.findLibrary("kotlin.inject.compiler.ksp").get())
add("kspDesktop", libs.findLibrary("kotlin.inject.compiler.ksp").get())
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@ internal fun Project.configureKotlinMultiplatform() {
extensions.configure<KotlinMultiplatformExtension> {
applyDefaultHierarchyTemplate()

jvm()
jvm("desktop")
androidTarget()
iosSimulatorArm64()
iosX64()
iosArm64()

js(IR) {
this.nodejs()
binaries.executable()
}
wasmJs() {
browser()
nodejs()
}
// Suppress 'expect'/'actual' classes are in Beta.
targets.configureEach {
compilations.configureEach {
Expand Down
6 changes: 2 additions & 4 deletions ci-prepush.bat
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ echo Starting all checks and tests...
call :run_gradle_task "check -p build-logic"
call :run_gradle_task "spotlessApply --no-configuration-cache"
call :run_gradle_task "dependencyGuardBaseline"
call :run_gradle_task "formatVersionCatalog"
call :run_gradle_task "detekt"
call :run_gradle_task "testDemoDebug :lint:test :mifospay:lintProdRelease :lint:lint"
call :run_gradle_task "build"
call :run_gradle_task "updateProdReleaseBadging"
call :run_gradle_task ":mifospay-android:build"
call :run_gradle_task ":mifospay-android:updateProdReleaseBadging"

echo All checks and tests completed successfully.
exit /b 0
Expand Down
6 changes: 2 additions & 4 deletions ci-prepush.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ tasks=(
"spotlessApply --no-configuration-cache"
"dependencyGuardBaseline"
"detekt"
"formatVersionCatalog"
"testDemoDebug :lint:test :lint:lint :mifospay:lintProdRelease"
"build"
"updateProdReleaseBadging"
":mifospay-android:build"
":mifospay-android:updateProdReleaseBadging"
)

for task in "${tasks[@]}"; do
Expand Down
Loading

0 comments on commit ae2b15b

Please sign in to comment.