See the project website for documentation and APIs.
Wire is the best solution to manage your protobuf schemas!
This fork is based on the wire_5.x branch and publishes artifacts under the
io.github.wangbax namespace.
It is being adapted to work with a source-level shaded Okio fork so
applications that still depend on okio 1.x can use Wire without depending on
the original okio 3.x package name at runtime.
- Wire depends on
io.github.wangbax:okioand generated code targetscom.squareup.wire.shaded.okio.*. - gRPC API surface used by code generation is split into
wire-grpc-apiso codegen is less tightly coupled to the OkHttp-backedwire-grpc-clientimplementation. - Generated code can target the relocated package with the CLI flag
--okio_package=com.squareup.wire.shaded.okio. - The Gradle plugin exposes the same setting via
okioPackage = "com.squareup.wire.shaded.okio". - For client-side usage, the current integration focuses on
wire-runtime,wire-gson-support, andwire-moshi-adapter. wire-grpc-clientis not part of the current integration yet because OkHttp's public JVM APIs still expose originalokio.*types.- Most application consumers do not need to depend on
wire-grpc-apidirectly; it is primarily an internal split to support generators and build tooling.
This fork is currently published as 5.5.1-okio-fork-1.
If your client only uses Wire-generated Message types and protobuf
encoding/decoding, wire-runtime is enough.
If you also need Moshi or Gson adapters, add the corresponding adapter module.
Gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("io.github.wangbax:wire-gradle-plugin:5.5.1-okio-fork-1")
}
}
apply(plugin = "com.squareup.wire")
dependencies {
implementation("io.github.wangbax:wire-runtime:5.5.1-okio-fork-1")
// Optional JSON adapters.
// implementation("io.github.wangbax:wire-gson-support:5.5.1-okio-fork-1")
// implementation("io.github.wangbax:wire-moshi-adapter:5.5.1-okio-fork-1")
}
wire {
kotlin {
okioPackage = "com.squareup.wire.shaded.okio"
}
}wire-grpc-client is intentionally not published in this fork yet. If your
client only needs protobuf model generation, protobuf encoding/decoding, or
JSON adapters, you do not need it.
CLI
wire-compiler \
--proto_path=src/main/proto \
--kotlin_out=build/generated/source/wire \
--okio_package=com.squareup.wire.shaded.okio \
path/to/your.protoAfter regeneration, the generated models will import
com.squareup.wire.shaded.okio.ByteString, so they can run alongside
applications that still depend on okio 1.x.
Copyright 2013 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.