From 9f415ead603f5b5a5208bdcd19183bea697ac9e6 Mon Sep 17 00:00:00 2001 From: Boyd Johnson Date: Wed, 8 Jun 2022 15:53:29 +0000 Subject: [PATCH 1/9] Bump tonic-build to 0.7 --- tonic-rpc-macro/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tonic-rpc-macro/Cargo.toml b/tonic-rpc-macro/Cargo.toml index fd3fe95..22956a1 100644 --- a/tonic-rpc-macro/Cargo.toml +++ b/tonic-rpc-macro/Cargo.toml @@ -19,6 +19,6 @@ proc-macro = true heck = "0.3" itertools = "0.10" syn = { version = "1.0", features = ["full"] } -tonic-build = "0.4" +tonic-build = "0.7" proc-macro2 = "1.0" quote = "1.0" From 7a218c7a2c627a45480d11418cbe7259fb8d8957 Mon Sep 17 00:00:00 2001 From: Boyd Johnson Date: Wed, 8 Jun 2022 15:53:54 +0000 Subject: [PATCH 2/9] Add default Attributes to generate The signature of generate has changed to include Attributes. --- tonic-rpc-macro/src/lib.rs | 6 +++--- tonic-rpc/tests/util/mod.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tonic-rpc-macro/src/lib.rs b/tonic-rpc-macro/src/lib.rs index 4b5602c..3045a61 100644 --- a/tonic-rpc-macro/src/lib.rs +++ b/tonic-rpc-macro/src/lib.rs @@ -4,7 +4,7 @@ use syn::{ parse_macro_input, punctuated::Pair, FnArg, ItemTrait, ReturnType, TraitItem, TraitItemMethod, Type, }; -use tonic_build::{Method, Service}; +use tonic_build::{Attributes, Method, Service}; struct RustDefMethod { pub name: String, @@ -247,8 +247,8 @@ where name, methods, }; - let client = tonic_build::client::generate(&service, false, "", false); - let server = tonic_build::server::generate(&service, false, "", false); + let client = tonic_build::client::generate(&service, false, "", false, &Attributes::default()); + let server = tonic_build::server::generate(&service, false, "", false, &Attributes::default()); let types = service.methods.iter().map(|m| { let request_name = m.generated_request(); let response_name = m.generated_response(); diff --git a/tonic-rpc/tests/util/mod.rs b/tonic-rpc/tests/util/mod.rs index 83edd57..da4cfed 100644 --- a/tonic-rpc/tests/util/mod.rs +++ b/tonic-rpc/tests/util/mod.rs @@ -1,4 +1,4 @@ -use std::{error::Error}; +use std::error::Error; use tokio::net::TcpListener; use tokio_stream::wrappers::TcpListenerStream; From dead14794e53dd62f763877bee2a5a8ffe9915ae Mon Sep 17 00:00:00 2001 From: Boyd Johnson Date: Wed, 8 Jun 2022 15:58:14 +0000 Subject: [PATCH 3/9] Bump heck to 0.4 --- tonic-rpc-macro/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tonic-rpc-macro/Cargo.toml b/tonic-rpc-macro/Cargo.toml index 22956a1..d271c15 100644 --- a/tonic-rpc-macro/Cargo.toml +++ b/tonic-rpc-macro/Cargo.toml @@ -16,7 +16,7 @@ Core macro for tonic-rpc. proc-macro = true [dependencies] -heck = "0.3" +heck = "0.4" itertools = "0.10" syn = { version = "1.0", features = ["full"] } tonic-build = "0.7" From 7f15630895386f5eac3f1ec0228ed333890371f6 Mon Sep 17 00:00:00 2001 From: Boyd Johnson Date: Wed, 8 Jun 2022 15:58:31 +0000 Subject: [PATCH 4/9] Update heck call to ToUpperCamelCase --- tonic-rpc-macro/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tonic-rpc-macro/src/lib.rs b/tonic-rpc-macro/src/lib.rs index 3045a61..370cea3 100644 --- a/tonic-rpc-macro/src/lib.rs +++ b/tonic-rpc-macro/src/lib.rs @@ -213,7 +213,7 @@ fn make_method>(method: TraitItemMethod, trait_name: &str quote::format_ident!("__tonic_generated_{}_{}_response", trait_name, name); RustDefMethod { - identifier: heck::CamelCase::to_camel_case(name.as_str()), + identifier: heck::ToUpperCamelCase::to_upper_camel_case(name.as_str()), name, client_streaming, server_streaming, From 533f7a03fa21800804a426dcfe7e09bce18ba5d4 Mon Sep 17 00:00:00 2001 From: Boyd Johnson Date: Wed, 8 Jun 2022 16:01:30 +0000 Subject: [PATCH 5/9] Bump tonic-rpc-macro version to 0.2 --- tonic-rpc-macro/Cargo.toml | 2 +- tonic-rpc/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tonic-rpc-macro/Cargo.toml b/tonic-rpc-macro/Cargo.toml index d271c15..d680aac 100644 --- a/tonic-rpc-macro/Cargo.toml +++ b/tonic-rpc-macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tonic-rpc-macro" -version = "0.1.0" +version = "0.2.0" authors = ["Adam Bratschi-Kaye "] edition = "2018" license = "MIT" diff --git a/tonic-rpc/Cargo.toml b/tonic-rpc/Cargo.toml index ab7c637..ef46664 100644 --- a/tonic-rpc/Cargo.toml +++ b/tonic-rpc/Cargo.toml @@ -25,7 +25,7 @@ messagepack = ["rmp-serde"] bytes = "1.0" serde = { version = "1.0", features = ["derive"] } tonic = "0.4" -tonic-rpc-macro = { version = "0.1", path = "../tonic-rpc-macro" } +tonic-rpc-macro = { version = "0.2", path = "../tonic-rpc-macro" } # optional codecs bincode = { version = "1.3", optional = true } From 937eaf290f2612f35cc8a89f46f808fdd4228392 Mon Sep 17 00:00:00 2001 From: Boyd Johnson Date: Wed, 8 Jun 2022 16:04:44 +0000 Subject: [PATCH 6/9] Bump tonic, tonic-build to 0.7 --- tonic-rpc/Cargo.toml | 4 ++-- tonic-rpc/tests/util/mod.rs | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tonic-rpc/Cargo.toml b/tonic-rpc/Cargo.toml index ef46664..43f4878 100644 --- a/tonic-rpc/Cargo.toml +++ b/tonic-rpc/Cargo.toml @@ -24,7 +24,7 @@ messagepack = ["rmp-serde"] [dependencies] bytes = "1.0" serde = { version = "1.0", features = ["derive"] } -tonic = "0.4" +tonic = "0.7" tonic-rpc-macro = { version = "0.2", path = "../tonic-rpc-macro" } # optional codecs @@ -39,7 +39,7 @@ tokio = { version = "1.4", features = [ "full" ] } tokio-stream = { version = "0.1", features = [ "net" ] } [build-dependencies] -tonic-build = "0.4" +tonic-build = "0.7" # docs.rs-specific configuration [package.metadata.docs.rs] diff --git a/tonic-rpc/tests/util/mod.rs b/tonic-rpc/tests/util/mod.rs index da4cfed..8136694 100644 --- a/tonic-rpc/tests/util/mod.rs +++ b/tonic-rpc/tests/util/mod.rs @@ -1,4 +1,4 @@ -use std::error::Error; +use std::convert::Infallible; use tokio::net::TcpListener; use tokio_stream::wrappers::TcpListenerStream; @@ -14,9 +14,12 @@ use tonic::{ /// Returns the address to connect to. pub async fn run_server(svc: S) -> String where - S: Service, Response = Response> + NamedService + Clone + Send + 'static, + S: Service, Response = Response, Error = Infallible> + + NamedService + + Clone + + Send + + 'static, S::Future: Send + 'static, - S::Error: Error + Send + Sync, { let listener = TcpListener::bind("[::1]:0").await.unwrap(); let port = listener.local_addr().unwrap().port(); From ead3ee766baf39d615bc7012b82a538e5a0542b8 Mon Sep 17 00:00:00 2001 From: Boyd Johnson Date: Wed, 8 Jun 2022 16:05:04 +0000 Subject: [PATCH 7/9] Bump rmp-serde to 1.1 --- tonic-rpc/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tonic-rpc/Cargo.toml b/tonic-rpc/Cargo.toml index 43f4878..a60686e 100644 --- a/tonic-rpc/Cargo.toml +++ b/tonic-rpc/Cargo.toml @@ -29,7 +29,7 @@ tonic-rpc-macro = { version = "0.2", path = "../tonic-rpc-macro" } # optional codecs bincode = { version = "1.3", optional = true } -rmp-serde = { version = "0.15", optional = true } +rmp-serde = { version = "1.1", optional = true } serde_json = { version = "1.0", optional = true } serde_cbor = { version = "0.11", optional = true } From a38c479b80a3e9320a7bd07a7076492a30798d74 Mon Sep 17 00:00:00 2001 From: Boyd Johnson Date: Wed, 8 Jun 2022 16:05:55 +0000 Subject: [PATCH 8/9] Bump tonic-rpc to 0.2 --- tonic-rpc/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tonic-rpc/Cargo.toml b/tonic-rpc/Cargo.toml index a60686e..1b0bc2d 100644 --- a/tonic-rpc/Cargo.toml +++ b/tonic-rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tonic-rpc" -version = "0.1.1" +version = "0.2.0" authors = ["Adam Bratschi-Kaye "] edition = "2018" license = "MIT" From 4d5cc9322524eb5543f94e498a450c8dec2041a4 Mon Sep 17 00:00:00 2001 From: Boyd Johnson Date: Wed, 8 Jun 2022 16:24:42 +0000 Subject: [PATCH 9/9] Bump tonic version in example --- example/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/Cargo.toml b/example/Cargo.toml index 3126c7b..fb2768a 100644 --- a/example/Cargo.toml +++ b/example/Cargo.toml @@ -10,5 +10,5 @@ license = "MIT" [dependencies] tokio = { version = "1.0", features = [ "full" ] } tokio-stream = { version = "0.1", features = [ "net" ] } -tonic = "0.4" +tonic = "0.7" tonic-rpc = { path = "../tonic-rpc" }