Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin multiplatform support? #2

Open
dylanenabled opened this issue Sep 20, 2023 · 3 comments
Open

Kotlin multiplatform support? #2

dylanenabled opened this issue Sep 20, 2023 · 3 comments

Comments

@dylanenabled
Copy link

Are there any plans for a port of the automerge bindings to kotlin multiplatform so that the one codebase can target iOS, Android, JVM and Browser?

It's probably possible by implementing the business logic and calling out to one of the existing libraries to implement the transactions, or wrapping the rust code on each platform directly, but having an official multiplatform library would be great.

I'd be willing to help out of it's on the roadmap.

Please let me know if this isn't the appropriate place for this sort of question.

@alexjg
Copy link
Collaborator

alexjg commented Sep 20, 2023

I would be very interested in such a project! I haven't much time to work on this myself but very happy to discuss designs and review code.

@ptitjes
Copy link

ptitjes commented Nov 2, 2023

I am also interested on working on a Kotlin multiplatform version of Automerge. I tried wrapping automerge-java using expect/actual declarations, however in its current form automerge-java is highly dependant of the Java standard library (mainly around the uses of Optional, and similar) and therefore not very much Kotlin-idiomatic.

I see two way around this:

  • Extract the raw Rust AutomergeSys JNI binding in a separate library, modify it current implementation to remove the Optional, and do the Optional wrapping in the Java code directly. Then we could directly use these raw bindings in a new automerge-kotlin.
  • Duplicate and adapt your current Rust/JNI code for the JVM part of a new multiplatform automerge-kotlin. But that would duplicate the maintenance effort.

I am not Rust-proficient but I would happily start such a project.

FYI, I started an implementation of automerge-repo. It is only targeting the JVM for now but mainly uses multiplatform stuff, so that it would easily be made multiplatform.

What do you all think?

@alexjg
Copy link
Collaborator

alexjg commented Nov 4, 2023

Hmm. I would like to make sure that automerge-java is - as far as possible - pleasant to use for actual Java programmers. A kotlin multiplatform library will require some kind of kotlin wrapper anyway in order to handle platforms which are not supported by the JNI based library. On that basis I think we should probably go for your first option.

Re. automerge-repo, I have a half finished kotlin implementation sitting aorund somewhere. I'll try and clean it up a bit and publish it somewhere for you to take a look at.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants