Skip to content

Commit

Permalink
bump bundled protobuf version to 3.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
danburkert committed Aug 29, 2020
1 parent a7e3347 commit 4ded4a9
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ message CodeGeneratorResponse {
// exiting with a non-zero status code.
optional string error = 1;

// A bitmask of supported features that the code generator supports.
// This is a bitwise "or" of values from the Feature enum.
optional uint64 supported_features = 2;

// Sync with code_generator.h.
enum Feature {
FEATURE_NONE = 0;
FEATURE_PROTO3_OPTIONAL = 1;
}

// Represents a single generated file.
message File {
// The file name, relative to the output directory. The name must not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ message ExtensionRangeOptions {
// The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999;


// Clients can define custom options in extensions of this message. See above.
extensions 1000 to max;
}
Expand Down Expand Up @@ -212,6 +213,29 @@ message FieldDescriptorProto {
optional string json_name = 10;

optional FieldOptions options = 8;

// If true, this is a proto3 "optional". When a proto3 field is optional, it
// tracks presence regardless of field type.
//
// When proto3_optional is true, this field must be belong to a oneof to
// signal to old proto3 clients that presence is tracked for this field. This
// oneof is known as a "synthetic" oneof, and this field must be its sole
// member (each proto3 optional field gets its own synthetic oneof). Synthetic
// oneofs exist in the descriptor only, and do not generate any API. Synthetic
// oneofs must be ordered after all "real" oneofs.
//
// For message fields, proto3_optional doesn't create any semantic change,
// since non-repeated message fields always track presence. However it still
// indicates the semantic detail of whether the user wrote "optional" or not.
// This can be useful for round-tripping the .proto file. For consistency we
// give message fields a synthetic oneof also, even though it is not required
// to track presence. This is especially important because the parser can't
// tell if a field is a message or an enum, so it must always create a
// synthetic oneof.
//
// Proto2 optional fields do not set this flag, because they already indicate
// optional with `LABEL_OPTIONAL`.
optional bool proto3_optional = 17;
}

// Describes a oneof.
Expand Down Expand Up @@ -393,7 +417,7 @@ message FileOptions {

// 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 = true];


// Sets the objective c class prefix which is prepended to all objective c
Expand Down
Binary file modified prost-build/third-party/protobuf/protoc-linux-aarch_64
Binary file not shown.
Binary file modified prost-build/third-party/protobuf/protoc-linux-x86_32
Binary file not shown.
Binary file modified prost-build/third-party/protobuf/protoc-linux-x86_64
Binary file not shown.
Binary file modified prost-build/third-party/protobuf/protoc-osx-x86_64
Binary file not shown.
Binary file modified prost-build/third-party/protobuf/protoc-win32.exe
Binary file not shown.
3 changes: 1 addition & 2 deletions prost-build/third-party/update-bundled-protobuf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ mv "$TEMPDIR/linux-x86_64/include" "$DIR/protobuf/"
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"
mv "$TEMPDIR/src/protobuf-$VERSION/LICENSE" "$DIR/protobuf/LICENSE"

rm -rf $TEMPDIR
11 changes: 11 additions & 0 deletions prost-types/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ pub struct CodeGeneratorResponse {
/// exiting with a non-zero status code.
#[prost(string, optional, tag="1")]
pub error: ::core::option::Option<::prost::alloc::string::String>,
/// A bitmask of supported features that the code generator supports.
/// This is a bitwise "or" of values from the Feature enum.
#[prost(uint64, optional, tag="2")]
pub supported_features: ::core::option::Option<u64>,
#[prost(message, repeated, tag="15")]
pub file: ::prost::alloc::vec::Vec<code_generator_response::File>,
}
Expand Down Expand Up @@ -120,4 +124,11 @@ pub mod code_generator_response {
#[prost(string, optional, tag="15")]
pub content: ::core::option::Option<::prost::alloc::string::String>,
}
/// Sync with code_generator.h.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Feature {
None = 0,
Proto3Optional = 1,
}
}
25 changes: 24 additions & 1 deletion prost-types/src/protobuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,29 @@ pub struct FieldDescriptorProto {
pub json_name: ::core::option::Option<::prost::alloc::string::String>,
#[prost(message, optional, tag="8")]
pub options: ::core::option::Option<FieldOptions>,
/// If true, this is a proto3 "optional". When a proto3 field is optional, it
/// tracks presence regardless of field type.
///
/// When proto3_optional is true, this field must be belong to a oneof to
/// signal to old proto3 clients that presence is tracked for this field. This
/// oneof is known as a "synthetic" oneof, and this field must be its sole
/// member (each proto3 optional field gets its own synthetic oneof). Synthetic
/// oneofs exist in the descriptor only, and do not generate any API. Synthetic
/// oneofs must be ordered after all "real" oneofs.
///
/// For message fields, proto3_optional doesn't create any semantic change,
/// since non-repeated message fields always track presence. However it still
/// indicates the semantic detail of whether the user wrote "optional" or not.
/// This can be useful for round-tripping the .proto file. For consistency we
/// give message fields a synthetic oneof also, even though it is not required
/// to track presence. This is especially important because the parser can't
/// tell if a field is a message or an enum, so it must always create a
/// synthetic oneof.
///
/// Proto2 optional fields do not set this flag, because they already indicate
/// optional with `LABEL_OPTIONAL`.
#[prost(bool, optional, tag="17")]
pub proto3_optional: ::core::option::Option<bool>,
}
/// Nested message and enum types in `FieldDescriptorProto`.
pub mod field_descriptor_proto {
Expand Down Expand Up @@ -382,7 +405,7 @@ pub struct FileOptions {
pub deprecated: ::core::option::Option<bool>,
/// Enables the use of arenas for the proto messages in this file. This applies
/// only to generated classes for C++.
#[prost(bool, optional, tag="31", default="false")]
#[prost(bool, optional, tag="31", default="true")]
pub cc_enable_arenas: ::core::option::Option<bool>,
/// Sets the objective c class prefix which is prepended to all objective c
/// generated classes from this .proto. There is no default.
Expand Down
2 changes: 1 addition & 1 deletion protobuf/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use curl::easy::Easy;
use flate2::bufread::GzDecoder;
use tar::Archive;

const VERSION: &str = "3.11.2";
const VERSION: &str = "3.13.0";

static TEST_PROTOS: &[&str] = &[
"test_messages_proto2.proto",
Expand Down

0 comments on commit 4ded4a9

Please sign in to comment.