Browse Source

Support WITH_KOTLIN_GRPC for ya ide gradle

Support WITH_KOTLIN_GRPC for ya ide gradle
commit_hash:3393b00307a4160894a72e073eb2eeb9e8f0d747
dimdim11 4 months ago
parent
commit
96fe69bacb

+ 1 - 0
build/conf/java.conf

@@ -1985,6 +1985,7 @@ DETEKT_VERSION=1.23.7
 _KOTLIN_SEM= \
     ${_WITH_KOTLIN_SEM} \
     ${_KOTLIN_VERSION_SEM} \
+    ${_WITH_KOTLIN_GRPC_SEM} \
     ${_WITH_KOTLINC_PLUGIN_ALLOPEN_SEM} \
     ${_WITH_KOTLINC_PLUGIN_LOMBOK_SEM} \
     ${_WITH_KOTLINC_PLUGIN_NOARG_SEM} \

+ 5 - 2
build/conf/proto.conf

@@ -199,12 +199,14 @@ macro _ADD_SEM_PROP_IF_NON_EMPTY(Prop, Args...) {
 }
 
 # tag:proto tag:java-specific
+_WITH_KOTLIN_GRPC_SEM=
 macro WITH_KOTLIN_GRPC() {
     ENABLE(KOTLIN_PROTO)
     PEERDIR(build/platform/java/kotlin_grpc)
-    SET_APPEND(JAVA_PROTO_ARGS ${env:"JAVA_HOME=${JDK_RESOURCE}"} ${env:"KOTLIN_GRPC_JAR=${KOTLIN_GRPC_RESOURCE_GLOBAL}/grpc_kotlin/protoc-gen-grpc-kotlin-1.3.1.jar"} --plugin=protoc-gen-kotlin_grpc=${KOTLIN_GRPC_RESOURCE_GLOBAL}/grpc_kotlin/grpc_kotlin --kotlin_grpc_out=$ARCADIA_BUILD_ROOT/java_out)
-    SET(JAVA_PROTOBUF_PEERS $JAVA_PROTOBUF_PEERS contrib/java/io/grpc/grpc-kotlin-stub/1.3.1)
+    SET_APPEND(JAVA_PROTO_ARGS ${env:"JAVA_HOME=${JDK_RESOURCE}"} ${env:"KOTLIN_GRPC_JAR=${KOTLIN_GRPC_RESOURCE_GLOBAL}/grpc_kotlin/protoc-gen-grpc-kotlin-${KOTLIN_GRPC_VERSION}.jar"} --plugin=protoc-gen-kotlin_grpc=${KOTLIN_GRPC_RESOURCE_GLOBAL}/grpc_kotlin/grpc_kotlin --kotlin_grpc_out=$ARCADIA_BUILD_ROOT/java_out)
+    SET(JAVA_PROTOBUF_PEERS $JAVA_PROTOBUF_PEERS contrib/java/io/grpc/grpc-kotlin-stub/$KOTLIN_GRPC_VERSION)
     SET(JAVA_PROTOBUF_PEERS $JAVA_PROTOBUF_PEERS contrib/java/com/google/protobuf/protobuf-kotlin/${JAVA_PROTO_RUNTIME_VERSION})
+    SET(_WITH_KOTLIN_GRPC_SEM && proto_kotlin_grpc && proto_kotlin_grpc_version ${KOTLIN_GRPC_VERSION})
 }
 
 
@@ -477,6 +479,7 @@ JAVA_PROTO_COMPILER_VERSION = 3.25.3
 JAVA_PROTO_RUNTIME_VERSION = 3.25.3
 JAVA_PROTO_COMMON_VERSION = 2.9.0
 JAVA_GRPC_VERSION = 1.51.0
+KOTLIN_GRPC_VERSION = 1.3.1
 JAVA_NETTY_NETTY_VERSION = 4.1.79.Final
 KOTLIN_PROTO=no
 KOTLIN_PROTO_PEERS=

+ 14 - 1
build/export_generators/ide-gradle/build.gradle.kts.proto.jinja

@@ -106,17 +106,30 @@ protobuf {
         // Download from repositories
         artifact = "com.google.protobuf:protoc:{%- if target.proto_compiler_version -%}{{ target.proto_compiler_version }}{%- else -%}3.22.5{%- endif -%}"
     }
-{%  if target.proto_grpc is defined -%}
+{%  if target.proto_grpc -%}
     plugins {
         id("grpc") {
             artifact = "io.grpc:protoc-gen-grpc-java:{%- if target.proto_grpc_version -%}{{ target.proto_grpc_version }}{%- else -%}1.45.0{%- endif -%}"
         }
+{%-     if target.proto_kotlin_grpc %}
+        id("grpckt") {
+            artifact = "io.grpc:protoc-gen-grpc-kotlin:{%- if target.proto_kotlin_grpc_version -%}{{ target.proto_kotlin_grpc_version }}{%- else -%}1.3.1{%- endif -%}:jdk8@jar"
+        }
+{%      endif -%}
     }
     generateProtoTasks {
         all().forEach {
             it.plugins {
                 id("grpc")
+{%-     if target.proto_kotlin_grpc %}
+                id("grpckt")
+{%      endif -%}
+            }
+{%-     if target.proto_kotlin_grpc %}
+            it.builtins {
+                create("kotlin")
             }
+{%      endif -%}
         }
     }
 {%- endif %}

+ 2 - 0
build/export_generators/ide-gradle/generator.toml

@@ -43,6 +43,8 @@ proto_common_version="str"
 
 proto_grpc="flag"
 proto_grpc_version="str"
+proto_kotlin_grpc="flag"
+proto_kotlin_grpc_version="str"
 
 kotlin_version="str"
 with_kotlin="flag"