From 0c2e3d9a19fced3b1e84073d8ef8196f3fb4e1a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Quenaudon?= Date: Thu, 27 Aug 2026 13:34:33 +0100 Subject: [PATCH 1/2] Add wasmWasi target to wire-grpc-client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modules that declare gRPC services generate Kotlin code which depends on wire-grpc-client. wire-grpc-client did not target wasmWasi, so those modules could not compile for wasmWasi even though wire-runtime already supports it. Add a wasmWasi target to wire-grpc-client. The target is gated behind the kwasm system property, the same way wire-runtime gates its wasm targets. The new wasmWasiMain source set holds TODO stub actuals, the same approach the js target uses. Co-authored-by: Benoît Quenaudon Signed-off-by: Benoît Quenaudon --- wire-grpc-client/build.gradle.kts | 7 ++++ .../kotlin/com/squareup/wire/GrpcClient.kt | 23 +++++++++++++ .../kotlin/com/squareup/wire/GrpcHeaders.kt | 20 +++++++++++ .../kotlin/com/squareup/wire/GrpcHttpUrl.kt | 22 ++++++++++++ .../kotlin/com/squareup/wire/GrpcRequest.kt | 31 +++++++++++++++++ .../com/squareup/wire/GrpcRequestBody.kt | 18 ++++++++++ .../kotlin/com/squareup/wire/GrpcResponse.kt | 34 +++++++++++++++++++ .../com/squareup/wire/GrpcResponseBody.kt | 22 ++++++++++++ .../com/squareup/wire/internal/platform.kt | 32 +++++++++++++++++ 9 files changed, 209 insertions(+) create mode 100644 wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcClient.kt create mode 100644 wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcHeaders.kt create mode 100644 wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcHttpUrl.kt create mode 100644 wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcRequest.kt create mode 100644 wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcRequestBody.kt create mode 100644 wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcResponse.kt create mode 100644 wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcResponseBody.kt create mode 100644 wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/internal/platform.kt diff --git a/wire-grpc-client/build.gradle.kts b/wire-grpc-client/build.gradle.kts index 9fdccca4fc..4454aa90bf 100644 --- a/wire-grpc-client/build.gradle.kts +++ b/wire-grpc-client/build.gradle.kts @@ -1,3 +1,4 @@ +import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl import org.jetbrains.kotlin.gradle.dsl.JsModuleKind import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile @@ -36,6 +37,12 @@ kotlin { tvosArm64() tvosSimulatorArm64() } + if (System.getProperty("kwasm", "true").toBoolean()) { + @OptIn(ExperimentalWasmDsl::class) + wasmWasi { + nodejs() + } + } sourceSets { val commonMain by getting { dependencies { diff --git a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcClient.kt b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcClient.kt new file mode 100644 index 0000000000..bc41e15e54 --- /dev/null +++ b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcClient.kt @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2020 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 + * + * https://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.squareup.wire + +actual abstract class GrpcClient { + actual abstract fun newCall(method: GrpcMethod): GrpcCall + actual abstract fun newStreamingCall(method: GrpcMethod): GrpcStreamingCall + actual abstract fun newClientStreamingCall(method: GrpcMethod): GrpcClientStreamingCall + actual abstract fun newServerStreamingCall(method: GrpcMethod): GrpcServerStreamingCall +} diff --git a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcHeaders.kt b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcHeaders.kt new file mode 100644 index 0000000000..b31a389465 --- /dev/null +++ b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcHeaders.kt @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2020 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 + * + * https://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.squareup.wire + +actual class GrpcHeaders { + actual operator fun get(name: String): String? = TODO() +} diff --git a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcHttpUrl.kt b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcHttpUrl.kt new file mode 100644 index 0000000000..69714cbf4d --- /dev/null +++ b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcHttpUrl.kt @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2020 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 + * + * https://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.squareup.wire + +actual class GrpcHttpUrl { + actual fun resolve(link: String): GrpcHttpUrl? = TODO("Not yet implemented") +} + +actual fun String.toHttpUrl(): GrpcHttpUrl = TODO("Not yet implemented") diff --git a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcRequest.kt b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcRequest.kt new file mode 100644 index 0000000000..fba5417072 --- /dev/null +++ b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcRequest.kt @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2020 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 + * + * https://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.squareup.wire + +actual class GrpcRequest + +actual open class GrpcRequestBuilder { + actual open fun url(url: GrpcHttpUrl): GrpcRequestBuilder = TODO("Not yet implemented") + actual open fun addHeader( + name: String, + value: String, + ): GrpcRequestBuilder = TODO("Not yet implemented") + actual open fun method( + method: String, + body: GrpcRequestBody?, + ): GrpcRequestBuilder = TODO("Not yet implemented") + actual open fun build(): GrpcRequest = TODO("Not yet implemented") +} diff --git a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcRequestBody.kt b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcRequestBody.kt new file mode 100644 index 0000000000..64a54e1288 --- /dev/null +++ b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcRequestBody.kt @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2020 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 + * + * https://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.squareup.wire + +actual abstract class GrpcRequestBody diff --git a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcResponse.kt b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcResponse.kt new file mode 100644 index 0000000000..97da212f6c --- /dev/null +++ b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcResponse.kt @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2020 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 + * + * https://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.squareup.wire + +internal actual class GrpcResponse { + actual val body: GrpcResponseBody? + get() = TODO("Not yet implemented") + + actual fun header( + name: String, + defaultValue: String?, + ): String? { + TODO("Not yet implemented") + } + + actual fun trailers(): GrpcHeaders = TODO("Not yet implemented") + + actual fun close() { + TODO("Not yet implemented") + } +} diff --git a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcResponseBody.kt b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcResponseBody.kt new file mode 100644 index 0000000000..f46dc85c8b --- /dev/null +++ b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcResponseBody.kt @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2020 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 + * + * https://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.squareup.wire + +import okio.BufferedSource + +actual abstract class GrpcResponseBody { + actual abstract fun source(): BufferedSource +} diff --git a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/internal/platform.kt b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/internal/platform.kt new file mode 100644 index 0000000000..9b96271be2 --- /dev/null +++ b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/internal/platform.kt @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2020 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 + * + * https://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.squareup.wire.internal + +import com.squareup.wire.GrpcResponse +import okio.Sink +import okio.Source + +internal actual interface Call { + actual fun cancel() + actual fun execute(): GrpcResponse +} + +internal actual fun Sink.asGzip(): Sink = throw UnsupportedOperationException("Gzip not implemented for wasmWasi") + +internal actual fun Source.asGzip(): Source = throw UnsupportedOperationException("Gzip not implemented for wasmWasi") + +internal actual fun Throwable.addSuppressed(other: Throwable) { +} From bf462ed8f04d0f1a8534e5c653d0ed35c1a80d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Quenaudon?= Date: Thu, 27 Aug 2026 14:41:05 +0100 Subject: [PATCH 2/2] Share gRPC stub actuals in one nonJvmMain source set, add wasmJs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The js, native, and wasmWasi targets each held their own copy of the same 8 TODO stub actuals. Create an intermediate nonJvmMain source set that holds the stubs once, and attach the js, native, wasmJs, and wasmWasi targets to it. This follows the guidance in PR 3152 and mirrors the nonJvmMain wiring wire-runtime already uses. Add the wasmJs target, gated behind the kwasm system property like the other wasm targets. The gzip exception messages no longer name a single platform because one file now serves several platforms. Co-authored-by: Benoît Quenaudon Signed-off-by: Benoît Quenaudon --- wire-grpc-client/build.gradle.kts | 25 ++++++++++++++ .../kotlin/com/squareup/wire/GrpcClient.kt | 23 ------------- .../kotlin/com/squareup/wire/GrpcHeaders.kt | 20 ----------- .../kotlin/com/squareup/wire/GrpcHttpUrl.kt | 22 ------------ .../kotlin/com/squareup/wire/GrpcRequest.kt | 31 ----------------- .../com/squareup/wire/GrpcRequestBody.kt | 18 ---------- .../kotlin/com/squareup/wire/GrpcResponse.kt | 34 ------------------- .../com/squareup/wire/GrpcResponseBody.kt | 22 ------------ .../com/squareup/wire/internal/platform.kt | 32 ----------------- .../kotlin/com/squareup/wire/GrpcClient.kt | 0 .../kotlin/com/squareup/wire/GrpcHeaders.kt | 0 .../kotlin/com/squareup/wire/GrpcHttpUrl.kt | 0 .../kotlin/com/squareup/wire/GrpcRequest.kt | 0 .../com/squareup/wire/GrpcRequestBody.kt | 0 .../kotlin/com/squareup/wire/GrpcResponse.kt | 0 .../com/squareup/wire/GrpcResponseBody.kt | 0 .../com/squareup/wire/internal/platform.kt | 4 +-- .../kotlin/com/squareup/wire/GrpcClient.kt | 23 ------------- .../kotlin/com/squareup/wire/GrpcHeaders.kt | 20 ----------- .../kotlin/com/squareup/wire/GrpcHttpUrl.kt | 22 ------------ .../kotlin/com/squareup/wire/GrpcRequest.kt | 31 ----------------- .../com/squareup/wire/GrpcRequestBody.kt | 18 ---------- .../kotlin/com/squareup/wire/GrpcResponse.kt | 34 ------------------- .../com/squareup/wire/GrpcResponseBody.kt | 22 ------------ .../com/squareup/wire/internal/platform.kt | 32 ----------------- 25 files changed, 27 insertions(+), 406 deletions(-) delete mode 100644 wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcClient.kt delete mode 100644 wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcHeaders.kt delete mode 100644 wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcHttpUrl.kt delete mode 100644 wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcRequest.kt delete mode 100644 wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcRequestBody.kt delete mode 100644 wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcResponse.kt delete mode 100644 wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcResponseBody.kt delete mode 100644 wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/internal/platform.kt rename wire-grpc-client/src/{jsMain => nonJvmMain}/kotlin/com/squareup/wire/GrpcClient.kt (100%) rename wire-grpc-client/src/{jsMain => nonJvmMain}/kotlin/com/squareup/wire/GrpcHeaders.kt (100%) rename wire-grpc-client/src/{jsMain => nonJvmMain}/kotlin/com/squareup/wire/GrpcHttpUrl.kt (100%) rename wire-grpc-client/src/{jsMain => nonJvmMain}/kotlin/com/squareup/wire/GrpcRequest.kt (100%) rename wire-grpc-client/src/{jsMain => nonJvmMain}/kotlin/com/squareup/wire/GrpcRequestBody.kt (100%) rename wire-grpc-client/src/{jsMain => nonJvmMain}/kotlin/com/squareup/wire/GrpcResponse.kt (100%) rename wire-grpc-client/src/{jsMain => nonJvmMain}/kotlin/com/squareup/wire/GrpcResponseBody.kt (100%) rename wire-grpc-client/src/{jsMain => nonJvmMain}/kotlin/com/squareup/wire/internal/platform.kt (89%) delete mode 100644 wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcClient.kt delete mode 100644 wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcHeaders.kt delete mode 100644 wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcHttpUrl.kt delete mode 100644 wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcRequest.kt delete mode 100644 wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcRequestBody.kt delete mode 100644 wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcResponse.kt delete mode 100644 wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcResponseBody.kt delete mode 100644 wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/internal/platform.kt diff --git a/wire-grpc-client/build.gradle.kts b/wire-grpc-client/build.gradle.kts index 4454aa90bf..2b5428ba25 100644 --- a/wire-grpc-client/build.gradle.kts +++ b/wire-grpc-client/build.gradle.kts @@ -38,6 +38,10 @@ kotlin { tvosSimulatorArm64() } if (System.getProperty("kwasm", "true").toBoolean()) { + @OptIn(ExperimentalWasmDsl::class) + wasmJs { + browser() + } @OptIn(ExperimentalWasmDsl::class) wasmWasi { nodejs() @@ -56,6 +60,27 @@ kotlin { api(libs.okhttp.core) } } + val nonJvmMain by creating { + dependsOn(commonMain) + } + if (System.getProperty("knative", "true").toBoolean()) { + val nativeMain by getting { + dependsOn(nonJvmMain) + } + } + if (System.getProperty("kjs", "true").toBoolean()) { + val jsMain by getting { + dependsOn(nonJvmMain) + } + } + if (System.getProperty("kwasm", "true").toBoolean()) { + val wasmJsMain by getting { + dependsOn(nonJvmMain) + } + val wasmWasiMain by getting { + dependsOn(nonJvmMain) + } + } } } diff --git a/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcClient.kt b/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcClient.kt deleted file mode 100644 index bc41e15e54..0000000000 --- a/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcClient.kt +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2020 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 - * - * https://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.squareup.wire - -actual abstract class GrpcClient { - actual abstract fun newCall(method: GrpcMethod): GrpcCall - actual abstract fun newStreamingCall(method: GrpcMethod): GrpcStreamingCall - actual abstract fun newClientStreamingCall(method: GrpcMethod): GrpcClientStreamingCall - actual abstract fun newServerStreamingCall(method: GrpcMethod): GrpcServerStreamingCall -} diff --git a/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcHeaders.kt b/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcHeaders.kt deleted file mode 100644 index b31a389465..0000000000 --- a/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcHeaders.kt +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2020 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 - * - * https://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.squareup.wire - -actual class GrpcHeaders { - actual operator fun get(name: String): String? = TODO() -} diff --git a/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcHttpUrl.kt b/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcHttpUrl.kt deleted file mode 100644 index 69714cbf4d..0000000000 --- a/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcHttpUrl.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2020 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 - * - * https://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.squareup.wire - -actual class GrpcHttpUrl { - actual fun resolve(link: String): GrpcHttpUrl? = TODO("Not yet implemented") -} - -actual fun String.toHttpUrl(): GrpcHttpUrl = TODO("Not yet implemented") diff --git a/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcRequest.kt b/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcRequest.kt deleted file mode 100644 index fba5417072..0000000000 --- a/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcRequest.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2020 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 - * - * https://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.squareup.wire - -actual class GrpcRequest - -actual open class GrpcRequestBuilder { - actual open fun url(url: GrpcHttpUrl): GrpcRequestBuilder = TODO("Not yet implemented") - actual open fun addHeader( - name: String, - value: String, - ): GrpcRequestBuilder = TODO("Not yet implemented") - actual open fun method( - method: String, - body: GrpcRequestBody?, - ): GrpcRequestBuilder = TODO("Not yet implemented") - actual open fun build(): GrpcRequest = TODO("Not yet implemented") -} diff --git a/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcRequestBody.kt b/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcRequestBody.kt deleted file mode 100644 index 64a54e1288..0000000000 --- a/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcRequestBody.kt +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (C) 2020 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 - * - * https://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.squareup.wire - -actual abstract class GrpcRequestBody diff --git a/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcResponse.kt b/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcResponse.kt deleted file mode 100644 index 97da212f6c..0000000000 --- a/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcResponse.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2020 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 - * - * https://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.squareup.wire - -internal actual class GrpcResponse { - actual val body: GrpcResponseBody? - get() = TODO("Not yet implemented") - - actual fun header( - name: String, - defaultValue: String?, - ): String? { - TODO("Not yet implemented") - } - - actual fun trailers(): GrpcHeaders = TODO("Not yet implemented") - - actual fun close() { - TODO("Not yet implemented") - } -} diff --git a/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcResponseBody.kt b/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcResponseBody.kt deleted file mode 100644 index f46dc85c8b..0000000000 --- a/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/GrpcResponseBody.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2020 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 - * - * https://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.squareup.wire - -import okio.BufferedSource - -actual abstract class GrpcResponseBody { - actual abstract fun source(): BufferedSource -} diff --git a/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/internal/platform.kt b/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/internal/platform.kt deleted file mode 100644 index baf541f30c..0000000000 --- a/wire-grpc-client/src/nativeMain/kotlin/com/squareup/wire/internal/platform.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2020 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 - * - * https://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.squareup.wire.internal - -import com.squareup.wire.GrpcResponse -import okio.Sink -import okio.Source - -internal actual interface Call { - actual fun cancel() - actual fun execute(): GrpcResponse -} - -internal actual fun Sink.asGzip(): Sink = throw UnsupportedOperationException("Gzip not implemented for native") - -internal actual fun Source.asGzip(): Source = throw UnsupportedOperationException("Gzip not implemented for native") - -internal actual fun Throwable.addSuppressed(other: Throwable) { -} diff --git a/wire-grpc-client/src/jsMain/kotlin/com/squareup/wire/GrpcClient.kt b/wire-grpc-client/src/nonJvmMain/kotlin/com/squareup/wire/GrpcClient.kt similarity index 100% rename from wire-grpc-client/src/jsMain/kotlin/com/squareup/wire/GrpcClient.kt rename to wire-grpc-client/src/nonJvmMain/kotlin/com/squareup/wire/GrpcClient.kt diff --git a/wire-grpc-client/src/jsMain/kotlin/com/squareup/wire/GrpcHeaders.kt b/wire-grpc-client/src/nonJvmMain/kotlin/com/squareup/wire/GrpcHeaders.kt similarity index 100% rename from wire-grpc-client/src/jsMain/kotlin/com/squareup/wire/GrpcHeaders.kt rename to wire-grpc-client/src/nonJvmMain/kotlin/com/squareup/wire/GrpcHeaders.kt diff --git a/wire-grpc-client/src/jsMain/kotlin/com/squareup/wire/GrpcHttpUrl.kt b/wire-grpc-client/src/nonJvmMain/kotlin/com/squareup/wire/GrpcHttpUrl.kt similarity index 100% rename from wire-grpc-client/src/jsMain/kotlin/com/squareup/wire/GrpcHttpUrl.kt rename to wire-grpc-client/src/nonJvmMain/kotlin/com/squareup/wire/GrpcHttpUrl.kt diff --git a/wire-grpc-client/src/jsMain/kotlin/com/squareup/wire/GrpcRequest.kt b/wire-grpc-client/src/nonJvmMain/kotlin/com/squareup/wire/GrpcRequest.kt similarity index 100% rename from wire-grpc-client/src/jsMain/kotlin/com/squareup/wire/GrpcRequest.kt rename to wire-grpc-client/src/nonJvmMain/kotlin/com/squareup/wire/GrpcRequest.kt diff --git a/wire-grpc-client/src/jsMain/kotlin/com/squareup/wire/GrpcRequestBody.kt b/wire-grpc-client/src/nonJvmMain/kotlin/com/squareup/wire/GrpcRequestBody.kt similarity index 100% rename from wire-grpc-client/src/jsMain/kotlin/com/squareup/wire/GrpcRequestBody.kt rename to wire-grpc-client/src/nonJvmMain/kotlin/com/squareup/wire/GrpcRequestBody.kt diff --git a/wire-grpc-client/src/jsMain/kotlin/com/squareup/wire/GrpcResponse.kt b/wire-grpc-client/src/nonJvmMain/kotlin/com/squareup/wire/GrpcResponse.kt similarity index 100% rename from wire-grpc-client/src/jsMain/kotlin/com/squareup/wire/GrpcResponse.kt rename to wire-grpc-client/src/nonJvmMain/kotlin/com/squareup/wire/GrpcResponse.kt diff --git a/wire-grpc-client/src/jsMain/kotlin/com/squareup/wire/GrpcResponseBody.kt b/wire-grpc-client/src/nonJvmMain/kotlin/com/squareup/wire/GrpcResponseBody.kt similarity index 100% rename from wire-grpc-client/src/jsMain/kotlin/com/squareup/wire/GrpcResponseBody.kt rename to wire-grpc-client/src/nonJvmMain/kotlin/com/squareup/wire/GrpcResponseBody.kt diff --git a/wire-grpc-client/src/jsMain/kotlin/com/squareup/wire/internal/platform.kt b/wire-grpc-client/src/nonJvmMain/kotlin/com/squareup/wire/internal/platform.kt similarity index 89% rename from wire-grpc-client/src/jsMain/kotlin/com/squareup/wire/internal/platform.kt rename to wire-grpc-client/src/nonJvmMain/kotlin/com/squareup/wire/internal/platform.kt index 287c698521..a07fd13153 100644 --- a/wire-grpc-client/src/jsMain/kotlin/com/squareup/wire/internal/platform.kt +++ b/wire-grpc-client/src/nonJvmMain/kotlin/com/squareup/wire/internal/platform.kt @@ -24,9 +24,9 @@ internal actual interface Call { actual fun execute(): GrpcResponse } -internal actual fun Sink.asGzip(): Sink = throw UnsupportedOperationException("Gzip not implemented for JS") +internal actual fun Sink.asGzip(): Sink = throw UnsupportedOperationException("Gzip not implemented for this platform") -internal actual fun Source.asGzip(): Source = throw UnsupportedOperationException("Gzip not implemented for JS") +internal actual fun Source.asGzip(): Source = throw UnsupportedOperationException("Gzip not implemented for this platform") internal actual fun Throwable.addSuppressed(other: Throwable) { } diff --git a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcClient.kt b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcClient.kt deleted file mode 100644 index bc41e15e54..0000000000 --- a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcClient.kt +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2020 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 - * - * https://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.squareup.wire - -actual abstract class GrpcClient { - actual abstract fun newCall(method: GrpcMethod): GrpcCall - actual abstract fun newStreamingCall(method: GrpcMethod): GrpcStreamingCall - actual abstract fun newClientStreamingCall(method: GrpcMethod): GrpcClientStreamingCall - actual abstract fun newServerStreamingCall(method: GrpcMethod): GrpcServerStreamingCall -} diff --git a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcHeaders.kt b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcHeaders.kt deleted file mode 100644 index b31a389465..0000000000 --- a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcHeaders.kt +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2020 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 - * - * https://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.squareup.wire - -actual class GrpcHeaders { - actual operator fun get(name: String): String? = TODO() -} diff --git a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcHttpUrl.kt b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcHttpUrl.kt deleted file mode 100644 index 69714cbf4d..0000000000 --- a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcHttpUrl.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2020 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 - * - * https://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.squareup.wire - -actual class GrpcHttpUrl { - actual fun resolve(link: String): GrpcHttpUrl? = TODO("Not yet implemented") -} - -actual fun String.toHttpUrl(): GrpcHttpUrl = TODO("Not yet implemented") diff --git a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcRequest.kt b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcRequest.kt deleted file mode 100644 index fba5417072..0000000000 --- a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcRequest.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2020 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 - * - * https://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.squareup.wire - -actual class GrpcRequest - -actual open class GrpcRequestBuilder { - actual open fun url(url: GrpcHttpUrl): GrpcRequestBuilder = TODO("Not yet implemented") - actual open fun addHeader( - name: String, - value: String, - ): GrpcRequestBuilder = TODO("Not yet implemented") - actual open fun method( - method: String, - body: GrpcRequestBody?, - ): GrpcRequestBuilder = TODO("Not yet implemented") - actual open fun build(): GrpcRequest = TODO("Not yet implemented") -} diff --git a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcRequestBody.kt b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcRequestBody.kt deleted file mode 100644 index 64a54e1288..0000000000 --- a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcRequestBody.kt +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (C) 2020 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 - * - * https://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.squareup.wire - -actual abstract class GrpcRequestBody diff --git a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcResponse.kt b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcResponse.kt deleted file mode 100644 index 97da212f6c..0000000000 --- a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcResponse.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2020 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 - * - * https://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.squareup.wire - -internal actual class GrpcResponse { - actual val body: GrpcResponseBody? - get() = TODO("Not yet implemented") - - actual fun header( - name: String, - defaultValue: String?, - ): String? { - TODO("Not yet implemented") - } - - actual fun trailers(): GrpcHeaders = TODO("Not yet implemented") - - actual fun close() { - TODO("Not yet implemented") - } -} diff --git a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcResponseBody.kt b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcResponseBody.kt deleted file mode 100644 index f46dc85c8b..0000000000 --- a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/GrpcResponseBody.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2020 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 - * - * https://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.squareup.wire - -import okio.BufferedSource - -actual abstract class GrpcResponseBody { - actual abstract fun source(): BufferedSource -} diff --git a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/internal/platform.kt b/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/internal/platform.kt deleted file mode 100644 index 9b96271be2..0000000000 --- a/wire-grpc-client/src/wasmWasiMain/kotlin/com/squareup/wire/internal/platform.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2020 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 - * - * https://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.squareup.wire.internal - -import com.squareup.wire.GrpcResponse -import okio.Sink -import okio.Source - -internal actual interface Call { - actual fun cancel() - actual fun execute(): GrpcResponse -} - -internal actual fun Sink.asGzip(): Sink = throw UnsupportedOperationException("Gzip not implemented for wasmWasi") - -internal actual fun Source.asGzip(): Source = throw UnsupportedOperationException("Gzip not implemented for wasmWasi") - -internal actual fun Throwable.addSuppressed(other: Throwable) { -}