Store icon indicating copy to clipboard operation
Store copied to clipboard

Kotlin Multiplatform PoC migration

Open jimKarsh opened this issue 5 years ago • 2 comments

Created kotlin multiplatform module using store4 module to migrate and test functionality slowly. Replaced references in sample code referencing store4 with kmp code. So far, with disabled cache, functionality / testing works as expected.

Notes:

  1. Commented out caching layer in RealStore. Multiplatform caching to be reimplemented. Tests referencing a cached store request were also commented out as the code path leads to hanging as is.

  2. In Multicaster the ChannelManager was instantiated using a lazy delegate and initialization mode. This caused kotlin native to throw an unsupported exception despite documentation stating that it is. This was removed and changed to simple assignment; I'm unsure of the performance impact of this change.

3a) Truth testing library has been swapped out for multiplatform Turbine for flow testing. .emitsExactly functionality split to .emitsExactly (checks emitted values in order and does not expect a completion event) and .emitsExactlyAndCompletes (which does). Testing that utilizes the standard flow { } builder emit a completion event.

3b) Kotlin-test-common required changes in assertion formats.

  1. coroutine-test library classes necessary to implement TestCoroutineScope migrated to kmp under testutils/coroutines. Most were lift and shift; however, TestCoroutineExceptionHandler required a small rework as it relied on synchronized(owner) to manipulate the exceptions list which is not supported in kmp. Instead, I wrapped the exceptions in an atomic reference.

  2. Some builds fail with Metaspace exception. Subsequent builds work and testing / running application is unaffected. I have as of now not looked into the cause.

jimKarsh avatar Dec 10 '20 18:12 jimKarsh

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Aug 31 '21 20:08 CLAassistant

Now that the new memory model is stabilizing I'd be curious to see what it would take to get the multicaster to be kmp compact too https://blog.jetbrains.com/kotlin/2021/08/try-the-new-kotlin-native-memory-manager-development-preview/

digitalbuddha avatar Aug 31 '21 21:08 digitalbuddha

With Store 5 stable out I think we can close this now. Thanks all 🙏🏽

matt-ramotar avatar Jan 07 '24 20:01 matt-ramotar