Skip to content

Commit 7f3228e

Browse files
committed
rename kxrpc to kotlinMultiplatform
1 parent 3082a69 commit 7f3228e

File tree

7 files changed

+64
-68
lines changed

7 files changed

+64
-68
lines changed

gradle-plugin/src/main/kotlin/kotlinx/rpc/grpc/DefaultGrpcExtension.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import kotlinx.rpc.buf.tasks.registerGenerateBufYamlTask
1616
import kotlinx.rpc.proto.*
1717
import kotlinx.rpc.proto.ProtocPlugin.Companion.GRPC_JAVA
1818
import kotlinx.rpc.proto.ProtocPlugin.Companion.GRPC_KOTLIN
19-
import kotlinx.rpc.proto.ProtocPlugin.Companion.KXRPC
19+
import kotlinx.rpc.proto.ProtocPlugin.Companion.KOTLIN_MULTIPLATFORM
2020
import kotlinx.rpc.proto.ProtocPlugin.Companion.PROTOBUF_JAVA
2121
import kotlinx.rpc.util.ensureDirectoryExists
2222
import org.gradle.api.Action
@@ -56,15 +56,15 @@ internal open class DefaultGrpcExtension @Inject constructor(
5656

5757
init {
5858
project.configureBufExecutable()
59-
project.configureKxRpcPluginJarConfiguration()
59+
project.configureKotlinMultiplatformPluginJarConfiguration()
6060

6161
createDefaultProtocPlugins()
6262

6363
project.protoSourceSets.forEach { protoSourceSet ->
6464
protoSourceSet.protocPlugin(protocPlugins.protobufJava)
6565
protoSourceSet.protocPlugin(protocPlugins.grpcJava)
6666
protoSourceSet.protocPlugin(protocPlugins.grpcKotlin)
67-
protoSourceSet.protocPlugin(protocPlugins.kxrpc)
67+
protoSourceSet.protocPlugin(protocPlugins.kotlinMultiplatform)
6868
}
6969

7070
project.afterEvaluate {
@@ -269,12 +269,12 @@ internal open class DefaultGrpcExtension @Inject constructor(
269269
}
270270

271271
private fun createDefaultProtocPlugins() {
272-
protocPlugins.create(KXRPC) {
272+
protocPlugins.create(KOTLIN_MULTIPLATFORM) {
273273
local {
274-
javaJar(project.kxrpcProtocPluginJarPath)
274+
javaJar(project.kotlinMultiplatformProtocPluginJarPath)
275275
}
276276

277-
options.put("debugOutput", "protobuf-kxrpc-plugin.log")
277+
options.put("debugOutput", "protoc-gen-kotlin-multiplatform.log")
278278
options.put("messageMode", "interface")
279279
options.put("explicitApiModeEnabled", project.provider {
280280
project.the<KotlinBaseExtension>().explicitApi != ExplicitApiMode.Disabled

gradle-plugin/src/main/kotlin/kotlinx/rpc/proto/ProtocPlugin.kt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package kotlinx.rpc.proto
66

77
import kotlinx.rpc.proto.ProtocPlugin.Companion.GRPC_JAVA
88
import kotlinx.rpc.proto.ProtocPlugin.Companion.GRPC_KOTLIN
9-
import kotlinx.rpc.proto.ProtocPlugin.Companion.KXRPC
9+
import kotlinx.rpc.proto.ProtocPlugin.Companion.KOTLIN_MULTIPLATFORM
1010
import kotlinx.rpc.proto.ProtocPlugin.Companion.PROTOBUF_JAVA
1111
import kotlinx.rpc.util.OS
1212
import org.gradle.api.Action
@@ -22,16 +22,16 @@ import org.gradle.kotlin.dsl.mapProperty
2222
import org.gradle.kotlin.dsl.property
2323

2424
/**
25-
* Access to the `kotlinx-rpc` protoc plugin.
25+
* Access to the `kotlin-multiplatform` protoc plugin.
2626
*/
27-
public val NamedDomainObjectContainer<ProtocPlugin>.kxrpc: NamedDomainObjectProvider<ProtocPlugin>
28-
get() = named(KXRPC)
27+
public val NamedDomainObjectContainer<ProtocPlugin>.kotlinMultiplatform: NamedDomainObjectProvider<ProtocPlugin>
28+
get() = named(KOTLIN_MULTIPLATFORM)
2929

3030
/**
31-
* Configures the `kotlinx-rpc` protoc plugin.
31+
* Configures the `kotlin-multiplatform` protoc plugin.
3232
*/
33-
public fun NamedDomainObjectContainer<ProtocPlugin>.kxrpc(action: Action<ProtocPlugin>) {
34-
kxrpc.configure(action)
33+
public fun NamedDomainObjectContainer<ProtocPlugin>.kotlinMultiplatform(action: Action<ProtocPlugin>) {
34+
kotlinMultiplatform.configure(action)
3535
}
3636

3737
/**
@@ -188,28 +188,28 @@ public open class ProtocPlugin(
188188

189189
public companion object {
190190
/**
191-
* The name of the kotlinx-rpc protoc plugin.
191+
* The name of the `kotlin-multiplatform` protoc plugin.
192192
*
193-
* @see [kxrpc]
193+
* @see [kotlinMultiplatform]
194194
*/
195-
public const val KXRPC: String = "kotlinx-rpc"
195+
public const val KOTLIN_MULTIPLATFORM: String = "kotlin-multiplatform"
196196

197197
/**
198-
* The name of the protobuf-java protoc plugin.
198+
* The name of the `protobuf-java` protoc plugin.
199199
*
200200
* @see [protobufJava]
201201
*/
202202
public const val PROTOBUF_JAVA: String = "java"
203203

204204
/**
205-
* The name of the grpc-java protoc plugin.
205+
* The name of the `grpc-java` protoc plugin.
206206
*
207207
* @see [grpcJava]
208208
*/
209209
public const val GRPC_JAVA: String = "grpc-java"
210210

211211
/**
212-
* The name of the grpc-kotlin protoc plugin.
212+
* The name of the `grpc-kotlin` protoc plugin.
213213
*
214214
* @see [grpcKotlin]
215215
*/

gradle-plugin/src/main/kotlin/kotlinx/rpc/proto/consts.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ public const val PROTO_FILES_DIR: String = "proto"
5252
public const val PROTO_FILES_IMPORT_DIR: String = "import"
5353

5454
/**
55-
* [Configuration] name for the `kotlinx-rpc` protoc plugin artifact.
55+
* [Configuration] name for the `protoc-gen-kotlin-multiplatform` protoc plugin artifact.
5656
*
5757
* MUST be a single file.
5858
*/
59-
public const val KXRPC_PLUGIN_JAR_CONFIGURATION: String = "kxrpcPluginJar"
59+
public const val PROTOC_GEN_KOTLIN_MULTIPLATFORM_JAR_CONFIGURATION: String = "protocGenKotlinMultiplatformJar"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
package kotlinx.rpc.proto
6+
7+
import kotlinx.rpc.LIBRARY_VERSION
8+
import org.gradle.api.Project
9+
import org.gradle.api.provider.Provider
10+
11+
/**
12+
* Absolute path to the `protoc-gen-kotlin-multiplatform` jar.
13+
*
14+
* Can be used to customise the java executable path:
15+
* ```kotlin
16+
* rpc.grpc.protocPlugins.kotlinMultiplatform {
17+
* local {
18+
* javaJar(kotlinMultiplatformProtocPluginJarPath, provider { "my-path-to-java" })
19+
* }
20+
* }
21+
* ```
22+
*/
23+
public val Project.kotlinMultiplatformProtocPluginJarPath: Provider<String>
24+
get() = project.configurations.named(PROTOC_GEN_KOTLIN_MULTIPLATFORM_JAR_CONFIGURATION).map { it.singleFile.absolutePath }
25+
26+
internal fun Project.configureKotlinMultiplatformPluginJarConfiguration() {
27+
configurations.create(PROTOC_GEN_KOTLIN_MULTIPLATFORM_JAR_CONFIGURATION)
28+
29+
dependencies.add(
30+
PROTOC_GEN_KOTLIN_MULTIPLATFORM_JAR_CONFIGURATION,
31+
mapOf(
32+
"group" to "org.jetbrains.kotlinx",
33+
"name" to "protoc-gen-kotlin-multiplatform",
34+
"version" to LIBRARY_VERSION,
35+
"classifier" to "all",
36+
"ext" to "jar",
37+
),
38+
)
39+
}

gradle-plugin/src/main/kotlin/kotlinx/rpc/proto/kxrpcPluginJar.kt

Lines changed: 0 additions & 39 deletions
This file was deleted.

grpc/grpc-core/build.gradle.kts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@
33
*/
44

55
import kotlinx.rpc.buf.tasks.BufGenerateTask
6-
import kotlinx.rpc.proto.kxrpc
6+
import kotlinx.rpc.proto.kotlinMultiplatform
77
import org.gradle.kotlin.dsl.withType
88

9-
/*
10-
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
11-
*/
12-
139
plugins {
1410
alias(libs.plugins.conventions.kmp)
1511
alias(libs.plugins.kotlinx.rpc)
@@ -74,7 +70,7 @@ rpc {
7470
grpc {
7571
val globalRootDir: String by extra
7672

77-
protocPlugins.kxrpc {
73+
protocPlugins.kotlinMultiplatform {
7874
local {
7975
javaJar("$globalRootDir/protoc-gen/build/libs/protoc-gen-$version-all.jar")
8076
}

grpc/grpc-ktor-server/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
import kotlinx.rpc.buf.tasks.BufGenerateTask
6-
import kotlinx.rpc.proto.kxrpc
6+
import kotlinx.rpc.proto.kotlinMultiplatform
77
import org.gradle.kotlin.dsl.kotlin
88
import org.gradle.kotlin.dsl.withType
99

@@ -44,7 +44,7 @@ rpc {
4444
grpc {
4545
val globalRootDir: String by extra
4646

47-
protocPlugins.kxrpc {
47+
protocPlugins.kotlinMultiplatform {
4848
local {
4949
javaJar("$globalRootDir/protoc-gen/build/libs/protoc-gen-$version-all.jar")
5050
}

0 commit comments

Comments
 (0)