-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add suppor to KMP to the library MVI (#29)
* Added support to KMP * Bumped MVI to 1.8.0
- Loading branch information
Showing
55 changed files
with
143 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,57 @@ | ||
import org.jlleitschuh.gradle.ktlint.KtlintExtension | ||
|
||
plugins { | ||
kotlin("jvm") version libs.versions.kotlin.get() | ||
alias(libs.plugins.kotlinMultiplatform) | ||
alias(libs.plugins.ktlint) | ||
alias(libs.plugins.mavenPublish) | ||
alias(libs.plugins.kotest) | ||
alias(libs.plugins.atomicfu) | ||
} | ||
|
||
kotlin { | ||
explicitApi() | ||
} | ||
|
||
val compileTestKotlin: org.jetbrains.kotlin.gradle.tasks.KotlinCompile by tasks | ||
compileTestKotlin.kotlinOptions { | ||
freeCompilerArgs += "-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi" | ||
jvm { | ||
withJava() | ||
} | ||
|
||
iosX64() | ||
iosArm64() | ||
iosSimulatorArm64() | ||
|
||
macosX64() | ||
macosArm64() | ||
|
||
watchosArm32() | ||
watchosArm64() | ||
watchosDeviceArm64() | ||
watchosSimulatorArm64() | ||
watchosX64() | ||
|
||
tvosArm64() | ||
tvosSimulatorArm64() | ||
tvosX64() | ||
|
||
sourceSets { | ||
commonMain.dependencies { | ||
implementation(libs.coroutinesCore) | ||
} | ||
|
||
jvmTest.dependencies { | ||
implementation(libs.kotest.framework.engine) | ||
implementation(libs.kotest.assertions) | ||
implementation(libs.coroutinesTest) | ||
implementation(libs.kotestRunner) | ||
} | ||
} | ||
} | ||
|
||
configure<KtlintExtension> { | ||
version.set(libs.versions.ktlint.lib.get()) | ||
} | ||
|
||
tasks.getByName<Test>("test") { | ||
useJUnitPlatform() | ||
} | ||
|
||
dependencies { | ||
implementation(libs.coroutinesCore) | ||
|
||
testImplementation(libs.kotestRunner) | ||
testImplementation(libs.coroutinesTest) | ||
tasks { | ||
withType<Test> { | ||
useJUnitPlatform() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
POM_ARTIFACT_ID=mvi | ||
GROUP=com.adidas.mvi | ||
VERSION_CODE=1 | ||
VERSION_NAME=1.7.0 | ||
VERSION_NAME=1.8.0 | ||
POM_NAME=Adidas MVI | ||
POM_DESCRIPTION=Adidas MVI |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
38 changes: 38 additions & 0 deletions
38
mvi/src/jvmTest/kotlin/com/adidas/mvi/CoroutineListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.adidas.mvi | ||
|
||
import io.kotest.core.listeners.TestListener | ||
import io.kotest.core.test.TestCase | ||
import io.kotest.core.test.TestResult | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.cancel | ||
import kotlinx.coroutines.test.TestCoroutineScheduler | ||
import kotlinx.coroutines.test.TestDispatcher | ||
import kotlinx.coroutines.test.UnconfinedTestDispatcher | ||
import kotlinx.coroutines.test.resetMain | ||
import kotlinx.coroutines.test.setMain | ||
|
||
internal class CoroutineListener( | ||
internal val testCoroutineDispatcher: TestDispatcher = | ||
UnconfinedTestDispatcher( | ||
TestCoroutineScheduler(), | ||
), | ||
) : TestListener { | ||
internal val dispatchersContainer: DispatchersContainer = | ||
FixedDispatchersContainer(testCoroutineDispatcher) | ||
|
||
override suspend fun beforeContainer(testCase: TestCase) { | ||
Dispatchers.setMain(testCoroutineDispatcher) | ||
} | ||
|
||
override suspend fun afterContainer( | ||
testCase: TestCase, | ||
result: TestResult, | ||
) { | ||
Dispatchers.resetMain() | ||
testCoroutineDispatcher.scheduler.cancel() | ||
} | ||
|
||
public fun advanceUntilIdle() { | ||
testCoroutineDispatcher.scheduler.advanceUntilIdle() | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.