Skip to content

Commit

Permalink
Generate gRPC service and client based on grpc-kotlin (#17)
Browse files Browse the repository at this point in the history
* Generate gRPC service and client based on grpc-kotlin

* Generate client and stub with grpc-kotlin

* Build all branches snapshot

* Add snapshot to dependency repositories

* Make stub class as nested class of support

* Register local client via localhost loop

* Make client registrar work with grpc-kotlin

* Make 'serviceDescriptor' abstract

* Make build with snapshot repository

* Add snapshot with username/password

* Fix wrong repository name

* Try to fix snapshot repository not work

* Upgrade project plugin to 0.0.1

* Only set credentials when username not be null

* Remove gRpc runtime classes

* Make ktlint happy
  • Loading branch information
devkanro authored May 26, 2020
1 parent 34896db commit c3db7a0
Show file tree
Hide file tree
Showing 31 changed files with 365 additions and 701 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,10 @@ jobs:
with:
java-version: 1.11
- uses: ButterCam/prepare-sisyphus-build@v1
with:
dependency-repositories: local,central,snapshot,portal
snapshot-url: https://oss.sonatype.org/content/repositories/snapshots
snapshot-username: ''
snapshot-password: ''
- name: Build with Gradle
run: gradle build
3 changes: 2 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Publish

on:
push:
branches: [ master ]
branches: [ '**' ]
release:
types: [ created ]

Expand All @@ -25,6 +25,7 @@ jobs:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
- uses: ButterCam/prepare-sisyphus-build@v1
with:
dependency-repositories: local,central,jcenter,portal,snapshot
snapshot-url: https://oss.sonatype.org/content/repositories/snapshots
snapshot-username: ${{ secrets.OSSRH_USERNAME }}
snapshot-password: ${{ secrets.OSSRH_PASSWORD }}
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ plugins {
`java-library`
`kotlin-dsl`
id("idea")
id("com.bybutter.sisyphus.project") version "0.0.1-M6"
id("com.bybutter.sisyphus.project") version "0.0.1"
}

dependencies {
implementation(platform("com.bybutter.sisyphus:sisyphus-dependencies:0.0.1-M6"))
implementation(platform("com.bybutter.sisyphus:sisyphus-dependencies:grpckt-SNAPSHOT"))
implementation("com.bybutter.sisyphus.tools:sisyphus-protobuf-gradle-plugin")
implementation("com.bybutter.sisyphus.tools:sisyphus-project-gradle-plugin")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin")
Expand Down
2 changes: 2 additions & 0 deletions buildSrc/src/main/kotlin/dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ object Dependencies {
const val netty = "$group:grpc-netty"

const val proto = "$group:grpc-protobuf"

const val kotlin = "$group:grpc-kotlin-stub"
}

object Maven {
Expand Down
1 change: 1 addition & 0 deletions dependencies/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@ dependencies {
api("com.gradle.publish:plugin-publish-plugin:0.11.0")
api("org.eclipse.jgit:org.eclipse.jgit:5.7.0.202003110725-r")
api("com.palantir.gradle.docker:gradle-docker:0.25.0")
api("io.grpc:grpc-kotlin-stub:0.1.2")
}
}
3 changes: 2 additions & 1 deletion lib/sisyphus-grpc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ plugins {
description = "Sisyphus customized gRPC runtime for Kotlin coroutine"

dependencies {
implementation(project(":lib:sisyphus-jackson"))
api(project(":lib:sisyphus-protobuf"))
api(Dependencies.Grpc.stub)
api(Dependencies.Grpc.kotlin)
api(Dependencies.Kotlin.Coroutines.reactor)
api(Dependencies.Kotlin.Coroutines.guava)
api(Dependencies.Proto.base)

implementation(project(":lib:sisyphus-jackson"))
implementation(project(":lib:sisyphus-common"))
implementation(Dependencies.Grpc.proto)
implementation(Dependencies.Kotlin.reflect)
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.bybutter.sisyphus.rpc

object GrpcServerConstants {
const val GRPC_PORT_PROPERTY = "server.grpc.port"

const val DEFAULT_GRPC_PORT = 9090
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.bybutter.sisyphus.rpc

import com.bybutter.sisyphus.protobuf.primitives.ServiceDescriptorProto
import io.grpc.ServiceDescriptor

abstract class ServiceSupport {
abstract val descriptor: ServiceDescriptorProto

abstract val serviceDescriptor: ServiceDescriptor
}
1 change: 0 additions & 1 deletion lib/sisyphus-protobuf/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ dependencies {

implementation(Dependencies.Grpc.proto)
implementation(Dependencies.Kotlin.Coroutines.guava)
api(Dependencies.Grpc.stub)
api(Dependencies.Kotlin.Coroutines.reactor)
api(Dependencies.Proto.base)

Expand Down
1 change: 0 additions & 1 deletion middleware/sisyphus-grpc-client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ middleware

plugins {
`java-library`
protobuf
}

description = "Middleware for using gRPC client in Sisyphus Project"
Expand Down
Loading

0 comments on commit c3db7a0

Please sign in to comment.