Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
blachris committed Oct 7, 2023
1 parent 52d075d commit d85f5de
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 48 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
![Java CI](https://github.com/gordonmu/ktor-grpcweb/workflows/Java%20CI/badge.svg)
[ ![Download](https://api.bintray.com/packages/gordonmu/jvm/ktor-grpcweb/images/download.svg) ](https://bintray.com/gordonmu/jvm/ktor-grpcweb/_latestVersion)
![Java CI](https://github.com/blachris/ktor-grpcweb/workflows/Java%20CI/badge.svg)
[ ![Download](https://api.bintray.com/packages/blachris/jvm/ktor-grpcweb/images/download.svg) ](https://bintray.com/blachris/jvm/ktor-grpcweb/_latestVersion)

# Embedded gRPC Web Proxy for Ktor
An embedded [gRPC Web](https://github.com/grpc/grpc-web) proxy for Java/Kotlin [gRPC](https://grpc.io/) servers
Expand Down
93 changes: 53 additions & 40 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'maven-publish'

buildscript {
ext.kotlin_version = '1.4.0'
ext.kotlinxcoroutine_version = '1.4.0'
ext.kotlin_version = '1.8.22'
ext.kotlinxcoroutine_version = '1.7.3'
ext.kotlinlogging_version = '1.8.3'
ext.grpc_version = '1.34.1'
ext.jackson_version = '2.9.8'
ext.slf4j_version = '1.7.30'
ext.log4jslf4j_version = '2.13.3'
ext.slf4j_version = '1.7.36'
ext.log4jslf4j_version = '2.20.0'
ext.junit5_version = '5.6.2'
ext.mockk_version = '1.10.0'
ext.assertj_version = '3.17.2'
ext.awaitility_version = '4.0.3'
ext.ktor_version = '1.5.0'
ext.ktor_version = '1.6.8'
ext.guava_version = '29.0-jre'

ext.repos = {
Expand All @@ -33,10 +33,6 @@ buildscript {
}
}

if (!project.hasProperty('bintrayUser'))
ext.bintrayUser = ''
if (!project.hasProperty('bintrayApikey'))
ext.bintrayApikey = ''
ext.pomConfig = {
licenses {
license {
Expand All @@ -47,17 +43,16 @@ ext.pomConfig = {
}

scm {
url "https://github.com/gordonmu/ktor-grpcweb.git"
url "https://github.com/blachris/ktor-grpcweb.git"
}
}

apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'signing'

group 'com.github.gordonmu.ktor-grpcweb'
version = '0.1.0'
group 'com.github.blachris.ktor-grpcweb'
version = '0.2.0'
if (!project.hasProperty("release")) {
version += '-SNAPSHOT'
}
Expand Down Expand Up @@ -133,44 +128,62 @@ dependencies {

publishing {
publications {
maven(MavenPublication) {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar {
classifier "sources"
archiveClassifier.set("sources")
}
artifact javadocJar {
classifier "javadoc"
archiveClassifier.set("javadoc")
}
groupId project.group
artifactId project.name
version project.version
pom.withXml {
def root = asNode()
root.appendNode('description', 'An embedded gRPC Web proxy for Ktor.')
root.appendNode('name', 'Embedded Ktor gRPC Web proxy')
root.appendNode('url', 'https://github.com/gordonmu/ktor-grpcweb')
root.children().last() + pomConfig
pom {
name = 'Embedded Ktor gRPC Web proxy'
description = 'An embedded gRPC Web proxy for Ktor.'
url = 'https://github.com/blachris/ktor-grpcweb'

licenses {
license {
name = "The Apache Software License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}

scm {
connection = 'scm:git:https://github.com/blachris/grpcweb.git'
developerConnection = 'scm:git:https://github.com/blachris/ktor-grpcweb.git'
url = 'https://github.com/blachris/ktor-grpcweb'
}

developers {
developer {
id = 'blachris'
name = 'Christopher Schwarzer'
email = '70778512+blachris@users.noreply.github.com'
}
}
}
}
}
repositories {
maven {
url "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2"
credentials {
if (project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword')) {
username = ossrhUsername
password = ossrhPassword
}
}
}
}
}

bintray {
user = bintrayUser
key = bintrayApikey
publications = ['maven']

pkg {
repo = 'jvm'
name = project.name
description = 'An embedded gRPC Web proxy for Ktor.'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/gordonmu/ktor-grpcweb.git'
version {
name = project.version
desc = project.version
released = new Date()
}
if (project.hasProperty('signing.keyId') && project.hasProperty('signing.password') && project.hasProperty('signing.secretKeyRingFile')) {
signing {
sign publishing.publications.mavenJava
}
}


2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
7 changes: 5 additions & 2 deletions src/main/kotlin/GrpcCaller.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.gordonmu.ktor_grpcweb
package com.github.blachris.ktor_grpcweb

import com.google.protobuf.ByteString
import io.grpc.*
Expand All @@ -8,6 +8,7 @@ import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.ReceiveChannel
import kotlinx.coroutines.channels.sendBlocking
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.runBlocking
import java.io.InputStream
import java.lang.Integer.max
import java.util.concurrent.CancellationException
Expand Down Expand Up @@ -52,7 +53,9 @@ private class ClientCallListener(channelSize: Int) : ClientCall.Listener<ByteStr
val responses: ReceiveChannel<ByteString> = respChannel

override fun onMessage(message: ByteString) {
respChannel.sendBlocking(message)
runBlocking {
respChannel.send(message)
}
}

override fun onHeaders(headers: io.grpc.Metadata) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/GrpcWebHandler.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.gordonmu.ktor_grpcweb
package com.github.blachris.ktor_grpcweb

import com.google.protobuf.ByteString
import com.google.protobuf.UnsafeByteOperations
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/MetadataUtil.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.gordonmu.ktor_grpcweb
package com.github.blachris.ktor_grpcweb

import io.ktor.http.*

Expand Down
2 changes: 1 addition & 1 deletion src/test/kotlin/GrpcWebTests.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.gordonmu.ktor_grpcweb
package com.github.blachris.ktor_grpcweb

import com.google.protobuf.ByteString
import io.grpc.*
Expand Down

0 comments on commit d85f5de

Please sign in to comment.