Skip to content

Commit

Permalink
Use protobuf package for gRPC service qualification, not the Kotlin p…
Browse files Browse the repository at this point in the history
…ackage (#49)

* use protobuf package for gRPC service qualification, not the kotlin package

* gradle 6.4 and depend on grpc-stub
  • Loading branch information
andrewparmet authored May 13, 2020
1 parent 62a6349 commit fa6df45
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 2 deletions.
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ internal object ServiceAnnotator {
if (ctx.pkg.default) {
s.name
} else {
"${ctx.pkg}.${s.name}"
"${ctx.desc.packageName}.${s.name}"
}

private fun renderDescriptor(s: Service) =
Expand Down
5 changes: 5 additions & 0 deletions testing/plugin-options/ignore-java-package/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@ sourceSets {
protokt {
respectJavaPackage = false
}

dependencies {
implementation(project(":protokt-runtime-grpc"))
implementation(libraries.grpcStub)
}
2 changes: 2 additions & 0 deletions testing/runtime-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ pureKotlin()

dependencies {
implementation(kotlin("reflect"))
implementation(project(":protokt-runtime-grpc"))
implementation(project(":testing:protobuf-java"))
implementation(libraries.grpcStub)

testImplementation(libraries.jackson)
testImplementation(libraries.protobuf)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2020 Toast Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

syntax = "proto3";

package toasttab.protokt.testing.rt;

option java_package = "com.toasttab.protokt.testing.rt";

service TestService {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2020 Toast Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.toasttab.protokt.testing.rt

import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.Test

class ServicePackageTest {
@Test
fun `service has protobuf package`() {
assertThat(TestServiceGrpc.SERVICE_NAME.substringBeforeLast("."))
.isEqualTo("toasttab.protokt.testing.rt")
}
}

0 comments on commit fa6df45

Please sign in to comment.