From 038cd342677dfa869f8c3a2a2787a139fc561df8 Mon Sep 17 00:00:00 2001 From: Horaci Macias Date: Sat, 28 Jan 2023 20:11:35 +0100 Subject: [PATCH 1/2] Add message and enum attributes https://github.com/tokio-rs/prost/releases/tag/v0.11.6 --- Cargo.lock | 18 ++++++++++-------- protoc-gen-prost-crate/Cargo.toml | 4 ++-- protoc-gen-prost-serde/Cargo.toml | 4 ++-- protoc-gen-prost/Cargo.toml | 10 ++++------ protoc-gen-prost/src/lib.rs | 24 ++++++++++++++++++++++++ protoc-gen-tonic/Cargo.toml | 8 +++----- 6 files changed, 45 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8a81337..449046a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -169,9 +169,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.11.2" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0841812012b2d4a6145fae9a6af1534873c32aa67fff26bd09f8fa42c83f95a" +checksum = "21dc42e00223fc37204bd4aa177e69420c604ca4a183209a8f9de30c6d934698" dependencies = [ "bytes", "prost-derive", @@ -179,9 +179,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.11.1" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f835c582e6bd972ba8347313300219fed5bfa52caf175298d860b61ff6069bb" +checksum = "a3f8ad728fb08fe212df3c05169e940fbb6d9d16a877ddde14644a983ba2012e" dependencies = [ "bytes", "heck", @@ -190,18 +190,20 @@ dependencies = [ "log", "multimap", "petgraph", + "prettyplease", "prost", "prost-types", "regex", + "syn", "tempfile", "which", ] [[package]] name = "prost-derive" -version = "0.11.2" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "164ae68b6587001ca506d3bf7f1000bfa248d0e1217b618108fba4ec1d0cc306" +checksum = "8bda8c0881ea9f722eb9629376db3d0b903b462477c1aafcb0566610ac28ac5d" dependencies = [ "anyhow", "itertools", @@ -212,9 +214,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.11.2" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747761bc3dc48f9a34553bf65605cf6cb6288ba219f3450b4275dbd81539551a" +checksum = "a5e0526209433e96d83d750dd81a99118edbc55739e7e61a46764fd2ad537788" dependencies = [ "bytes", "prost", diff --git a/protoc-gen-prost-crate/Cargo.toml b/protoc-gen-prost-crate/Cargo.toml index 1322cbc..1ef1118 100644 --- a/protoc-gen-prost-crate/Cargo.toml +++ b/protoc-gen-prost-crate/Cargo.toml @@ -16,8 +16,8 @@ categories = ["encoding"] [dependencies] once_cell = "1.10.0" -prost-build = { version = ">=0.11.0, <0.11.2", default-features = false } -prost-types = { version = "0.11.0", default-features = false } +prost-build = { version = "0.11.6", default-features = false } +prost-types = { version = "0.11.6", default-features = false } prost = { version = "0.11.0", default-features = false, features = ["std"] } protoc-gen-prost = { version = "0.2.0", path = "../protoc-gen-prost" } regex = { version = "1.5.5", default-features = false } diff --git a/protoc-gen-prost-serde/Cargo.toml b/protoc-gen-prost-serde/Cargo.toml index c2212ae..ed3f7de 100644 --- a/protoc-gen-prost-serde/Cargo.toml +++ b/protoc-gen-prost-serde/Cargo.toml @@ -16,8 +16,8 @@ categories = ["encoding"] [dependencies] pbjson-build = "0.5.1" -prost-build = { version = ">=0.11.0, <0.11.2", default-features = false } -prost-types = { version = "0.11.0", default-features = false } +prost-build = { version = "0.11.6", default-features = false } +prost-types = { version = "0.11.6", default-features = false } prost = { version = "0.11.0", default-features = false, features = ["std"] } protoc-gen-prost = { version = "0.2.0", path = "../protoc-gen-prost" } regex = { version = "1.5.5", default-features = false } diff --git a/protoc-gen-prost/Cargo.toml b/protoc-gen-prost/Cargo.toml index c63aeef..9f4a4b6 100644 --- a/protoc-gen-prost/Cargo.toml +++ b/protoc-gen-prost/Cargo.toml @@ -12,17 +12,15 @@ rust-version = "1.62" readme = "README.md" keywords = ["protobuf", "serialization", "prost"] categories = ["encoding"] -exclude = [ - "proto" -] +exclude = ["proto"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] once_cell = "1.10.0" -prost-build = { version = ">=0.11.0, <0.11.2", default-features = false } -prost-types = { version = "0.11.0", default-features = false } -prost = { version = "0.11.0", default-features = false, features = ["std"] } +prost-build = { version = "0.11.6", default-features = false } +prost-types = { version = "0.11.6", default-features = false } +prost = { version = "0.11.6", default-features = false, features = ["std"] } regex = { version = "1.5.5", default-features = false } [profile.release] diff --git a/protoc-gen-prost/src/lib.rs b/protoc-gen-prost/src/lib.rs index a85a40e..43fc5ba 100644 --- a/protoc-gen-prost/src/lib.rs +++ b/protoc-gen-prost/src/lib.rs @@ -219,6 +219,8 @@ struct ProstParameters { extern_path: Vec<(String, String)>, type_attribute: Vec<(String, String)>, field_attribute: Vec<(String, String)>, + enum_attribute: Vec<(String, String)>, + message_attribute: Vec<(String, String)>, compile_well_known_types: bool, retain_enum_prefix: bool, } @@ -244,6 +246,12 @@ impl ProstParameters { for (proto_path, attribute) in &self.field_attribute { config.field_attribute(proto_path, attribute); } + for (proto_path, attribute) in &self.enum_attribute { + config.enum_attribute(proto_path, attribute); + } + for (proto_path, attribute) in &self.message_attribute { + config.message_attribute(proto_path, attribute); + } if self.compile_well_known_types { config.compile_well_known_types(); @@ -323,6 +331,22 @@ impl ProstParameters { prefix.to_string(), module.replace(r"\,", ",").replace(r"\\", r"\"), )), + Param::KeyValue { + param: "enum_attribute", + key: prefix, + value: module, + } => self.enum_attribute.push(( + prefix.to_string(), + module.replace(r"\,", ",").replace(r"\\", r"\"), + )), + Param::KeyValue { + param: "message_attribute", + key: prefix, + value: module, + } => self.message_attribute.push(( + prefix.to_string(), + module.replace(r"\,", ",").replace(r"\\", r"\"), + )), _ => return Err(param), } diff --git a/protoc-gen-tonic/Cargo.toml b/protoc-gen-tonic/Cargo.toml index 93159b3..10c6381 100644 --- a/protoc-gen-tonic/Cargo.toml +++ b/protoc-gen-tonic/Cargo.toml @@ -11,17 +11,15 @@ edition = "2021" readme = "README.md" keywords = ["protobuf", "serialization", "prost", "grpc", "tonic"] categories = ["encoding"] -exclude = [ - "proto" -] +exclude = ["proto"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] heck = "0.4.0" prettyplease = "0.1.9" -prost-build = { version = ">=0.11.0, <0.11.2", default-features = false } -prost-types = { version = "0.11.0", default-features = false } +prost-build = { version = "0.11.6", default-features = false } +prost-types = { version = "0.11.6", default-features = false } prost = { version = "0.11.0", default-features = false, features = ["std"] } protoc-gen-prost = { version = "0.2.0", path = "../protoc-gen-prost" } regex = { version = "1.5.5", default-features = false } From f8a460918dee5c2687e0160348227842189f4495 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 4 Feb 2023 01:01:22 +0000 Subject: [PATCH 2/2] build(deps): bump tokio from 1.24.1 to 1.25.0 in /example/build-with-buf Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.24.1 to 1.25.0. - [Release notes](https://github.com/tokio-rs/tokio/releases) - [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.24.1...tokio-1.25.0) --- updated-dependencies: - dependency-name: tokio dependency-type: indirect ... Signed-off-by: dependabot[bot] --- example/build-with-buf/Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example/build-with-buf/Cargo.lock b/example/build-with-buf/Cargo.lock index 4e4a13b..8570efe 100644 --- a/example/build-with-buf/Cargo.lock +++ b/example/build-with-buf/Cargo.lock @@ -780,9 +780,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.24.1" +version = "1.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d9f76183f91ecfb55e1d7d5602bd1d979e38a3a522fe900241cf195624d67ae" +checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" dependencies = [ "autocfg", "bytes",