This is a development preview release. APIs are subject to change and may break without notice in future versions.
Overview
This release introduces gRPC and Protocol Buffers support for kotlinx-rpc — a Kotlin Multiplatform implementation of gRPC with native protobuf serialization.
Try it now — generate a gRPC + Ktor project with the Ktor Project Generator.
Two approaches are supported:
- Schema-first — define services and messages in
.protofiles, and the Gradle plugin generates
idiomatic Kotlin code withsuspendfunctions,Flow-based streaming, and type-safe message builders.
See the gRPC configuration and
generated code docs. - Proto-less — write gRPC service interfaces directly in Kotlin with any serialization format
(kotlinx.serialization, customGrpcMarshaller, etc.), no.protofiles needed.
See the gRPC services docs.
Supported gRPC workflows:
- Unary RPC (request-response)
- Server streaming (server returns
Flow) - Client streaming (client sends
Flow) - Bidirectional streaming (both sides use
Flow) - Client and server interceptors
- TLS encryption and call credentials
- Call metadata (headers and trailers)
- Timeout, gzip compression, and keepalive support
- Ktor server integration
- Status exception handling
- proto-less gRPC services
Supported protobuf features:
- Proto2, proto3, and editions 2023 syntax
- All scalar types, enums, repeated fields, maps, oneof, nested messages
- Optional types and field presence tracking
- Extensions and groups (deprecated proto2 feature)
- Well-Known Types (bundled with the runtime)
- Unknown field propagation
- Full protobuf conformance test compliance
- Custom serialization via
kotlinx.serializationor customGrpcMarshaller
Supported platforms: JVM, Android, iOS, macOS, Linux.
Features 🎉
- gRPC initial implementation by @Mr3zee in #262
- Simplified gRPC Gradle configuration by @Mr3zee in #281
- Internal vs public codegen separation in gRPC (KRPC-162) by @Mr3zee in #285
- Reference types by @Mr3zee in #291
- Enum support by @Mr3zee in #294
- Optional types support (KRPC-142) by @Mr3zee in #295
- Repeated types (KRPC-143) by @Mr3zee in #328
- Nested types (KRPC-146) by @Mr3zee in #331
- OneOf types (KRPC-147) by @Mr3zee in #332
- Map types (KRPC-145) by @Mr3zee in #334
- Streaming support (unary, server, client, bidirectional) by @Mr3zee in #389
- gRPC Ktor server plugin by @Mr3zee in #393
- Native initial setup with C++/C/Kotlin interface by @Jozott00 in #400
- Wire format encoder and decoder by @Jozott00 in #412
- Proto generation for common (JVM and Native) by @Jozott00 in #415
- Common APIs for gRPC Services, Client, and Server by @Mr3zee in #419
- Field presence tracking, required field enforcing, and MessageCodec generation by @Jozott00 in #421
- Enum and oneof field generation by @Jozott00 in #426
- gRPC service generation in the compiler plugin by @Mr3zee in #428
- Sub-messages (recursive, nested, repeated) by @Jozott00 in #430
- Map support in protobuf codec by @Jozott00 in #434
- Exceptions and skip unknown fields by @Jozott00 in #437
- Native client calls support by @Jozott00 in #452
- iOS support (arm64, x64, simulatorArm64) by @Jozott00 in #458
- Linux support (arm64, x64) by @Jozott00 in #466
- Native server implementation by @Jozott00 in #469
- TLS credentials support (client and server) by @Jozott00 in #471
- Deprecated groups support by @Jozott00 in #472
- Enable all conformance tests by @Jozott00 in #473
- Client and server interceptor API by @Jozott00 in #484
Grpc.Methodannotation by @Mr3zee in #487- Comments support in generated code by @Mr3zee in #488
- Deprecated options support by @Mr3zee in #489
hashCode,equalsandtoStringfor generated messages by @Mr3zee in #490- Call metadata — headers and trailers by @Jozott00 in #517
- Timeout support by @Jozott00 in #525
- gzip compression support by @Jozott00 in #527
- Keepalive support by @Jozott00 in #528
- Call credentials by @Jozott00 in #530
- Add missing Apple targets by @Jozott00 in #533
- Full KMP support for the Gradle Plugin by @Mr3zee in #534
- Status exception API refactoring by @Jozott00 in #536
copymethod for generated messages by @Jozott00 in #539- Presence check support by @Jozott00 in #540
- Android source sets support by @Mr3zee in #542
- Unknown field propagation by @Jozott00 in #557
- Add
protoServiceNameto@Grpcannotation by @Jozott00 in #563 - Add
CodecConfigandcodecfunction by @Jozott00 in #565 ProtobufConfigwithdiscardUnknownFieldsoption by @Jozott00 in #569@GeneratedProtoMessageannotation and descriptor object by @Jozott00 in #572- Shortest unambiguous names in generated code by @Mr3zee in #573 and #575
- Platform options for the Gradle plugin by @Mr3zee in #574
- Well-known
Anyextension functions by @Jozott00 in #577 - Companion object generation moved to the compiler plugin by @Mr3zee in #586
- Extensions support by @Jozott00 in #587
- MARSHALLER and DESCRIPTOR objects for group messages by @Jozott00 in #589
- Message recursion limit (KRPC-192) by @Mr3zee in #594
descriptor.protogeneration by @Mr3zee in #600
Bug fixes 🐛
- Fix JPMS for gRPC by @Mr3zee in #390
- Fix generation run for imported files by @Mr3zee in #409
- Tasks caching by @Mr3zee in #410
- Protobuf conformance fixes by @Mr3zee in #454
- Fix service names in the generated descriptor by @Jozott00 in #457
- Fix
onReady()listener delegation — native server streaming fix (KRPC-220) by @Jozott00 in #477 - Fix 32-bit target APIs by @Jozott00 in #537
- Fix retry behavior for client RPC calls by @Jozott00 in #545
- Fix protobuf size calculation for repeated fields and maps by @fabiocarneiro in #566
- Add
grpc-marshallerdependency toprotobuf-core(KRPC-219) by @Mr3zee in #595 - AGP 9.0 support by @Mr3zee in #596
- Fix unknown fields in nested messages by @Jozott00 in #599
Documentation 📗
Infra 🚧
- Set up protobuf conformance tests by @Mr3zee in #447
- Pre-built gRPC library to avoid long compilation times by @Jozott00 in #461
- Splitting core module into client and server by @Jozott00 in #504
- Konan LLVM bundle resolution pinning by @Jozott00 in #579
- Gradle 9.4 support by @Mr3zee in #597
Other Changes 🧹
- Protoc-gen-kotlin-multiplatform as an included build by @Mr3zee in #411
- Gradle plugin tests by @Mr3zee in #413
- Fix condition for non-JVM projects by @Mr3zee in #417
- Protoc-plugin intermediate model refactoring by @Jozott00 in #418
- Integration tests for gRPC + Protoc generated files by @Mr3zee in #444
- Remove
InputStreamabstraction in common by @Jozott00 in #571 - Konan LLVM bundle mapping update by @Jozott00 in #585
Full Changelog: 0.10.2...0.11.0-grpc-185