Bump packaged Protobuf to 3.11.2 (#263)
The new conformance test cases caught some edge case bugs related to decoding messages with repeated instances of scalar strings, bytes, and oneofs.
This commit is contained in:
parent
7e0070f140
commit
59c11cab04
17
.travis.yml
17
.travis.yml
@ -1,13 +1,6 @@
|
||||
language: rust
|
||||
dist: xenial
|
||||
|
||||
# Even though this build script doesn't use sudo, we enable it in order to get
|
||||
# more memory. Previously on the container infrastructure the OOM killer would
|
||||
# come in and kill either the GCC processes compiling protobuf, or rustc. See
|
||||
# https://github.com/travis-ci/travis-ci/issues/7427 for the source of this
|
||||
# workaround.
|
||||
sudo: required
|
||||
|
||||
cache: cargo
|
||||
|
||||
os:
|
||||
@ -24,3 +17,13 @@ script:
|
||||
- if [[ $TRAVIS_RUST_VERSION = nightly* ]]; then
|
||||
cargo bench --verbose --no-run;
|
||||
fi
|
||||
|
||||
addons:
|
||||
homebrew:
|
||||
packages:
|
||||
- cmake
|
||||
- ninja
|
||||
apt:
|
||||
packages:
|
||||
- cmake
|
||||
- ninja-build
|
||||
|
||||
11
prost-build/third-party/protobuf/README.md
vendored
11
prost-build/third-party/protobuf/README.md
vendored
@ -1,11 +0,0 @@
|
||||
`LICENSE` was taken from https://github.com/google/protobuf/archive/v3.7.1.zip.
|
||||
|
||||
The `protoc-*` and `protoc-*.exe` binaries here were taken from:
|
||||
|
||||
* https://github.com/google/protobuf/releases/download/v3.7.1/protoc-3.7.1-linux-aarch_64.zip
|
||||
* https://github.com/google/protobuf/releases/download/v3.7.1/protoc-3.7.1-linux-x86_32.zip
|
||||
* https://github.com/google/protobuf/releases/download/v3.7.1/protoc-3.7.1-linux-x86_64.zip
|
||||
* https://github.com/google/protobuf/releases/download/v3.7.1/protoc-3.7.1-osx-x86_64.zip
|
||||
* https://github.com/google/protobuf/releases/download/v3.7.1/protoc-3.7.1-win32.zip
|
||||
|
||||
The `include` directory's contents were taken from the linux-x86_64 package.
|
||||
@ -45,6 +45,7 @@
|
||||
// flag "--${NAME}_out" is passed to protoc.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package google.protobuf.compiler;
|
||||
option java_package = "com.google.protobuf.compiler";
|
||||
option java_outer_classname = "PluginProtos";
|
||||
|
||||
@ -40,6 +40,7 @@
|
||||
syntax = "proto2";
|
||||
|
||||
package google.protobuf;
|
||||
|
||||
option go_package = "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor";
|
||||
option java_package = "com.google.protobuf";
|
||||
option java_outer_classname = "DescriptorProtos";
|
||||
@ -59,8 +60,8 @@ message FileDescriptorSet {
|
||||
|
||||
// Describes a complete .proto file.
|
||||
message FileDescriptorProto {
|
||||
optional string name = 1; // file name, relative to root of source tree
|
||||
optional string package = 2; // e.g. "foo", "foo.bar", etc.
|
||||
optional string name = 1; // file name, relative to root of source tree
|
||||
optional string package = 2; // e.g. "foo", "foo.bar", etc.
|
||||
|
||||
// Names of files imported by this file.
|
||||
repeated string dependency = 3;
|
||||
@ -100,8 +101,8 @@ message DescriptorProto {
|
||||
repeated EnumDescriptorProto enum_type = 4;
|
||||
|
||||
message ExtensionRange {
|
||||
optional int32 start = 1;
|
||||
optional int32 end = 2;
|
||||
optional int32 start = 1; // Inclusive.
|
||||
optional int32 end = 2; // Exclusive.
|
||||
|
||||
optional ExtensionRangeOptions options = 3;
|
||||
}
|
||||
@ -115,8 +116,8 @@ message DescriptorProto {
|
||||
// fields or extension ranges in the same message. Reserved ranges may
|
||||
// not overlap.
|
||||
message ReservedRange {
|
||||
optional int32 start = 1; // Inclusive.
|
||||
optional int32 end = 2; // Exclusive.
|
||||
optional int32 start = 1; // Inclusive.
|
||||
optional int32 end = 2; // Exclusive.
|
||||
}
|
||||
repeated ReservedRange reserved_range = 9;
|
||||
// Reserved field names, which may not be used by fields in the same message.
|
||||
@ -137,42 +138,42 @@ message FieldDescriptorProto {
|
||||
enum Type {
|
||||
// 0 is reserved for errors.
|
||||
// Order is weird for historical reasons.
|
||||
TYPE_DOUBLE = 1;
|
||||
TYPE_FLOAT = 2;
|
||||
TYPE_DOUBLE = 1;
|
||||
TYPE_FLOAT = 2;
|
||||
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
|
||||
// negative values are likely.
|
||||
TYPE_INT64 = 3;
|
||||
TYPE_UINT64 = 4;
|
||||
TYPE_INT64 = 3;
|
||||
TYPE_UINT64 = 4;
|
||||
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
|
||||
// negative values are likely.
|
||||
TYPE_INT32 = 5;
|
||||
TYPE_FIXED64 = 6;
|
||||
TYPE_FIXED32 = 7;
|
||||
TYPE_BOOL = 8;
|
||||
TYPE_STRING = 9;
|
||||
TYPE_INT32 = 5;
|
||||
TYPE_FIXED64 = 6;
|
||||
TYPE_FIXED32 = 7;
|
||||
TYPE_BOOL = 8;
|
||||
TYPE_STRING = 9;
|
||||
// Tag-delimited aggregate.
|
||||
// Group type is deprecated and not supported in proto3. However, Proto3
|
||||
// implementations should still be able to parse the group wire format and
|
||||
// treat group fields as unknown fields.
|
||||
TYPE_GROUP = 10;
|
||||
TYPE_MESSAGE = 11; // Length-delimited aggregate.
|
||||
TYPE_GROUP = 10;
|
||||
TYPE_MESSAGE = 11; // Length-delimited aggregate.
|
||||
|
||||
// New in version 2.
|
||||
TYPE_BYTES = 12;
|
||||
TYPE_UINT32 = 13;
|
||||
TYPE_ENUM = 14;
|
||||
TYPE_SFIXED32 = 15;
|
||||
TYPE_SFIXED64 = 16;
|
||||
TYPE_SINT32 = 17; // Uses ZigZag encoding.
|
||||
TYPE_SINT64 = 18; // Uses ZigZag encoding.
|
||||
};
|
||||
TYPE_BYTES = 12;
|
||||
TYPE_UINT32 = 13;
|
||||
TYPE_ENUM = 14;
|
||||
TYPE_SFIXED32 = 15;
|
||||
TYPE_SFIXED64 = 16;
|
||||
TYPE_SINT32 = 17; // Uses ZigZag encoding.
|
||||
TYPE_SINT64 = 18; // Uses ZigZag encoding.
|
||||
}
|
||||
|
||||
enum Label {
|
||||
// 0 is reserved for errors
|
||||
LABEL_OPTIONAL = 1;
|
||||
LABEL_REQUIRED = 2;
|
||||
LABEL_REPEATED = 3;
|
||||
};
|
||||
LABEL_OPTIONAL = 1;
|
||||
LABEL_REQUIRED = 2;
|
||||
LABEL_REPEATED = 3;
|
||||
}
|
||||
|
||||
optional string name = 1;
|
||||
optional int32 number = 3;
|
||||
@ -234,8 +235,8 @@ message EnumDescriptorProto {
|
||||
// is inclusive such that it can appropriately represent the entire int32
|
||||
// domain.
|
||||
message EnumReservedRange {
|
||||
optional int32 start = 1; // Inclusive.
|
||||
optional int32 end = 2; // Inclusive.
|
||||
optional int32 start = 1; // Inclusive.
|
||||
optional int32 end = 2; // Inclusive.
|
||||
}
|
||||
|
||||
// Range of reserved numeric values. Reserved numeric values may not be used
|
||||
@ -276,9 +277,9 @@ message MethodDescriptorProto {
|
||||
optional MethodOptions options = 4;
|
||||
|
||||
// Identifies if client streams multiple client messages
|
||||
optional bool client_streaming = 5 [default=false];
|
||||
optional bool client_streaming = 5 [default = false];
|
||||
// Identifies if server streams multiple server messages
|
||||
optional bool server_streaming = 6 [default=false];
|
||||
optional bool server_streaming = 6 [default = false];
|
||||
}
|
||||
|
||||
|
||||
@ -314,7 +315,6 @@ message MethodDescriptorProto {
|
||||
// If this turns out to be popular, a web service will be set up
|
||||
// to automatically assign option numbers.
|
||||
|
||||
|
||||
message FileOptions {
|
||||
|
||||
// Sets the Java package where classes generated from this .proto will be
|
||||
@ -337,7 +337,7 @@ message FileOptions {
|
||||
// named by java_outer_classname. However, the outer class will still be
|
||||
// generated to contain the file's getDescriptor() method as well as any
|
||||
// top-level extensions defined in the file.
|
||||
optional bool java_multiple_files = 10 [default=false];
|
||||
optional bool java_multiple_files = 10 [default = false];
|
||||
|
||||
// This option does nothing.
|
||||
optional bool java_generate_equals_and_hash = 20 [deprecated=true];
|
||||
@ -348,17 +348,17 @@ message FileOptions {
|
||||
// Message reflection will do the same.
|
||||
// However, an extension field still accepts non-UTF-8 byte sequences.
|
||||
// This option has no effect on when used with the lite runtime.
|
||||
optional bool java_string_check_utf8 = 27 [default=false];
|
||||
optional bool java_string_check_utf8 = 27 [default = false];
|
||||
|
||||
|
||||
// Generated classes can be optimized for speed or code size.
|
||||
enum OptimizeMode {
|
||||
SPEED = 1; // Generate complete code for parsing, serialization,
|
||||
// etc.
|
||||
CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
|
||||
LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
|
||||
SPEED = 1; // Generate complete code for parsing, serialization,
|
||||
// etc.
|
||||
CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
|
||||
LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
|
||||
}
|
||||
optional OptimizeMode optimize_for = 9 [default=SPEED];
|
||||
optional OptimizeMode optimize_for = 9 [default = SPEED];
|
||||
|
||||
// Sets the Go package where structs generated from this .proto will be
|
||||
// placed. If omitted, the Go package will be derived from the following:
|
||||
@ -369,6 +369,7 @@ message FileOptions {
|
||||
|
||||
|
||||
|
||||
|
||||
// Should generic services be generated in each language? "Generic" services
|
||||
// are not specific to any particular RPC system. They are generated by the
|
||||
// main code generators in each language (without additional plugins).
|
||||
@ -379,20 +380,20 @@ message FileOptions {
|
||||
// that generate code specific to your particular RPC system. Therefore,
|
||||
// these default to false. Old code which depends on generic services should
|
||||
// explicitly set them to true.
|
||||
optional bool cc_generic_services = 16 [default=false];
|
||||
optional bool java_generic_services = 17 [default=false];
|
||||
optional bool py_generic_services = 18 [default=false];
|
||||
optional bool php_generic_services = 42 [default=false];
|
||||
optional bool cc_generic_services = 16 [default = false];
|
||||
optional bool java_generic_services = 17 [default = false];
|
||||
optional bool py_generic_services = 18 [default = false];
|
||||
optional bool php_generic_services = 42 [default = false];
|
||||
|
||||
// Is this file deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for everything in the file, or it will be completely ignored; in the very
|
||||
// least, this is a formalization for deprecating files.
|
||||
optional bool deprecated = 23 [default=false];
|
||||
optional bool deprecated = 23 [default = false];
|
||||
|
||||
// Enables the use of arenas for the proto messages in this file. This applies
|
||||
// only to generated classes for C++.
|
||||
optional bool cc_enable_arenas = 31 [default=false];
|
||||
optional bool cc_enable_arenas = 31 [default = false];
|
||||
|
||||
|
||||
// Sets the objective c class prefix which is prepended to all objective c
|
||||
@ -417,10 +418,9 @@ message FileOptions {
|
||||
// determining the namespace.
|
||||
optional string php_namespace = 41;
|
||||
|
||||
|
||||
// Use this option to change the namespace of php generated metadata classes.
|
||||
// Default is empty. When this option is empty, the proto file name will be used
|
||||
// for determining the namespace.
|
||||
// Default is empty. When this option is empty, the proto file name will be
|
||||
// used for determining the namespace.
|
||||
optional string php_metadata_namespace = 44;
|
||||
|
||||
// Use this option to change the package of ruby generated classes. Default
|
||||
@ -428,6 +428,7 @@ message FileOptions {
|
||||
// determining the ruby package.
|
||||
optional string ruby_package = 45;
|
||||
|
||||
|
||||
// The parser stores options it doesn't recognize here.
|
||||
// See the documentation for the "Options" section above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
@ -458,18 +459,18 @@ message MessageOptions {
|
||||
//
|
||||
// Because this is an option, the above two restrictions are not enforced by
|
||||
// the protocol compiler.
|
||||
optional bool message_set_wire_format = 1 [default=false];
|
||||
optional bool message_set_wire_format = 1 [default = false];
|
||||
|
||||
// Disables the generation of the standard "descriptor()" accessor, which can
|
||||
// conflict with a field of the same name. This is meant to make migration
|
||||
// from proto1 easier; new code should avoid fields named "descriptor".
|
||||
optional bool no_standard_descriptor_accessor = 2 [default=false];
|
||||
optional bool no_standard_descriptor_accessor = 2 [default = false];
|
||||
|
||||
// Is this message deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for the message, or it will be completely ignored; in the very least,
|
||||
// this is a formalization for deprecating messages.
|
||||
optional bool deprecated = 3 [default=false];
|
||||
optional bool deprecated = 3 [default = false];
|
||||
|
||||
// Whether the message is an automatically generated map entry type for the
|
||||
// maps field.
|
||||
@ -486,7 +487,7 @@ message MessageOptions {
|
||||
//
|
||||
// Implementations may choose not to generate the map_entry=true message, but
|
||||
// use a native map in the target language to hold the keys and values.
|
||||
// The reflection APIs in such implementions still need to work as
|
||||
// The reflection APIs in such implementations still need to work as
|
||||
// if the field is a repeated message field.
|
||||
//
|
||||
// NOTE: Do not set the option in .proto files. Always use the maps syntax
|
||||
@ -497,6 +498,7 @@ message MessageOptions {
|
||||
reserved 8; // javalite_serializable
|
||||
reserved 9; // javanano_as_lite
|
||||
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
@ -576,16 +578,16 @@ message FieldOptions {
|
||||
// implementation must either *always* check its required fields, or *never*
|
||||
// check its required fields, regardless of whether or not the message has
|
||||
// been parsed.
|
||||
optional bool lazy = 5 [default=false];
|
||||
optional bool lazy = 5 [default = false];
|
||||
|
||||
// Is this field deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for accessors, or it will be completely ignored; in the very least, this
|
||||
// is a formalization for deprecating fields.
|
||||
optional bool deprecated = 3 [default=false];
|
||||
optional bool deprecated = 3 [default = false];
|
||||
|
||||
// For Google-internal migration only. Do not use.
|
||||
optional bool weak = 10 [default=false];
|
||||
optional bool weak = 10 [default = false];
|
||||
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
@ -615,7 +617,7 @@ message EnumOptions {
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for the enum, or it will be completely ignored; in the very least, this
|
||||
// is a formalization for deprecating enums.
|
||||
optional bool deprecated = 3 [default=false];
|
||||
optional bool deprecated = 3 [default = false];
|
||||
|
||||
reserved 5; // javanano_as_lite
|
||||
|
||||
@ -631,7 +633,7 @@ message EnumValueOptions {
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for the enum value, or it will be completely ignored; in the very least,
|
||||
// this is a formalization for deprecating enum values.
|
||||
optional bool deprecated = 1 [default=false];
|
||||
optional bool deprecated = 1 [default = false];
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
@ -651,7 +653,7 @@ message ServiceOptions {
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for the service, or it will be completely ignored; in the very least,
|
||||
// this is a formalization for deprecating services.
|
||||
optional bool deprecated = 33 [default=false];
|
||||
optional bool deprecated = 33 [default = false];
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
@ -671,18 +673,18 @@ message MethodOptions {
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for the method, or it will be completely ignored; in the very least,
|
||||
// this is a formalization for deprecating methods.
|
||||
optional bool deprecated = 33 [default=false];
|
||||
optional bool deprecated = 33 [default = false];
|
||||
|
||||
// Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
|
||||
// or neither? HTTP based RPC implementation may choose GET verb for safe
|
||||
// methods, and PUT verb for idempotent methods instead of the default POST.
|
||||
enum IdempotencyLevel {
|
||||
IDEMPOTENCY_UNKNOWN = 0;
|
||||
NO_SIDE_EFFECTS = 1; // implies idempotent
|
||||
IDEMPOTENT = 2; // idempotent, but may have side effects
|
||||
NO_SIDE_EFFECTS = 1; // implies idempotent
|
||||
IDEMPOTENT = 2; // idempotent, but may have side effects
|
||||
}
|
||||
optional IdempotencyLevel idempotency_level =
|
||||
34 [default=IDEMPOTENCY_UNKNOWN];
|
||||
optional IdempotencyLevel idempotency_level = 34
|
||||
[default = IDEMPOTENCY_UNKNOWN];
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
@ -763,7 +765,7 @@ message SourceCodeInfo {
|
||||
// beginning of the "extend" block and is shared by all extensions within
|
||||
// the block.
|
||||
// - Just because a location's span is a subset of some other location's span
|
||||
// does not mean that it is a descendent. For example, a "group" defines
|
||||
// does not mean that it is a descendant. For example, a "group" defines
|
||||
// both a type and a field in a single declaration. Thus, the locations
|
||||
// corresponding to the type and field and their components will overlap.
|
||||
// - Code which tries to interpret locations should probably be designed to
|
||||
@ -794,14 +796,14 @@ message SourceCodeInfo {
|
||||
// [ 4, 3, 2, 7 ]
|
||||
// this path refers to the whole field declaration (from the beginning
|
||||
// of the label to the terminating semicolon).
|
||||
repeated int32 path = 1 [packed=true];
|
||||
repeated int32 path = 1 [packed = true];
|
||||
|
||||
// Always has exactly three or four elements: start line, start column,
|
||||
// end line (optional, otherwise assumed same as start line), end column.
|
||||
// These are packed into a single field for efficiency. Note that line
|
||||
// and column numbers are zero-based -- typically you will want to add
|
||||
// 1 to each before displaying to a user.
|
||||
repeated int32 span = 2 [packed=true];
|
||||
repeated int32 span = 2 [packed = true];
|
||||
|
||||
// If this SourceCodeInfo represents a complete declaration, these are any
|
||||
// comments appearing before and after the declaration which appear to be
|
||||
@ -866,7 +868,7 @@ message GeneratedCodeInfo {
|
||||
message Annotation {
|
||||
// Identifies the element in the original source .proto file. This field
|
||||
// is formatted the same as SourceCodeInfo.Location.path.
|
||||
repeated int32 path = 1 [packed=true];
|
||||
repeated int32 path = 1 [packed = true];
|
||||
|
||||
// Identifies the filesystem path to the original source .proto.
|
||||
optional string source_file = 2;
|
||||
|
||||
@ -61,7 +61,7 @@ option objc_class_prefix = "GPB";
|
||||
// if (duration.seconds < 0 && duration.nanos > 0) {
|
||||
// duration.seconds += 1;
|
||||
// duration.nanos -= 1000000000;
|
||||
// } else if (durations.seconds > 0 && duration.nanos < 0) {
|
||||
// } else if (duration.seconds > 0 && duration.nanos < 0) {
|
||||
// duration.seconds -= 1;
|
||||
// duration.nanos += 1000000000;
|
||||
// }
|
||||
@ -101,7 +101,6 @@ option objc_class_prefix = "GPB";
|
||||
//
|
||||
//
|
||||
message Duration {
|
||||
|
||||
// Signed seconds of the span of time. Must be from -315,576,000,000
|
||||
// to +315,576,000,000 inclusive. Note: these bounds are computed from:
|
||||
// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
|
||||
|
||||
@ -238,7 +238,7 @@ option cc_enable_arenas = true;
|
||||
//
|
||||
// The implementation of any API method which has a FieldMask type field in the
|
||||
// request should verify the included field paths, and return an
|
||||
// `INVALID_ARGUMENT` error if any path is duplicated or unmappable.
|
||||
// `INVALID_ARGUMENT` error if any path is unmappable.
|
||||
message FieldMask {
|
||||
// The set of field mask paths.
|
||||
repeated string paths = 1;
|
||||
|
||||
@ -40,7 +40,6 @@ option java_outer_classname = "StructProto";
|
||||
option java_multiple_files = true;
|
||||
option objc_class_prefix = "GPB";
|
||||
|
||||
|
||||
// `Struct` represents a structured data value, consisting of fields
|
||||
// which map to dynamically typed values. In some languages, `Struct`
|
||||
// might be supported by a native representation. For example, in
|
||||
|
||||
@ -113,17 +113,18 @@ option objc_class_prefix = "GPB";
|
||||
// 01:30 UTC on January 15, 2017.
|
||||
//
|
||||
// In JavaScript, one can convert a Date object to this format using the
|
||||
// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
||||
// standard
|
||||
// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
||||
// method. In Python, a standard `datetime.datetime` object can be converted
|
||||
// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
|
||||
// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
|
||||
// can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
||||
// to this format using
|
||||
// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
||||
// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
||||
// the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
||||
// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
|
||||
// ) to obtain a formatter capable of generating timestamps in this format.
|
||||
//
|
||||
//
|
||||
message Timestamp {
|
||||
|
||||
// Represents seconds of UTC time since Unix epoch
|
||||
// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
||||
// 9999-12-31T23:59:59Z inclusive.
|
||||
|
||||
@ -64,44 +64,44 @@ message Field {
|
||||
// Basic field types.
|
||||
enum Kind {
|
||||
// Field type unknown.
|
||||
TYPE_UNKNOWN = 0;
|
||||
TYPE_UNKNOWN = 0;
|
||||
// Field type double.
|
||||
TYPE_DOUBLE = 1;
|
||||
TYPE_DOUBLE = 1;
|
||||
// Field type float.
|
||||
TYPE_FLOAT = 2;
|
||||
TYPE_FLOAT = 2;
|
||||
// Field type int64.
|
||||
TYPE_INT64 = 3;
|
||||
TYPE_INT64 = 3;
|
||||
// Field type uint64.
|
||||
TYPE_UINT64 = 4;
|
||||
TYPE_UINT64 = 4;
|
||||
// Field type int32.
|
||||
TYPE_INT32 = 5;
|
||||
TYPE_INT32 = 5;
|
||||
// Field type fixed64.
|
||||
TYPE_FIXED64 = 6;
|
||||
TYPE_FIXED64 = 6;
|
||||
// Field type fixed32.
|
||||
TYPE_FIXED32 = 7;
|
||||
TYPE_FIXED32 = 7;
|
||||
// Field type bool.
|
||||
TYPE_BOOL = 8;
|
||||
TYPE_BOOL = 8;
|
||||
// Field type string.
|
||||
TYPE_STRING = 9;
|
||||
TYPE_STRING = 9;
|
||||
// Field type group. Proto2 syntax only, and deprecated.
|
||||
TYPE_GROUP = 10;
|
||||
TYPE_GROUP = 10;
|
||||
// Field type message.
|
||||
TYPE_MESSAGE = 11;
|
||||
TYPE_MESSAGE = 11;
|
||||
// Field type bytes.
|
||||
TYPE_BYTES = 12;
|
||||
TYPE_BYTES = 12;
|
||||
// Field type uint32.
|
||||
TYPE_UINT32 = 13;
|
||||
TYPE_UINT32 = 13;
|
||||
// Field type enum.
|
||||
TYPE_ENUM = 14;
|
||||
TYPE_ENUM = 14;
|
||||
// Field type sfixed32.
|
||||
TYPE_SFIXED32 = 15;
|
||||
TYPE_SFIXED32 = 15;
|
||||
// Field type sfixed64.
|
||||
TYPE_SFIXED64 = 16;
|
||||
TYPE_SFIXED64 = 16;
|
||||
// Field type sint32.
|
||||
TYPE_SINT32 = 17;
|
||||
TYPE_SINT32 = 17;
|
||||
// Field type sint64.
|
||||
TYPE_SINT64 = 18;
|
||||
};
|
||||
TYPE_SINT64 = 18;
|
||||
}
|
||||
|
||||
// Whether a field is optional, required, or repeated.
|
||||
enum Cardinality {
|
||||
|
||||
Binary file not shown.
BIN
prost-build/third-party/protobuf/protoc-linux-x86_32
vendored
BIN
prost-build/third-party/protobuf/protoc-linux-x86_32
vendored
Binary file not shown.
BIN
prost-build/third-party/protobuf/protoc-linux-x86_64
vendored
BIN
prost-build/third-party/protobuf/protoc-linux-x86_64
vendored
Binary file not shown.
BIN
prost-build/third-party/protobuf/protoc-osx-x86_64
vendored
BIN
prost-build/third-party/protobuf/protoc-osx-x86_64
vendored
Binary file not shown.
BIN
prost-build/third-party/protobuf/protoc-win32.exe
vendored
BIN
prost-build/third-party/protobuf/protoc-win32.exe
vendored
Binary file not shown.
51
prost-build/third-party/update-bundled-protobuf.sh
vendored
Executable file
51
prost-build/third-party/update-bundled-protobuf.sh
vendored
Executable file
@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
if [ "$#" -ne 1 ]
|
||||
then
|
||||
echo "Usage: $0 <protobuf-version>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
VERSION="$1"
|
||||
TEMPDIR=$(mktemp -d "protobuf-$VERSION-XXX")
|
||||
ARCHS=( \
|
||||
"linux-aarch_64" \
|
||||
"linux-x86_32" \
|
||||
"linux-x86_64" \
|
||||
"osx-x86_64" \
|
||||
"win32" \
|
||||
)
|
||||
|
||||
for ARCH in "${ARCHS[@]}"; do
|
||||
mkdir "$TEMPDIR/$ARCH"
|
||||
curl --proto '=https' --tlsv1.2 -sSfL \
|
||||
"https://github.com/protocolbuffers/protobuf/releases/download/v$VERSION/protoc-$VERSION-$ARCH.zip" \
|
||||
-o "$TEMPDIR/$ARCH/protoc.zip"
|
||||
|
||||
EXTENSION=""
|
||||
if [[ "$ARCH" == *"win"* ]]; then
|
||||
EXTENSION=".exe"
|
||||
fi
|
||||
|
||||
unzip "$TEMPDIR/$ARCH/protoc.zip" -d "$TEMPDIR/$ARCH"
|
||||
mv "$TEMPDIR/$ARCH/bin/protoc$EXTENSION" "$DIR/protobuf/protoc-$ARCH$EXTENSION"
|
||||
done
|
||||
|
||||
|
||||
# Update the include directory
|
||||
rm -rf "$DIR/protobuf/include"
|
||||
mv "$TEMPDIR/linux-x86_64/include" "$DIR/protobuf/"
|
||||
|
||||
# Update the Protocol Buffers license.
|
||||
mkdir "$TEMPDIR/src"
|
||||
curl --proto '=https' --tlsv1.2 -sSfL \
|
||||
"https://github.com/protocolbuffers/protobuf/archive/v$VERSION.zip" \
|
||||
https://github.com/protocolbuffers/protobuf/archive/v3.11.2.zip
|
||||
-o "$TEMPDIR/src/protobuf.zip"
|
||||
unzip "$TEMPDIR/src/protobuf.zip" -d "$TEMPDIR/src"
|
||||
mv "$TEMPDIR/src/license.txt" "$DIR/protobuf/license"
|
||||
|
||||
rm -rf $TEMPDIR
|
||||
@ -101,10 +101,10 @@ impl Field {
|
||||
)
|
||||
},
|
||||
Label::Required => quote! {
|
||||
::prost::encoding::group::merge(tag, wire_type, &mut #ident, buf, ctx)
|
||||
::prost::encoding::group::merge(tag, wire_type, #ident, buf, ctx)
|
||||
},
|
||||
Label::Repeated => quote! {
|
||||
::prost::encoding::group::merge_repeated(tag, wire_type, &mut #ident, buf, ctx)
|
||||
::prost::encoding::group::merge_repeated(tag, wire_type, #ident, buf, ctx)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,10 +101,10 @@ impl Field {
|
||||
ctx)
|
||||
},
|
||||
Label::Required => quote! {
|
||||
::prost::encoding::message::merge(wire_type, &mut #ident, buf, ctx)
|
||||
::prost::encoding::message::merge(wire_type, #ident, buf, ctx)
|
||||
},
|
||||
Label::Repeated => quote! {
|
||||
::prost::encoding::message::merge_repeated(wire_type, &mut #ident, buf, ctx)
|
||||
::prost::encoding::message::merge_repeated(wire_type, #ident, buf, ctx)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ impl Field {
|
||||
pub fn merge(&self, ident: TokenStream) -> TokenStream {
|
||||
let ty = &self.ty;
|
||||
quote! {
|
||||
#ty::merge(&mut #ident, tag, wire_type, buf, ctx)
|
||||
#ty::merge(#ident, tag, wire_type, buf, ctx)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -153,7 +153,7 @@ impl Field {
|
||||
|
||||
match self.kind {
|
||||
Kind::Plain(..) | Kind::Required(..) | Kind::Repeated | Kind::Packed => quote! {
|
||||
#merge_fn(wire_type, &mut #ident, buf, ctx)
|
||||
#merge_fn(wire_type, #ident, buf, ctx)
|
||||
},
|
||||
Kind::Optional(..) => quote! {
|
||||
#merge_fn(wire_type,
|
||||
|
||||
@ -103,16 +103,21 @@ fn try_message(input: TokenStream) -> Result<TokenStream, Error> {
|
||||
.map(|&(ref field_ident, ref field)| field.encode(quote!(self.#field_ident)));
|
||||
|
||||
let merge = fields.iter().map(|&(ref field_ident, ref field)| {
|
||||
let merge = field.merge(quote!(self.#field_ident));
|
||||
let merge = field.merge(quote!(value));
|
||||
let tags = field
|
||||
.tags()
|
||||
.into_iter()
|
||||
.map(|tag| quote!(#tag))
|
||||
.intersperse(quote!(|));
|
||||
quote!(#(#tags)* => #merge.map_err(|mut error| {
|
||||
error.push(STRUCT_NAME, stringify!(#field_ident));
|
||||
error
|
||||
}),)
|
||||
quote! {
|
||||
#(#tags)* => {
|
||||
let mut value = &mut self.#field_ident;
|
||||
#merge.map_err(|mut error| {
|
||||
error.push(STRUCT_NAME, stringify!(#field_ident));
|
||||
error
|
||||
})
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
let struct_name = if fields.is_empty() {
|
||||
@ -394,8 +399,16 @@ fn try_oneof(input: TokenStream) -> Result<TokenStream, Error> {
|
||||
let merge = field.merge(quote!(value));
|
||||
quote! {
|
||||
#tag => {
|
||||
let mut value = ::std::default::Default::default();
|
||||
#merge.map(|_| *field = ::std::option::Option::Some(#ident::#variant_ident(value)))
|
||||
match field {
|
||||
::std::option::Option::Some(#ident::#variant_ident(ref mut value)) => {
|
||||
#merge
|
||||
},
|
||||
_ => {
|
||||
let mut owned_value = ::std::default::Default::default();
|
||||
let value = &mut owned_value;
|
||||
#merge.map(|_| *field = ::std::option::Option::Some(#ident::#variant_ident(owned_value)))
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -75,8 +75,10 @@ pub struct DescriptorProto {
|
||||
pub mod descriptor_proto {
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct ExtensionRange {
|
||||
/// Inclusive.
|
||||
#[prost(int32, optional, tag="1")]
|
||||
pub start: ::std::option::Option<i32>,
|
||||
/// Exclusive.
|
||||
#[prost(int32, optional, tag="2")]
|
||||
pub end: ::std::option::Option<i32>,
|
||||
#[prost(message, optional, tag="3")]
|
||||
@ -401,8 +403,8 @@ pub struct FileOptions {
|
||||
#[prost(string, optional, tag="41")]
|
||||
pub php_namespace: ::std::option::Option<std::string::String>,
|
||||
/// Use this option to change the namespace of php generated metadata classes.
|
||||
/// Default is empty. When this option is empty, the proto file name will be used
|
||||
/// for determining the namespace.
|
||||
/// Default is empty. When this option is empty, the proto file name will be
|
||||
/// used for determining the namespace.
|
||||
#[prost(string, optional, tag="44")]
|
||||
pub php_metadata_namespace: ::std::option::Option<std::string::String>,
|
||||
/// Use this option to change the package of ruby generated classes. Default
|
||||
@ -478,7 +480,7 @@ pub struct MessageOptions {
|
||||
///
|
||||
/// Implementations may choose not to generate the map_entry=true message, but
|
||||
/// use a native map in the target language to hold the keys and values.
|
||||
/// The reflection APIs in such implementions still need to work as
|
||||
/// The reflection APIs in such implementations still need to work as
|
||||
/// if the field is a repeated message field.
|
||||
///
|
||||
/// NOTE: Do not set the option in .proto files. Always use the maps syntax
|
||||
@ -748,7 +750,7 @@ pub struct SourceCodeInfo {
|
||||
/// beginning of the "extend" block and is shared by all extensions within
|
||||
/// the block.
|
||||
/// - Just because a location's span is a subset of some other location's span
|
||||
/// does not mean that it is a descendent. For example, a "group" defines
|
||||
/// does not mean that it is a descendant. For example, a "group" defines
|
||||
/// both a type and a field in a single declaration. Thus, the locations
|
||||
/// corresponding to the type and field and their components will overlap.
|
||||
/// - Code which tries to interpret locations should probably be designed to
|
||||
@ -1366,7 +1368,7 @@ pub struct Mixin {
|
||||
/// if (duration.seconds < 0 && duration.nanos > 0) {
|
||||
/// duration.seconds += 1;
|
||||
/// duration.nanos -= 1000000000;
|
||||
/// } else if (durations.seconds > 0 && duration.nanos < 0) {
|
||||
/// } else if (duration.seconds > 0 && duration.nanos < 0) {
|
||||
/// duration.seconds -= 1;
|
||||
/// duration.nanos += 1000000000;
|
||||
/// }
|
||||
@ -1619,7 +1621,7 @@ pub struct Duration {
|
||||
///
|
||||
/// The implementation of any API method which has a FieldMask type field in the
|
||||
/// request should verify the included field paths, and return an
|
||||
/// `INVALID_ARGUMENT` error if any path is duplicated or unmappable.
|
||||
/// `INVALID_ARGUMENT` error if any path is unmappable.
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct FieldMask {
|
||||
/// The set of field mask paths.
|
||||
@ -1768,11 +1770,13 @@ pub enum NullValue {
|
||||
/// 01:30 UTC on January 15, 2017.
|
||||
///
|
||||
/// In JavaScript, one can convert a Date object to this format using the
|
||||
/// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
||||
/// standard
|
||||
/// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
||||
/// method. In Python, a standard `datetime.datetime` object can be converted
|
||||
/// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
|
||||
/// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
|
||||
/// can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
||||
/// to this format using
|
||||
/// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
||||
/// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
||||
/// the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
||||
/// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
|
||||
/// ) to obtain a formatter capable of generating timestamps in this format.
|
||||
///
|
||||
|
||||
@ -12,7 +12,7 @@ use curl::easy::Easy;
|
||||
use flate2::bufread::GzDecoder;
|
||||
use tar::Archive;
|
||||
|
||||
const VERSION: &'static str = "3.7.1";
|
||||
const VERSION: &'static str = "3.11.2";
|
||||
|
||||
static TEST_PROTOS: &[&str] = &[
|
||||
"test_messages_proto2.proto",
|
||||
@ -107,6 +107,7 @@ fn download_tarball(url: &str, out_dir: &Path) {
|
||||
let mut data = Vec::new();
|
||||
let mut handle = Easy::new();
|
||||
|
||||
// Download the tarball.
|
||||
handle.url(url).expect("failed to configure tarball URL");
|
||||
handle
|
||||
.follow_location(true)
|
||||
@ -122,6 +123,7 @@ fn download_tarball(url: &str, out_dir: &Path) {
|
||||
transfer.perform().expect("failed to download tarball");
|
||||
}
|
||||
|
||||
// Unpack the tarball.
|
||||
Archive::new(GzDecoder::new(Cursor::new(data)))
|
||||
.unpack(out_dir)
|
||||
.expect("failed to unpack tarball");
|
||||
@ -136,50 +138,58 @@ fn download_protobuf(out_dir: &Path) -> PathBuf {
|
||||
),
|
||||
out_dir,
|
||||
);
|
||||
out_dir.join(format!("protobuf-{}", VERSION))
|
||||
let src_dir = out_dir.join(format!("protobuf-{}", VERSION));
|
||||
|
||||
// Apply patches.
|
||||
let mut patch_src = env::current_dir().expect("failed to get current working directory");
|
||||
patch_src.push("src");
|
||||
patch_src.push("fix-conformance_test_runner-cmake-build.patch");
|
||||
|
||||
let rc = Command::new("patch")
|
||||
.arg("-p1")
|
||||
.arg("-i")
|
||||
.arg(patch_src)
|
||||
.current_dir(&src_dir)
|
||||
.status()
|
||||
.expect("failed to apply patch");
|
||||
assert!(rc.success(), "protobuf patch failed");
|
||||
|
||||
src_dir
|
||||
}
|
||||
|
||||
fn install_conformance_test_runner(src_dir: &Path, prefix_dir: &Path) {
|
||||
#[cfg(not(windows))]
|
||||
{
|
||||
// Build and install protoc, the protobuf libraries, and the conformance test runner.
|
||||
let rc = Command::new("./autogen.sh")
|
||||
let rc = Command::new("cmake")
|
||||
.arg("-GNinja")
|
||||
.arg("cmake/")
|
||||
.arg("-DCMAKE_BUILD_TYPE=DEBUG")
|
||||
.arg(&format!("-DCMAKE_INSTALL_PREFIX={}", prefix_dir.display()))
|
||||
.arg("-Dprotobuf_BUILD_CONFORMANCE=ON")
|
||||
.arg("-Dprotobuf_BUILD_TESTS=OFF")
|
||||
.current_dir(&src_dir)
|
||||
.status()
|
||||
.expect("failed to execute autogen.sh");
|
||||
assert!(rc.success(), "protobuf autogen.sh failed");
|
||||
.expect("failed to execute CMake");
|
||||
assert!(rc.success(), "protobuf CMake failed");
|
||||
|
||||
let num_jobs = env::var("NUM_JOBS").expect("NUM_JOBS environment variable not set");
|
||||
|
||||
let rc = Command::new("./configure")
|
||||
.arg("--disable-shared")
|
||||
.arg("--prefix")
|
||||
.arg(&prefix_dir)
|
||||
.current_dir(&src_dir)
|
||||
.status()
|
||||
.expect("failed to execute configure");
|
||||
assert!(rc.success(), "failed to configure protobuf");
|
||||
|
||||
let rc = Command::new("make")
|
||||
let rc = Command::new("ninja")
|
||||
.arg("-j")
|
||||
.arg(&num_jobs)
|
||||
.arg("install")
|
||||
.current_dir(&src_dir)
|
||||
.status()
|
||||
.expect("failed to execute make protobuf");
|
||||
.expect("failed to execute ninja protobuf");
|
||||
assert!(rc.success(), "failed to make protobuf");
|
||||
|
||||
// Workaround for protocolbuffers/protobuf#6210.
|
||||
fs::create_dir(src_dir.join("conformance").join("google-protobuf")).unwrap();
|
||||
|
||||
let rc = Command::new("make")
|
||||
.arg("-j")
|
||||
.arg(&num_jobs)
|
||||
.arg("install")
|
||||
.current_dir(src_dir.join("conformance"))
|
||||
.status()
|
||||
.expect("failed to execute make conformance");
|
||||
assert!(rc.success(), "failed to make conformance");
|
||||
// Install the conformance-test-runner binary, since it isn't done automatically.
|
||||
fs::rename(
|
||||
src_dir.join("conformance_test_runner"),
|
||||
prefix_dir.join("bin").join("conformance-test-runner"),
|
||||
)
|
||||
.expect("failed to move conformance-test-runner");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
41
protobuf/src/fix-conformance_test_runner-cmake-build.patch
Normal file
41
protobuf/src/fix-conformance_test_runner-cmake-build.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From 104a483fbf3b87d42b0c3381049c72ab45d0f630 Mon Sep 17 00:00:00 2001
|
||||
From: Dan Burkert <dan@danburkert.com>
|
||||
Date: Sat, 11 Jan 2020 13:44:02 -0800
|
||||
Subject: [PATCH] Fix conformance_test_runner CMake build
|
||||
|
||||
Makes the conformance_test_runner declared sources in
|
||||
cmake/conformance.cmake match the corresponding sources in
|
||||
conformance/Makefile.am, which allows the test runner to build
|
||||
successfully with CMake.
|
||||
---
|
||||
cmake/conformance.cmake | 9 ++++++---
|
||||
1 file changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/cmake/conformance.cmake b/cmake/conformance.cmake
|
||||
index 82b4cf580..7be713d33 100644
|
||||
--- a/cmake/conformance.cmake
|
||||
+++ b/cmake/conformance.cmake
|
||||
@@ -19,14 +19,17 @@ add_custom_command(
|
||||
)
|
||||
|
||||
add_executable(conformance_test_runner
|
||||
- ${protobuf_source_dir}/conformance/conformance.pb.cc
|
||||
+ ${protobuf_source_dir}/conformance/conformance_test.h
|
||||
${protobuf_source_dir}/conformance/conformance_test.cc
|
||||
- ${protobuf_source_dir}/conformance/binary_json_conformance_main.cc
|
||||
- ${protobuf_source_dir}/conformance/binary_json_conformance_suite.cc
|
||||
+ ${protobuf_source_dir}/conformance/conformance_test_main.cc
|
||||
${protobuf_source_dir}/conformance/binary_json_conformance_suite.h
|
||||
+ ${protobuf_source_dir}/conformance/binary_json_conformance_suite.cc
|
||||
+ ${protobuf_source_dir}/conformance/text_format_conformance_suite.h
|
||||
+ ${protobuf_source_dir}/conformance/text_format_conformance_suite.cc
|
||||
${protobuf_source_dir}/conformance/conformance_test_runner.cc
|
||||
${protobuf_source_dir}/conformance/third_party/jsoncpp/json.h
|
||||
${protobuf_source_dir}/conformance/third_party/jsoncpp/jsoncpp.cpp
|
||||
+ ${protobuf_source_dir}/conformance/conformance.pb.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.pb.cc
|
||||
)
|
||||
--
|
||||
2.21.1
|
||||
|
||||
@ -856,6 +856,16 @@ pub mod bytes {
|
||||
return Err(DecodeError::new("buffer underflow"));
|
||||
}
|
||||
let len = len as usize;
|
||||
|
||||
// Clear the existing value. This follows from the following rule in the encoding guide[1]:
|
||||
//
|
||||
// > Normally, an encoded message would never have more than one instance of a non-repeated
|
||||
// > field. However, parsers are expected to handle the case in which they do. For numeric
|
||||
// > types and strings, if the same field appears multiple times, the parser accepts the last
|
||||
// > value it sees.
|
||||
//
|
||||
// [1]: https://developers.google.com/protocol-buffers/docs/encoding#optional
|
||||
value.clear();
|
||||
value.reserve(len);
|
||||
value.put(buf.take(len));
|
||||
Ok(())
|
||||
|
||||
Loading…
Reference in New Issue
Block a user