https://kotlinlang.org logo
Title
j

jdemeulenaere

10/25/2018, 10:37 PM
Hey guys! I have been thinking about a project for a long time now, and I'd like to know your thoughts about it now that I have some basic implementation. It's called krpc, and as the name implies, it's quite similar to grpc but fully Kotlin : - You define a service using interfaces and Kotlin data classes annotated with @Serializable (ex: https://bit.ly/2PW623A) - Most of the server (JVM) and client (Multiplatform) code is generated. - You implement the service and easily bind it to your ktor server by installing a feature (ex: https://bit.ly/2JiGwTA). - Your clients easily make RPCs to the server directly through the interface you defined (ex js: https://bit.ly/2CGeKz5, ex jvm: https://bit.ly/2Q1p8p6) The missing and most challenging part now would be the multiplatform code generation, and for that I need either the compiler plugin API to be more or less stable (or wait for @jw to start his pet project 😄). Most of the code would be in a runtime and the generated code will not be that big/complex, so once I have that I will be able to make quick progress. Until then I can improve the API and add more features (like logging, authentication, etc) depending on people feedback. What do you think ?
❤️ 1
👍 4
d

dave08

10/28/2018, 3:13 AM
I've heard some talk about kotlinpoet for code generation... I haven't looked into it, but that might be useful to you?
j

jdemeulenaere

10/28/2018, 3:41 PM
What I need is an injection point to hook the code generation into. In Kotlin JVM we have annotation processors + KotlinPoet to generate code, but for multiplatform code there is currently only compiler plugins that allow to generate to modify the IR (and the API is not stable nor documented at all yet).
d

dave08

10/28/2018, 3:43 PM
Oh... I think in KotlinConf that was what they're aiming at for Kotlin 1.4... but that might be a while still... good luck 🙂!