Skip to content

Commit 285b839

Browse files
committed
grpc: Fix default proto package in service name
1 parent 1b232a2 commit 285b839

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

cinterop-c/MODULE.bazel.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler-plugin/compiler-plugin-backend/src/main/kotlin/kotlinx/rpc/codegen/extension/RpcDeclarationScanner.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.ir.expressions.IrExpression
1818
import org.jetbrains.kotlin.ir.util.dumpKotlinLike
1919
import org.jetbrains.kotlin.ir.util.getAnnotation
2020
import org.jetbrains.kotlin.ir.util.hasDefaultValue
21+
import org.jetbrains.kotlin.ir.util.packageFqName
2122

2223
/**
2324
* This class scans user declared RPC service
@@ -31,7 +32,9 @@ internal object RpcDeclarationScanner {
3132
var stubClass: IrClass? = null
3233

3334
val grpcAnnotation = service.getAnnotation(RpcClassId.grpcAnnotation.asSingleFqName())
34-
val protoPackage = grpcAnnotation?.arguments?.getOrNull(0)?.asConstString() ?: ""
35+
// if the protoPackage is not set by the annotation, we use the service kotlin package name
36+
val protoPackage = grpcAnnotation?.arguments?.getOrNull(0)?.asConstString()
37+
?: service.packageFqName?.asString() ?: ""
3538

3639
val declarations = service.declarations.memoryOptimizedMap { declaration ->
3740
when (declaration) {

0 commit comments

Comments
 (0)