-
Notifications
You must be signed in to change notification settings - Fork 18
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 #140
Comments
There are no current plans to migrate connect-kotlin to support other platforms but it sounds like a good idea. If you have interest, perhaps starting with a proposal of how we'd migrate to KMP would help to understand the scope of work and also the long term maintenance impacts. |
Hi @pkwarren! |
We could likely use Ktor as the network layer, either as an option alongside the existing OkHttp implementation or instead of it (since Ktor has its own OkHttp-based implementation for when the application is targeting Android or JVM). But serialization is currently a tricky part. While the kotlinx.serialization stuff has some support for Protobuf, there is no official code generator that generates Kotlin classes with the relevant annotations. You'd have to hand-write the message types or use some other 3rd-party plugin, like https://github.com/Dogacel/kotlinx-protobuf-gen. I'm skeptical that we'd want to tie this repo to that 3rd-party one since we don't have much knowledge on the quality of that package and how well it will be maintained and supported in the future. But we certainly wouldn't want to prevent people from using it. I've heard rumors that Google may be investigating a Kotlin solution that leverages KMP (vs the current code gen, which leans on the not-KMP-compliant JVM implementation of Protobuf). If that comes to pass, we would definitely make moves to support it. For now, the serialization for Connect is actually pluggable: when you create a In any event, a more near-term task could be to make sure that the "core" module in this repo is KMP-compatible. Ideally, it would not have anything that is JVM-specific -- anything JVM-specific belongs in concrete serialization and networking implementations (like the protobuf extensions and the okhttp networking client in this repo). That at least ensures that we could integrate with KMP-compatible serialization and networking implementations in the future. |
Hi @jhump, I am the writer of that library. I haven't been doing active development recently, however I welcome anyone to contribute and I am pretty open to keep working on it. I haven't focused on building new features such as editions support, because I haven't got any feedback regarding it. If there is a project/community that needs it, I can help with that. I have well-documented the working and non-working features of the library. While developing this library I even found some bugs in Here is the limitations of the generator: https://github.com/Dogacel/kotlinx-protobuf-gen?tab=readme-ov-file#known-issues Almost all of them are related to the kotlinx.serialization bugs, here is the tracker for that, Kotlin/kotlinx.serialization#2401 (comment) For the stability of the library, you can check all the conformance tests I have created and decide yourself 🙂 : https://github.com/Dogacel/kotlinx-protobuf-gen/tree/main/testProtos |
@Dogacel, thank you for chiming and providing all of that information! As I previously mentioned, this repo would ideally be usable with your code generator and kotlinx.serialization via providing an alternate extension module that provides an implementation of |
Are there any plans to make Connect a KMP friendly library? Personally interested in JVM, Android and iOS targets.
The text was updated successfully, but these errors were encountered: