diff --git a/wire-golden-files/build.gradle.kts b/wire-golden-files/build.gradle.kts index 0769be4d37..7003869864 100644 --- a/wire-golden-files/build.gradle.kts +++ b/wire-golden-files/build.gradle.kts @@ -4,7 +4,27 @@ plugins { id("com.squareup.wire") } +dependencies { + implementation(projects.wireGrpcClient) +} + wire { + kotlin { + includes = listOf("squareup.wire.service.*") + out = "src/main/kotlin" + exclusive = false + rpcRole = "client" + rpcCallStyle = "suspending" + } + + kotlin { + includes = listOf("squareup.wire.service.*") + out = "src/main/kotlin" + exclusive = true + rpcRole = "server" + rpcCallStyle = "blocking" + } + kotlin { includes = listOf("squareup.wire.buildersonly.*") out = "src/main/kotlin" @@ -22,3 +42,8 @@ wire { out = "src/main/kotlin" } } + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} diff --git a/wire-golden-files/src/main/kotlin/squareup/wire/service/GrpcMyServiceClient.kt b/wire-golden-files/src/main/kotlin/squareup/wire/service/GrpcMyServiceClient.kt new file mode 100644 index 0000000000..abcb944284 --- /dev/null +++ b/wire-golden-files/src/main/kotlin/squareup/wire/service/GrpcMyServiceClient.kt @@ -0,0 +1,21 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source: squareup.wire.service.MyService in squareup/wire/service.proto +package squareup.wire.service + +import com.squareup.wire.GrpcCall +import com.squareup.wire.GrpcClient +import com.squareup.wire.GrpcMethod +import com.squareup.wire.ProtoAdapter +import kotlin.String +import kotlin.collections.Map + +public class GrpcMyServiceClient( + private val client: GrpcClient, +) : MyServiceClient { + override fun CreateOrder(): GrpcCall?, Map?> = + client.newCall(GrpcMethod( + path = "/squareup.wire.service.MyService/CreateOrder", + requestAdapter = ProtoAdapter.STRUCT_MAP, + responseAdapter = ProtoAdapter.STRUCT_MAP + )) +} diff --git a/wire-golden-files/src/main/kotlin/squareup/wire/service/MyServiceBlockingServer.kt b/wire-golden-files/src/main/kotlin/squareup/wire/service/MyServiceBlockingServer.kt new file mode 100644 index 0000000000..9a050a45c0 --- /dev/null +++ b/wire-golden-files/src/main/kotlin/squareup/wire/service/MyServiceBlockingServer.kt @@ -0,0 +1,18 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source: squareup.wire.service.MyService in squareup/wire/service.proto +package squareup.wire.service + +import com.squareup.wire.Service +import com.squareup.wire.WireRpc +import kotlin.String +import kotlin.collections.Map + +public interface MyServiceBlockingServer : Service { + @WireRpc( + path = "/squareup.wire.service.MyService/CreateOrder", + requestAdapter = "com.squareup.wire.ProtoAdapter#STRUCT_MAP", + responseAdapter = "com.squareup.wire.ProtoAdapter#STRUCT_MAP", + sourceFile = "squareup/wire/service.proto", + ) + public fun CreateOrder(request: Map?): Map? +} diff --git a/wire-golden-files/src/main/kotlin/squareup/wire/service/MyServiceClient.kt b/wire-golden-files/src/main/kotlin/squareup/wire/service/MyServiceClient.kt new file mode 100644 index 0000000000..12cefab7b6 --- /dev/null +++ b/wire-golden-files/src/main/kotlin/squareup/wire/service/MyServiceClient.kt @@ -0,0 +1,12 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source: squareup.wire.service.MyService in squareup/wire/service.proto +package squareup.wire.service + +import com.squareup.wire.GrpcCall +import com.squareup.wire.Service +import kotlin.String +import kotlin.collections.Map + +public interface MyServiceClient : Service { + public fun CreateOrder(): GrpcCall?, Map?> +} diff --git a/wire-golden-files/src/main/proto/squareup/wire/service.proto b/wire-golden-files/src/main/proto/squareup/wire/service.proto new file mode 100644 index 0000000000..a591c88388 --- /dev/null +++ b/wire-golden-files/src/main/proto/squareup/wire/service.proto @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2023 Square, 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 = "proto2"; +package squareup.wire.service; + +import "google/protobuf/struct.proto"; + +service MyService { + rpc CreateOrder(google.protobuf.Struct) returns (google.protobuf.Struct); +}