Add kotlinx-rpc gRPC integration#507
Merged
andrewparmet merged 31 commits intoopen-toast:mainfrom May 8, 2026
Merged
Conversation
…g example) - Add `grpcKrpc` generation flag plumbed through ProtoktExtension, PluginConfig, ProtobufBuild, PluginParams, GeneratorContext, and FileGenerator - Add GrpcKrpcServiceGenerator: emits @Grpc-annotated interfaces from proto service definitions for processing by the kotlinx-rpc compiler plugin - Add ProtoktGrpcMarshaller: zero-copy marshaller bridge using kotlinx-io (Message.serialize(Sink) / Deserializer.deserialize(Source)) - Add examples/grpc-krpc with HelloWorld server, client, and passing test using kotlinx-rpc GrpcServer/GrpcClient with protokt messages - Add third-party/proto-google-common-protos-grpc-krpc variant - Add kotlinx-rpc version catalog entries and JetBrains Space plugin repo
- Move kotlinx-rpc Gradle plugin to buildSrc classpath via version catalog - Remove pluginManagement block from settings.gradle.kts (no longer needed) - Remove buildscript block from example (plugin resolved via buildSrc) - Add API dump for proto-google-common-protos-grpc-krpc
Convert protokt-runtime-grpc-krpc and proto-google-common-protos-grpc-krpc from JVM-only to KMP with JVM + native (all targets except mingwX64, no JS, matching kotlinx-rpc's published target set). Generate @grpc interfaces only on the primary target to prevent redeclarations across native compilations. Add OnlyForUseByGeneratedProtoCode opt-in to the example.
…rpc-188 - Convert grpc-krpc example from JVM-only to multiplatform with native targets (macOS/Linux host target), running end-to-end gRPC tests on both JVM and native - Upgrade kotlinx-rpc from 0.11.0-grpc-187 to 0.11.0-grpc-188 which has native gRPC support built in (no fork needed) - Pin Kotlin to 2.3.20 (kRPC compiler plugin not yet published for 2.3.21) - Remove @OnlyForUseByGeneratedProtoCode from AbstractDeserializer and AbstractMessage: the annotation leaked to consumers using generated companion objects as Deserializer<T> - Extract configureMultiplatformJvm() helper to share JVM setup between protokt-runtime-grpc-krpc and the example
…nce methods - New protokt.krpc-conventions precompiled plugin: bundles kotlin-multiplatform + java-base + JVM config + Space repo + rpc opt-in - Add Generate.grpcKrpc(): types + descriptors + kRPC interfaces - Add Generate.grpcKotlin(): types + descriptors + gRPC descriptors + Kotlin stubs - Replace @OnlyForUseByGeneratedProtoCode on AbstractDeserializer and AbstractMessage with @SubclassOptInRequired: users can freely use generated messages and deserializers but subclassing still requires opt-in
The kotlinx-rpc compiler plugin resolves as {kotlinVersion}-{rpcVersion}
which permanently couples its Kotlin version to kRPC's release cadence.
Move the example to a standalone Gradle project (standalone-examples/)
with its own pinned Kotlin version so the main build can track latest
Kotlin independently.
- standalone-examples/grpc-krpc: self-contained build consuming protokt
from the integration repo, pinned to Kotlin 2.3.20
- Main build reverted to Kotlin 2.3.21
- CI runs the standalone example after publishToIntegrationRepository
- Remove grpcKrpc() convenience method (service descriptors conflict
with @grpc interface names); grpcKrpcLite() remains
- Use libs.versions.toml instead of gradle.properties for version declarations - Fix broken README link to examples/grpc-krpc (now standalone-examples) - Fix CI step: remove dead protoktVersion computation (build reads from filesystem directly) - Fix grpcKrpc KDoc: reference client/server deps, not grpc-core - Remove hardcoded version strings from build.gradle.kts
…atalog in buildscript
ogolberg
approved these changes
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
grpcKrpcgeneration flag that emits@Grpc-annotated Kotlin interfaces from proto service definitionsprotokt-runtime-grpc-krpcpublished module: marshaller bridge between protokt serialization and kotlinx-rpc'sGrpcMarshallerinterfaceGrpcServer/GrpcClientproto-google-common-protos-grpc-krpc)Generate.all()convenience method (misleading with multiple mutually exclusive gRPC backends)Generate.grpcKrpcLite()andGenerate.grpcKotlin()convenience methods@OnlyForUseByGeneratedProtoCodeonAbstractDeserializer/AbstractMessagewith@SubclassOptInRequiredso users don't need opt-in to use generated companions asDeserializer<T>Standalone example
The kRPC example lives in
standalone-examples/grpc-krpc/as its own Gradle build (mirroringgradle-plugin-integration-test/). This is necessary because the kotlinx-rpc compiler plugin resolves as{kotlinVersion}-{rpcVersion}, permanently coupling its Kotlin version to kRPC's release cadence and we don't want to be bound to that cadence.What protokt generates (from
hello_world.proto):Streaming methods (from
route_guide.proto):What the kotlinx-rpc compiler plugin generates from that:
Greeter$$rpcServiceStub: implementsGreeter, delegates calls throughRpcClientGreeter$$rpcServiceStub$Companion: implements bothRpcServiceDescriptor<Greeter>andGrpcServiceDescriptor<Greeter>, providesdelegate(marshallerResolver, config)for wiring method descriptors and marshallersUser-facing API: