Since Kotlin/Native 0.6 supports multiplattform projects, it would be nice to have also support for kotlin native.
https://blog.jetbrains.com/kotlin/2018/02/kotlinnative-v0-6-is-here/
Yes, Kotlin/Native support is in our plan and we've already started working at it :)
Is there an eta on Kotlin/Native support?
@sandwwraith I'm also curious about an ETA on kotlin/native support
@rytedesigns @Arne517 there is a K/N compatible version of this library, but the compiler plugin API is not available on Native yet. To try it out (remember, this is early preview), there are two options:
sourcegen branch and Kotlin source generator from there, which uses DSL to generate data classes with serializers compatible with library (see example-sourcegen folder and its buildSrc)json-ast branch and jsonparser native module, which contains JSON parser and JSON tree model (but can't map it on data classes yet)@sandwwraith is there an update you could give on K/N support? We're looking at some options for managing APIs on Android and iOS using K/N. Where could we follow the support for the compiler plugin API on Native?
@AndreasBackx no updates on compiler plugin for now :(
https://blog.jetbrains.com/kotlin/2018/07/kotlinnative-v0-8-released/
According to this kotlinx.serialization is now supported with kotlin/native. But I am still unable to use this.
@nish-d Support for native is limited for now and expressed as separate JSON parser. We are working in this direction.
I'd like to announce an early access preview of kotlinx.serialization plugin for Native. The showcase project can be found at https://github.com/sandwwraith/KotlinSerializationPlayground/tree/native_preview/ . Some rules of thumb:
0.7.0-eap-1, serialization runtime library 0.7.0-eap-3.-unshaded suffix in maven coordinates).core_refactoring.What works:
@Serializable classes with primitive or @Serializable properties@Optional and @SerialName annotationsWhat does not work:
@Serializable classes with generics (except standard collections)Array<T>, ByteArray, etc)@Transient initializers and init blocks@SerialInfo-based annotationsThe showcase project has different version numbers than what you have mentioned.
@nish-d I can see correct versions: https://github.com/sandwwraith/KotlinSerializationPlayground/blob/native_preview/gradle.properties#L1
(notice that showcase project with native is located in native_preview branch, not master)
@sandwwraith In SerialImplicits.kt, it is noted that the code won't work with kotlin/native.
Does that mean protocolbuffer serialization/deserialization is not available yet for kotlin-native?
@daudrain It is available, but without the possibility to specify custom serial ids – all properties are enumerated in order starting from 1.
kotlinx.serialization plugin for native has been feature-complete for several latest releases, so I think this may be closed now. 🎉
Most helpful comment
Yes, Kotlin/Native support is in our plan and we've already started working at it :)