Changelog History
Page 5
-
v3.0.0-rc02 Changes
October 02, 20192019-10-01
Kotlin
- Fix: Nullify other oneof fields in Builder setters in Kotlin interop.
- Fix: Use unknownFields in
hashCode()
. - Fix: Remove
withoutUnknownFields()
from Kotlin.
gRPC
- Update: Total rewrite of the generated interfaces for clients:
Introduce two interfaces,
GrpcCall
for simple RPCs, andGrpcStreamingCall
fox duplex ones. Both will provide blocking and suspending API, including a reference to the underlying OkHttp Call object and its timeout.- Fix: Send stream cancels from clients.
Misc
- New: Changes printing of options and enums:
- No empty lines between options and fields for enums.
- Print options on new lines only when more than one.
- Fix: Don't cache Message's hash code on Native.
- Fix: Fix handling of map values in
FieldBinding
. - Fix: Fix import fails on windows due to path separator.
- Fix: Don't emit proto2 sources for proto3 syntax.
-
v3.0.0-rc01 Changes
August 02, 20192019-08-02
๐ Compiler + Gradle plugin
- New: Support includes on Maven coordinate dependencies.
- New: Track includes separately for source vs proto paths.
- New: Follow symlinks when building.
- New: Change the Gradle plugin to track targets as a list.
- New: Includes and Excludes for Wire targets.
- New: Print errors on ambiguous and missing imports.
- Fix: Fix a bug where protopath Maven resources weren't working.
- Fix: Don't reuse source dependencies as protopath dependencies.
- Fix: Fix
equals()
implementation for messages with no fields.
Kotlin
- New: Move Wire.kt into
jvmMain
to discourage its use in common Kotlin code. - New: Make
Message.adapter
aval
. - New: Optimize
decode()
code for protos with no fields. - New: Update supported Native platforms.
- New: Make
Message.unknownFields
property non-nullable. - New: Make
Message.unknownFields
aval
. - Fix: Don't use
KClass.simpleName
to avoid needingkotlin-reflect
dependency. - Fix: Use
kotlin.UnsupportedOperationException
in generated code.
gRPC
- New: Introduce
MessageSource
andMessageSink
interfaces inwire-runtime
. - New: Honor Java package names in Wire gRPC services.
- New: Make
PipeDuplexRequestBody
internal. - Fix: Workaround for
@Generated
annotation on Java 9+. - Fix: Fix types for blocking APIs.
Misc
- Fix: Fix deserializing null values in Gson adapter.
- Fix: Change
wire-runtime
artifact names to preserve 2.x compatibility.
-
v3.0.0-alpha03 Changes
June 22, 20192019-06-22
- Similar to alpha02, but with proper
wire-runtime
multiplatform artifacts.
- Similar to alpha02, but with proper
-
v3.0.0-alpha02 Changes
June 22, 20192019-06-21
- New: Experimental multiplatform runtime.
Starting with this version,
wire-runtime
is published as a multiplatform Kotlin artifact. While the JVM artifact is binary- and behavior-compatible with 3.0.0-alpha01, artifacts for other platforms may not work correctly at this point. The artifact name for the JVM artifact has been changed towire-runtime-jvm
: now, in order to depend on the multiplatform runtime, use the following Gradle dependency declaration:api "com.squareup.wire:wire-runtime:3.0.0-alpha02"
and if you want to depend on the JVM artifact only, use the following declaration:
api "com.squareup.wire:wire-runtime-jvm:3.0.0-alpha02"
- New: Generate RPCs as Single Abstract Methods.
- New: Add "singleMethod" Gradle plugin configuration for services.
- New: Add "blockingServices" Gradle plugin configuration for services.
- New: Support packageless services code generation.
- New: Remove sealed classes-based oneof implementation.
- New: Don't generate a Builder for non-interop Kotlin messages.
- Fix: Kotlin Generator correctly generates code for Protobuf services.
- Fix: Improved formatting of generated Kotlin code.
- Fix: Generate correct adapter names for WireField annotation.
- Fix: Generate labels for WireField annotation.
- Fix: Wrap oneof error message properly.
-
v3.0.0-alpha01 Changes
March 14, 20192019-03-14
- New: Kotlin Generator
Wire 3 can generate Kotlin data classes. To enable this feature via the command line API, pass in the
--kotlin_out
parameter that should specify the output directory for the generated*.kt
files.Given the following simple proto:
message Person { required string name = 1; required int32 id = 2; optional string email = 3; }
the generated Kotlin code will look like the following:
data class Person( @field:WireField(tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING") val name: String, @field:WireField(tag = 2, adapter = "com.squareup.wire.ProtoAdapter#INT32") val id: Int, @field:WireField(tag = 3, adapter = "com.squareup.wire.ProtoAdapter#STRING") val email: String? = null, val unknownFields: ByteString = ByteString.EMPTY ) : Message<Person, Person.Builder>(ADAPTER, unknownFields) { companion object { @JvmField val ADAPTER: ProtoAdapter<Person> = ... // code omitted for brevity
The
copy()
method of a data class replaces most usages of the builder. If your code relies on theBuilder
, you can enable fullBuilder
generation by passing the--java_interop
parameter to the compiler.- New: gRPC support
In addition to generating Kotlin code from proto messages, Wire can now generate code for gRPC endpoints. Here's an example schema:
service RouteGuide { // A simple RPC. // // Obtains the feature at a given position. // // A feature with an empty name is returned if there's no feature at the given // position. rpc GetFeature(Point) returns (Feature) {} }
The generated code will look like the following (message protos, referenced by the schema, are omitted):
interface RouteGuide : Service { @WireRpc( path = "/routeguide.RouteGuide/GetFeature", requestAdapter = "routeguide.Point#ADAPTER", responseAdapter = "routeguide.Feature#ADAPTER" ) suspend fun GetFeature(request: Point): Feature }
All four gRPC modes are supported: the generated code uses suspendable functions to implement non-blocking asynchronous execution. In streaming modes,
ReceiveChannel
andSendChannel
are used to listen to asynchronous data in a non-blocking fashion.This feature works out of the box in Wire 3 compiler as long as the input file contains a gRPC schema.
- New: Gradle plugin
Here's an example Gradle configuration:
apply plugin: 'com.squareup.wire' wire { // Keeps only 'Dinosaur#name' as the root of the object graph roots 'squareup.dinosaurs.Dinosaur#name' // Keeps all fields, except 'name', in 'Dinosaur' prunes 'squareup.dinosaurs.Dinosaur#name' // Both roots and prunes in an external file rules 'rules.txt' kotlin { javaInterop true out "${buildDir}/generated/custom" } }
The
wire
extension introduces the concept of compilation targets, such askotlin
andjava
, where each target has its own configuration properties. Multiple targets can be supplied, which benefits use cases such as migrating Java protos to Kotlin.- New: Decouple the option of using Android annotations for nullability from the option of having messages implement Parcelable.
- New: Wire Moshi adapter for serializing proto JSON representation using the Moshi library.
- New: Implement support for custom enum types.
- New: Generate AndroidX nullability annotations instead of old support library annotations.
- New: Import JSR 305 and use it to mark nullability of public API.
- New: Allow inline multiline comments.
- New: Generate an empty class when a nested message is retained but its parent was pruned.
- New: Support rendering a
ProtoFile
to its schema. - New: Support hexadecimal numeric literals.
- New: Allow custom types to be constrained with a 'with' clause.
- New: Generate a constructor which takes in a
Message.Builder
instead of all fields separately. - New: Add location to the error message about unsupported group elements.
- New: Permit single files to be used on the proto path.
- Fix: Emit '=' for syntax declaration.
- Fix: Don't crash when a comment has a dollar sign.
- Fix: Return subclass type instead of abstract parameterized type for newBuilder.
- Fix: Validate enum namespace in file context are unique.
-
v2.3.0 Changes
April 10, 20172017-04-10
-
v2.3.0-RC1 Changes
April 10, 20172017-04-10
-
v2.2.0 Changes
June 14, 20162016-06-17
- New: Support for
map
type in the schema, compiler, and runtime! - New:
AndroidMessage
base class consolidates everything required for supporting Android and will now be used for generating code with--android
. - New:
stream
keyword in RPC definitions is now parsed and exposed in the schema. - Fix: Nested types which are retained no longer cause their enclosing type to be retained. Instead, non-instantiable empty types will be generated for pruned enclosing types.
- Fix: Remove per-type
Parcelable.Creator
classes and instead use a single type which delegates to the message'sProtoAdapter
. - Fix: Retain information on redacted fields even when options were pruned.
- Fix: Do not generate code for handling
null
from list types (and now map types) which are guaranteed to never benull
.
- New: Support for
-
v2.1.2 Changes
April 16, 20162016-04-15
- Fix: Gson type adapter now deserializes JSON null literals to empty list for repeated fields.
-
v2.1.1 Changes
February 01, 20162016-02-01
- New:
reserved
keyword is now supported and enforced. - Fix: Defer reflection-based lookup of enum method until first use to avoid class loading race conditions.
- Fix: Support single-quoted string literals.
- Fix: Adjacent string literals are not correctly concatenated.
- New: