Store icon indicating copy to clipboard operation
Store copied to clipboard

Create kotlin multiplatform targets

Open digitalbuddha opened this issue 5 years ago • 11 comments

Once #49 lands we will be 100% kotlin. Next, we should create kotlin multiplatform targets and explore current solutions for handling flow/suspend within native/js

digitalbuddha avatar Dec 29 '19 14:12 digitalbuddha

Is this something that external contributions would be accepted for?

I’m definitely interested in exploring this, but want to be sure that it’s not something y’all have an internal plan for already

ankushg avatar Jan 20 '20 02:01 ankushg

We are all pretty green when it comes to multiplatform. Feel free to take this on and let us know how it goes!

digitalbuddha avatar Jan 20 '20 02:01 digitalbuddha

I guess the first step is to start using the Kotlin equivalent of the Java libs.

E.g. java.util.concurrent.TimeUnit can be replaced with kotlin.time.Duration in Cache.Builder. But Duration is experimental and it does change the API. But it will be nice from Kotlin: fun expireAfterWrite(duration: Duration): Builder

You can also start using org.jetbrains.kotlin:kotlin-test instead of Junit and Truth.

Then it gets harder when it comes to file IO and concurrency.

clhols avatar Mar 06 '20 20:03 clhols

I thought about using kotlin.time while rewriting the cache but was a bit concerned with forcing the experimental APIs on consumers. I can take another look at this if people are not too concerned with using more experimental APIs which we’re already doing.

Also should we work on a separate branch for the KMP effort?

ychescale9 avatar Mar 06 '20 23:03 ychescale9

Since we are in alpha I am comfortable depending on kotlin.time apis. We can move quickly if there is a critical issue or mark our code as experimental as well.

multiplatform branch sounds good!

digitalbuddha avatar Mar 07 '20 14:03 digitalbuddha

Great, I'll create an issue and start working on kotlin.time migration.

ychescale9 avatar Mar 07 '20 14:03 ychescale9

I did try kotlin.time on the Cache and tests yesterday, so I can create a PR with those changes.

clhols avatar Mar 07 '20 15:03 clhols

@clhols sure!

ychescale9 avatar Mar 07 '20 15:03 ychescale9

Hi, is there an update or roadmap on the kotlin multiplatform effort? Curious to know where this project stands and what are the ways I can help.

riclage avatar Jun 19 '20 18:06 riclage

Hello! At this time we are putting a pause on the multi platform efforts until we can hit stable. We are working through the last bug prior to beta.

Some of the current concerns with kotlin native: Truth test constructs need to be migrated Channels/actors do not work.

The first is easier to fix but the 2nd is rather complex. Our architecture is very much based on having primitives that allow a multi threaded actor impl. My hope is to pick this work up again once concurrency in kmp improves

digitalbuddha avatar Jun 19 '20 19:06 digitalbuddha

Channels/actors pattern can be replaced by kotlin coroutines MutableSharedFlow/MutableStateFlow now, which support mutable data transfer cross coroutines/threads.

9468305 avatar Jun 05 '21 09:06 9468305

Closing as #493 added support for iOS, JVM, and JS!

matt-ramotar avatar Dec 23 '22 23:12 matt-ramotar