Skip to content

Commit

Permalink
Merge branch 'master' into fix_server_streaming_43
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-kovalchuk committed Dec 19, 2019
2 parents 7ef3335 + fcc327d commit 8c863ea
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 35 deletions.
32 changes: 14 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Enter Kotlin Coroutines! By generating native Kotlin stubs that allows us to use

## Quick start

Note: This has been tested with `gRPC 1.21.0`, `protobuf 3.7.1`, `kotlin 1.3.40` and `coroutines 1.2.2`.
Note: This has been tested with `gRPC 1.25.0`, `protobuf 3.10.0`, `kotlin 1.3.61` and `coroutines 1.3.3`.

Add a gRPC service definition to your project

Expand Down Expand Up @@ -284,15 +284,13 @@ closed (or if an exception is thrown).

Add the `grpc-kotlin-gen` plugin to your `protobuf-maven-plugin` configuration (see [compile-custom goal](https://www.xolstice.org/protobuf-maven-plugin/compile-custom-mojo.html))

_Note that this only works on unix like system at the moment._

```xml
<properties>
<kotlin.version>1.3.40</kotlin.version>
<kotlinx-coroutines.version>1.2.2</kotlinx-coroutines.version>
<grpc.version>1.21.0</grpc.version>
<protobuf.version>3.7.1</protobuf.version>
<grpc-kotlin.version>0.1.1</grpc-kotlin.version>
<kotlin.version>1.3.61</kotlin.version>
<kotlinx-coroutines.version>1.3.3</kotlinx-coroutines.version>
<grpc.version>1.25.0</grpc.version>
<protobuf.version>3.10.0</protobuf.version>
<grpc-kotlin.version>0.1.3</grpc-kotlin.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -357,7 +355,7 @@ _Note that this only works on unix like system at the moment._
<goals><goal>compile-custom</goal></goals>
<configuration>
<pluginId>grpc-kotlin</pluginId>
<pluginArtifact>io.rouz:grpc-kotlin-gen:${grpc-kotlin.version}:jar:jdk8</pluginArtifact>
<pluginArtifact>io.rouz:grpc-kotlin-gen:${grpc-kotlin.version}:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
</execution>
</executions>
Expand Down Expand Up @@ -392,9 +390,9 @@ _Note that this only works on unix like system at the moment._
Add the `grpc-kotlin-gen` plugin to the plugins section of `protobuf-gradle-plugin`

```gradle
def protobufVersion = '3.7.1'
def grpcVersion = '1.21.0'
def grpcKotlinVersion = '0.1.1'
def protobufVersion = '3.10.0'
def grpcVersion = '1.25.0'
def grpcKotlinVersion = '0.1.3'
protobuf {
protoc {
Expand All @@ -406,7 +404,7 @@ protobuf {
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
}
grpckotlin {
artifact = "io.rouz:grpc-kotlin-gen:${grpcKotlinVersion}:jdk8@jar"
artifact = "io.rouz:grpc-kotlin-gen:${grpcKotlinVersion}"
}
}
generateProtoTasks {
Expand All @@ -418,13 +416,11 @@ protobuf {
}
```

_Note that this only works on unix like system at the moment._

Add the kotlin dependencies

```gradle
def kotlinVersion = '1.3.40'
def kotlinCoroutinesVersion = '1.2.2'
def kotlinVersion = '1.3.61'
def kotlinCoroutinesVersion = '1.3.3'
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
Expand Down Expand Up @@ -586,7 +582,7 @@ call.close() // don't forget to close the send channel
[protoc]: https://www.xolstice.org/protobuf-maven-plugin/examples/protoc-plugin.html
[`suspend`]: https://kotlinlang.org/docs/reference/coroutines-overview.html
[coroutine primitives]: https://github.com/Kotlin/kotlinx.coroutines
[core coroutine primitives]: https://github.com/Kotlin/kotlinx.coroutines/blob/master/core/kotlinx-coroutines-core/README.md
[core coroutine primitives]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/
[Exception handling]: https://kotlinlang.org/docs/reference/coroutines/exception-handling.html
[`Channel`]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental.channels/-channel/index.html
[`Deferred`]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental/-deferred/index.html
Expand Down
12 changes: 6 additions & 6 deletions grpc-kotlin-example-chatserver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
<parent>
<groupId>io.rouz</groupId>
<artifactId>grpc-kotlin-parent</artifactId>
<version>0.1.3-SNAPSHOT</version>
<version>0.1.4-SNAPSHOT</version>
</parent>

<name>grpc-kotlin-example-chatserver</name>
<artifactId>grpc-kotlin-example-chatserver</artifactId>
<packaging>jar</packaging>

<properties>
<kotlin.version>1.3.40</kotlin.version>
<kotlinx-coroutines.version>1.2.2</kotlinx-coroutines.version>
<grpc.version>1.21.0</grpc.version>
<protobuf.version>3.7.1</protobuf.version>
<kotlin.version>1.3.61</kotlin.version>
<kotlinx-coroutines.version>1.3.3</kotlinx-coroutines.version>
<grpc.version>1.25.0</grpc.version>
<protobuf.version>3.10.0</protobuf.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -113,7 +113,7 @@
</goals>
<configuration>
<pluginId>grpc-kotlin</pluginId>
<pluginArtifact>io.rouz:grpc-kotlin-gen:${project.version}:jar:jdk8</pluginArtifact>
<pluginArtifact>io.rouz:grpc-kotlin-gen:${project.version}:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
</execution>
</executions>
Expand Down
16 changes: 13 additions & 3 deletions grpc-kotlin-gen/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.rouz</groupId>
<artifactId>grpc-kotlin-parent</artifactId>
<version>0.1.3-SNAPSHOT</version>
<version>0.1.4-SNAPSHOT</version>
</parent>

<artifactId>grpc-kotlin-gen</artifactId>
Expand Down Expand Up @@ -40,10 +40,20 @@
<configuration>
<mainClass>io.rouz.grpc.kotlin.GrpcKotlinGenerator</mainClass>
<layout>JAR</layout>
<classifier>jdk8</classifier>
<executable>true</executable>
</configuration>
</plugin>
<plugin>
<groupId>com.salesforce.servicelibs</groupId>
<artifactId>canteen-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<goals>
<goal>bootstrap</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public void buildStubExtensionsTest() {
" return MetadataUtils.attachHeaders(this, headers)\n" +
"}";

assertTrue(result.getContent().contains(expected));
String resultContent = result.getContent().replaceAll("\\r", "");
assertTrue(resultContent.contains(expected));
}
}
12 changes: 6 additions & 6 deletions grpc-kotlin-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
<parent>
<groupId>io.rouz</groupId>
<artifactId>grpc-kotlin-parent</artifactId>
<version>0.1.3-SNAPSHOT</version>
<version>0.1.4-SNAPSHOT</version>
</parent>

<name>grpc-kotlin-test</name>
<artifactId>grpc-kotlin-test</artifactId>
<packaging>jar</packaging>

<properties>
<kotlin.version>1.3.40</kotlin.version>
<kotlinx-coroutines.version>1.2.2</kotlinx-coroutines.version>
<grpc.version>1.21.0</grpc.version>
<protobuf.version>3.7.1</protobuf.version>
<kotlin.version>1.3.61</kotlin.version>
<kotlinx-coroutines.version>1.3.3</kotlinx-coroutines.version>
<grpc.version>1.25.0</grpc.version>
<protobuf.version>3.10.0</protobuf.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -115,7 +115,7 @@
</goals>
<configuration>
<pluginId>grpc-kotlin</pluginId>
<pluginArtifact>io.rouz:grpc-kotlin-gen:${project.version}:jar:jdk8</pluginArtifact>
<pluginArtifact>io.rouz:grpc-kotlin-gen:${project.version}:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
</execution>
</executions>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</parent>

<artifactId>grpc-kotlin-parent</artifactId>
<version>0.1.3-SNAPSHOT</version>
<version>0.1.4-SNAPSHOT</version>
<packaging>pom</packaging>

<name>grpc-kotlin</name>
Expand Down

0 comments on commit 8c863ea

Please sign in to comment.