Add multiplatform support
There is no synchronization support and CopyOnWriteArraySet should be replaced with another Set implementation. Also tests should not depend on JUnit.
which platforms to support?
Tests switched to kotest which has jvm and js support.
Did you found this discussion about replacing synchronization support? https://discuss.kotlinlang.org/t/replacement-for-synchronized/11240
Yes I know it is not a problem to implement synchronization analog. I can even simply drop all synchronization away, as kstatemachine classes are not intended to be thread-safe. I used synchronization in some cases just to prevent from common possible mistakes..
I am not sure about what platforms it might be useful to support. I don't have a project where is might be necessary in practice. Tell me if you have one?)
We would like to use multiplatform for Android and iOS, but I can't see really a usecase for synchronization beside the one you mentioned: prevent from common mistakes ;-). So maybe dropping synchronization may could be a way, which is perfectly fine for this library.
Removed JVM synchronisation primitives in 0.10.0. It seems that now KStateMachine should be compatible to Kotlin multi-platform. I am going to check it...
Current status: library itself successfully builds for jvm, js and possibly other targets. Kotest used as testing framework supports running tests on jvm and js. Mockk used for mocks supports only jvm. So the tests are limited to jvm.
I think I will add mutiplatform plugin to gradle files, so users will be able to build library for targets they need theirselves.
Here are some mocking libraries with multiplatfrom support. https://github.com/kosi-libs/MocKMP https://github.com/mockative/mockative
I think I will add mutiplatform plugin to gradle files, so users will be able to build library for targets they need theirselves.
I've switched few of my libraries to KMP and it was painful. A lot of issues with various gradle configs, plugins (especially maven-publish). Having reference projects where it was already done helps a lot.
I would also suggest adding targets for ios*Arm64 and macos*Arm64, this is M1 stuff. I have recently created a PR for this for kotlin-result, which I also used as a sample while porting my libs to KMP, perhaps you would find it useful too (also all useful kmp-targets can be found there):
https://github.com/michaelbull/kotlin-result
@dimsuz cool, thank you!
This is done finally! https://github.com/nsk90/kstatemachine/releases/tag/v0.22.0 KStateMachine has moved to Kotlin Multiplatform
I will add more platforms soon..