diff --git a/README.md b/README.md index 1d5109e..272b561 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/build.gradle b/build.gradle index 6bbf324..7c4db83 100644 --- a/build.gradle +++ b/build.gradle @@ -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 = { @@ -33,10 +33,6 @@ buildscript { } } -if (!project.hasProperty('bintrayUser')) - ext.bintrayUser = '' -if (!project.hasProperty('bintrayApikey')) - ext.bintrayApikey = '' ext.pomConfig = { licenses { license { @@ -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' } @@ -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 } } + diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index be52383..27313fb 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/src/main/kotlin/GrpcCaller.kt b/src/main/kotlin/GrpcCaller.kt index b0366b3..4c05d7c 100644 --- a/src/main/kotlin/GrpcCaller.kt +++ b/src/main/kotlin/GrpcCaller.kt @@ -1,4 +1,4 @@ -package com.github.gordonmu.ktor_grpcweb +package com.github.blachris.ktor_grpcweb import com.google.protobuf.ByteString import io.grpc.* @@ -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 @@ -52,7 +53,9 @@ private class ClientCallListener(channelSize: Int) : ClientCall.Listener = respChannel override fun onMessage(message: ByteString) { - respChannel.sendBlocking(message) + runBlocking { + respChannel.send(message) + } } override fun onHeaders(headers: io.grpc.Metadata) { diff --git a/src/main/kotlin/GrpcWebHandler.kt b/src/main/kotlin/GrpcWebHandler.kt index 11846bc..54225bd 100644 --- a/src/main/kotlin/GrpcWebHandler.kt +++ b/src/main/kotlin/GrpcWebHandler.kt @@ -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 diff --git a/src/main/kotlin/MetadataUtil.kt b/src/main/kotlin/MetadataUtil.kt index 51c0cfb..80c0ba5 100644 --- a/src/main/kotlin/MetadataUtil.kt +++ b/src/main/kotlin/MetadataUtil.kt @@ -1,4 +1,4 @@ -package com.github.gordonmu.ktor_grpcweb +package com.github.blachris.ktor_grpcweb import io.ktor.http.* diff --git a/src/test/kotlin/GrpcWebTests.kt b/src/test/kotlin/GrpcWebTests.kt index 6c77e5b..28642b1 100644 --- a/src/test/kotlin/GrpcWebTests.kt +++ b/src/test/kotlin/GrpcWebTests.kt @@ -1,4 +1,4 @@ -package com.github.gordonmu.ktor_grpcweb +package com.github.blachris.ktor_grpcweb import com.google.protobuf.ByteString import io.grpc.*