|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!DOCTYPE topic |
| 3 | + SYSTEM "https://resources.jetbrains.com/writerside/1.0/xhtml-entities.dtd"> |
| 4 | +<topic xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 5 | + xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/topic.v2.xsd" |
| 6 | + title="Configuration" id="grpc-configuration"> |
| 7 | + |
| 8 | + <tldr> |
| 9 | + <p> |
| 10 | + Artifacts for gRPC integration are published <a href="">separately</a> |
| 11 | + and updated frequently not in sync with main releases. |
| 12 | + </p> |
| 13 | + <p> |
| 14 | + <a href="https://maven.pkg.jetbrains.space/public/p/krpc/grpc"> |
| 15 | + <img alt="Latest dev version" |
| 16 | + src="https://img.shields.io/badge/dynamic/xml?url=https%3A%2F%2Fmaven.pkg.jetbrains.space%2Fpublic%2Fp%2Fkrpc%2Fgrpc%2Forg%2Fjetbrains%2Fkotlinx%2Fkotlinx-rpc-core%2Fmaven-metadata.xml&query=%2F%2Fmetadata%2Fversioning%2Flatest&label=Latest%20dev%20version&color=forest-green&cacheSeconds=60"/> |
| 17 | + </a> |
| 18 | + </p> |
| 19 | + </tldr> |
| 20 | + |
| 21 | + <p> |
| 22 | + <a href="https://grpc.io">gRPC</a> integration is available in an experimental state. |
| 23 | + The artifacts are published separately in our <a |
| 24 | + href="https://public.jetbrains.space/p/krpc/packages/maven/grpc">Space repository</a>. |
| 25 | + Current latest version can be seen in the badge on top of the page. |
| 26 | + </p> |
| 27 | + <chapter title="Dependencies configuration" id="dependencies-configuration"> |
| 28 | + <p>Below is an example of a project setup.</p> |
| 29 | + <code>settings.gradle.kts</code>: |
| 30 | + <code-block lang="Kotlin"> |
| 31 | + pluginManagement { |
| 32 | + repositories { |
| 33 | + gradlePluginPortal() |
| 34 | + mavenCentral() |
| 35 | + maven("https://maven.pkg.jetbrains.space/public/p/krpc/grpc") |
| 36 | + } |
| 37 | + } |
| 38 | + </code-block> |
| 39 | + <p> |
| 40 | + <code>build.gradle.kts</code>: |
| 41 | + </p> |
| 42 | + <code-block lang="Kotlin"> |
| 43 | + plugins { |
| 44 | + kotlin("jvm") version "2.1.0" |
| 45 | + kotlin("plugin.serialization") version "2.1.0" |
| 46 | + id("org.jetbrains.kotlinx.rpc.plugin") version "<version>" |
| 47 | + id("com.google.protobuf") version "0.9.4" |
| 48 | + } |
| 49 | + |
| 50 | + repositories { |
| 51 | + mavenCentral() |
| 52 | + maven("https://maven.pkg.jetbrains.space/public/p/krpc/grpc") |
| 53 | + } |
| 54 | + |
| 55 | + dependencies { |
| 56 | + implementation("org.jetbrains.kotlinx:kotlinx-rpc-grpc-core:<version>") |
| 57 | + implementation("ch.qos.logback:logback-classic:1.5.16") |
| 58 | + implementation("io.grpc:grpc-netty:1.69.0") |
| 59 | + } |
| 60 | + </code-block> |
| 61 | + <p>Here <code><version></code> comes from the badge above.</p> |
| 62 | + <warning> |
| 63 | + The setup has only been tested on <code>Kotlin/JVM</code> projects. |
| 64 | + </warning> |
| 65 | + </chapter> |
| 66 | + <chapter title="Protoc setup" id="protoc-setup"> |
| 67 | + <p> |
| 68 | + gRPC requires additional code generation from the <a href="https://github.com/google/protobuf-gradle-plugin">protoc</a> |
| 69 | + compiler. |
| 70 | + This can be setup up in the following way: |
| 71 | + </p> |
| 72 | + <code-block lang="Kotlin"> |
| 73 | + protobuf { |
| 74 | + protoc { |
| 75 | + artifact = "com.google.protobuf:protoc:4.29.3" |
| 76 | + } |
| 77 | + |
| 78 | + plugins { |
| 79 | + create("kotlinx-rpc") { |
| 80 | + artifact = "org.jetbrains.kotlinx:kotlinx-rpc-protobuf-plugin:<version>:all@jar" |
| 81 | + } |
| 82 | + |
| 83 | + create("grpc") { |
| 84 | + artifact = "io.grpc:protoc-gen-grpc-java:1.69.0" |
| 85 | + } |
| 86 | + |
| 87 | + create("grpckt") { |
| 88 | + artifact = "io.grpc:protoc-gen-grpc-kotlin:1.4.1:jdk8@jar" |
| 89 | + } |
| 90 | + } |
| 91 | + |
| 92 | + generateProtoTasks { |
| 93 | + all().all { |
| 94 | + plugins { |
| 95 | + create("kotlinx-rpc") { |
| 96 | + option("debugOutput=protobuf-plugin.log") |
| 97 | + option("messageMode=interface") |
| 98 | + } |
| 99 | + create("grpc") |
| 100 | + create("grpckt") |
| 101 | + } |
| 102 | + } |
| 103 | + } |
| 104 | + } |
| 105 | + </code-block> |
| 106 | + </chapter> |
| 107 | +</topic> |
0 commit comments