Skip to content

Commit 2057a21

Browse files
authored
*: update dependency and tools (#648)
- update bindgen to 0.69 to keep compatible with latest llvm - update rand to 0.8 - update clap to 4 - update prost to 0.12 - fix clippy warnings (1.78.0) Signed-off-by: Jay Lee <[email protected]>
1 parent 5442991 commit 2057a21

File tree

39 files changed

+603
-1636
lines changed

39 files changed

+603
-1636
lines changed
File renamed without changes.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ futures-executor = "0.3"
2323
futures-util = { version = "0.3", default-features = false, features = ["std", "sink"] }
2424
protobuf = { version = "2.0", optional = true }
2525
protobufv3 = { package = "protobuf", version = "3.2", optional = true }
26-
prost = { version = "0.11", optional = true }
26+
prost = { version = "0.12", optional = true }
2727
bytes = { version = "1.0", optional = true }
2828
log = "0.4"
2929
parking_lot = "0.12"

benchmark/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ futures-executor = "0.3"
1818
futures-util = { version = "0.3", default-features = false, features = ["std", "sink"] }
1919
libc = "0.2"
2020
grpcio-sys = { path = "../grpc-sys" }
21-
rand = "0.7"
22-
rand_distr = "0.2"
23-
rand_xorshift = "0.2"
21+
rand = "0.8"
22+
rand_distr = "0.4"
23+
rand_xorshift = "0.3"
2424
futures-timer = "3.0"
25-
clap = "2.23"
25+
clap = "4.5"
2626
log = "0.4"
2727
slog = "2.0"
2828
slog-async = "2.1"

benchmark/src/main.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,27 @@ use std::env;
99
use std::sync::Arc;
1010

1111
use benchmark::{init_log, Worker};
12-
use clap::{App, Arg};
12+
use clap::Parser;
1313
use futures_channel::oneshot;
1414
use grpc::{Environment, ServerBuilder, ServerCredentials};
1515
use grpc_proto::testing::services_grpc::create_worker_service;
1616
use rand::Rng;
1717

1818
const LOG_FILE: &str = "GRPCIO_BENCHMARK_LOG_FILE";
1919

20+
/// Benchmark QpsWorker
21+
///
22+
/// ref http://www.grpc.io/docs/guides/benchmarking.html.
23+
#[derive(Parser)]
24+
struct WorkerCli {
25+
/// The port the worker should listen on. For example, 8080
26+
#[arg(long)]
27+
driver_port: Option<u16>,
28+
}
29+
2030
fn main() {
21-
let matches = App::new("Benchmark QpsWorker")
22-
.about("ref http://www.grpc.io/docs/guides/benchmarking.html")
23-
.arg(
24-
Arg::with_name("port")
25-
.long("driver_port")
26-
.help("The port the worker should listen on. For example, \"8080\"")
27-
.takes_value(true),
28-
)
29-
.get_matches();
30-
let port: u16 = matches.value_of("port").unwrap_or("8080").parse().unwrap();
31+
let cli = WorkerCli::parse();
32+
let port = cli.driver_port.unwrap_or(8080);
3133

3234
let _log_guard = init_log(
3335
env::var(LOG_FILE)

compiler/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ prost-codec = ["prost-build", "prost-types", "prost", "derive-new", "tempfile"]
1818

1919
[dependencies]
2020
protobuf = { version = "2", optional = true }
21-
prost = { version = "0.11", optional = true }
22-
prost-build = { version = "0.11", optional = true }
23-
prost-types = { version = "0.11", optional = true }
24-
derive-new = { version = "0.5", optional = true }
21+
prost = { version = "0.12", optional = true }
22+
prost-build = { version = "0.12", optional = true }
23+
prost-types = { version = "0.12", optional = true }
24+
derive-new = { version = "0.6", optional = true }
2525
tempfile = { version = "3.0", optional = true }
2626

2727
[[bin]]

grpc-sys/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ _gen-bindings = ["bindgen"]
6868
_list-package = []
6969

7070
[target.'cfg(not(all(any(target_os = "linux", target_os = "macos"), any(target_arch = "x86_64", target_arch = "aarch64"))))'.build-dependencies]
71-
bindgen = "0.59.0"
71+
bindgen = { version = "0.69.0", default-features = false, features = ["runtime"] }
7272

7373
[build-dependencies]
7474
cc = "1.0"
7575
cmake = "0.1"
7676
pkg-config = "0.3"
7777
walkdir = "2.2.9"
7878
# Because of rust-lang/cargo#5237, bindgen should not be upgraded util a minor or major release.
79-
bindgen = { version = "0.59.0", default-features = false, optional = true, features = ["runtime"] }
79+
bindgen = { version = "0.69.0", default-features = false, optional = true, features = ["runtime"] }
8080
boringssl-src = { version = "0.6.0", optional = true }

grpc-sys/bindings/bindings.rs

Lines changed: 377 additions & 1434 deletions
Large diffs are not rendered by default.

grpc-sys/build.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ fn build_grpc(cc: &mut cc::Build, library: &str) {
300300

301301
fn figure_systemd_path(build_dir: &str) {
302302
let path = format!("{build_dir}/CMakeCache.txt");
303-
let f = BufReader::new(std::fs::File::open(&path).unwrap());
303+
let f = BufReader::new(std::fs::File::open(path).unwrap());
304304
let mut libdir: Option<String> = None;
305305
let mut libname: Option<String> = None;
306306
for l in f.lines() {
@@ -444,7 +444,6 @@ fn bindgen_grpc(file_path: &Path) {
444444
.clang_arg("-xc++")
445445
.clang_arg("-I./grpc/include")
446446
.clang_arg("-std=c++11")
447-
.rustfmt_bindings(true)
448447
.impl_debug(true)
449448
.size_t_is_usize(true)
450449
.disable_header_comment()

grpc-sys/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ mod bindings {
1010
mod grpc_wrap;
1111

1212
pub use bindings::*;
13-
pub use grpc_wrap::*;

health/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ prost-codec = ["grpcio/prost-codec", "prost"]
2222
futures-executor = "0.3"
2323
futures-util = { version = "0.3", default-features = false, features = ["std"] }
2424
grpcio = { path = "..", version = "0.13.0", default-features = false }
25-
prost = { version = "0.11", optional = true }
25+
prost = { version = "0.12", optional = true }
2626
protobuf = { version = "2", optional = true }
2727
protobufv3 = { package = "protobuf", version = "3.2", optional = true }
2828
log = "0.4"

health/src/proto.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ mod protobuf_v3 {
2222
#[cfg(feature = "protobuf-codec")]
2323
mod reexports {
2424
pub use super::protobuf::health::*;
25-
pub use super::protobuf::health_grpc::*;
25+
// Following is included in health import above.
26+
// pub use super::protobuf::health_grpc::*;
2627
}
2728
#[cfg(feature = "protobufv3-codec")]
2829
mod reexports {

health/src/proto/prost/grpc.health.v1.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// This file is @generated by prost-build.
12
#[allow(clippy::derive_partial_eq_without_eq)]
23
#[derive(Clone, PartialEq, ::prost::Message)]
34
pub struct HealthCheckRequest {

health/src/proto/protobuf_v3/health.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file is generated by rust-protobuf 3.2.0. Do not edit
1+
// This file is generated by rust-protobuf 3.4.0. Do not edit
22
// @generated
33

44
// https://github.com/rust-lang/rust-clippy/issues/702
@@ -22,10 +22,10 @@
2222
2323
/// Generated files are compatible only with the same version
2424
/// of protobuf runtime.
25-
const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0;
25+
const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_4_0;
2626

27-
#[derive(PartialEq,Clone,Default,Debug)]
2827
// @@protoc_insertion_point(message:grpc.health.v1.HealthCheckRequest)
28+
#[derive(PartialEq,Clone,Default,Debug)]
2929
pub struct HealthCheckRequest {
3030
// message fields
3131
// @@protoc_insertion_point(field:grpc.health.v1.HealthCheckRequest.service)
@@ -146,8 +146,8 @@ impl ::protobufv3::reflect::ProtobufValue for HealthCheckRequest {
146146
type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage<Self>;
147147
}
148148

149-
#[derive(PartialEq,Clone,Default,Debug)]
150149
// @@protoc_insertion_point(message:grpc.health.v1.HealthCheckResponse)
150+
#[derive(PartialEq,Clone,Default,Debug)]
151151
pub struct HealthCheckResponse {
152152
// message fields
153153
// @@protoc_insertion_point(field:grpc.health.v1.HealthCheckResponse.status)
@@ -300,6 +300,16 @@ pub mod health_check_response {
300300
}
301301
}
302302

303+
fn from_str(str: &str) -> ::std::option::Option<ServingStatus> {
304+
match str {
305+
"Unknown" => ::std::option::Option::Some(ServingStatus::Unknown),
306+
"Serving" => ::std::option::Option::Some(ServingStatus::Serving),
307+
"NotServing" => ::std::option::Option::Some(ServingStatus::NotServing),
308+
"ServiceUnknown" => ::std::option::Option::Some(ServingStatus::ServiceUnknown),
309+
_ => ::std::option::Option::None
310+
}
311+
}
312+
303313
const VALUES: &'static [ServingStatus] = &[
304314
ServingStatus::Unknown,
305315
ServingStatus::Serving,

interop/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ protobufv3 = { package = "protobuf", version = "3.2", optional = true }
1818
futures-executor = "0.3"
1919
futures-util = { version = "0.3", default-features = false, features = ["std"] }
2020
log = "0.4"
21-
clap = "2.23"
21+
clap = { version = "4.5", features = ["derive"] }
2222
futures-timer = "3.0"
2323

2424
[[bin]]

interop/src/bin/client.rs

Lines changed: 33 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -7,67 +7,44 @@ extern crate interop;
77

88
use crate::grpc::{ChannelBuilder, ChannelCredentialsBuilder, Environment};
99
use crate::grpc_proto::util;
10-
use clap::{App, Arg};
10+
use clap::Parser;
1111
use std::sync::Arc;
1212

1313
use interop::Client;
1414

15+
/// Interoperability Test Client
16+
///
17+
/// ref https://github.com/grpc/grpc/blob/v1.3.x/doc/interop-test-descriptions.md.
18+
#[derive(Parser)]
19+
struct ClientCli {
20+
/// The server host to connect to. For example, "localhost" or "127.0.0.1"
21+
#[arg(long)]
22+
host: Option<String>,
23+
/// The server host client pretend to connect. It's used for testing SSL/TLS to an arbitrary host.
24+
#[arg(long)]
25+
host_override: Option<String>,
26+
/// The server port to connect to. For example, 8080
27+
#[arg(long)]
28+
port: Option<u16>,
29+
/// The name of the test case to execute. For example, "empty_unary"
30+
#[arg(long)]
31+
case: Option<String>,
32+
/// Whether to use a plaintext or encrypted connection
33+
#[arg(long)]
34+
use_tls: Option<bool>,
35+
/// Whether to replace platform root CAs with ca.pem as the CA root
36+
#[arg(long)]
37+
use_test_ca: Option<bool>,
38+
}
39+
1540
fn main() {
16-
let matches = App::new("Interoperability Test Client")
17-
.about("ref https://github.com/grpc/grpc/blob/v1.3.x/doc/interop-test-descriptions.md")
18-
.arg(
19-
Arg::with_name("host")
20-
.long("server_host")
21-
.help("The server host to connect to. For example, \"localhost\" or \"127.0.0.1\"")
22-
.takes_value(true),
23-
)
24-
.arg(
25-
Arg::with_name("host_override")
26-
.long("server_host_override")
27-
.help("The server host to connect to. For example, \"localhost\" or \"127.0.0.1\"")
28-
.takes_value(true),
29-
)
30-
.arg(
31-
Arg::with_name("port")
32-
.long("server_port")
33-
.help("The server port to connect to. For example, \"8080\"")
34-
.takes_value(true),
35-
)
36-
.arg(
37-
Arg::with_name("case")
38-
.long("test_case")
39-
.help("The name of the test case to execute. For example, \"empty_unary\"")
40-
.takes_value(true),
41-
)
42-
.arg(
43-
Arg::with_name("use_tls")
44-
.long("use_tls")
45-
.help("Whether to use a plaintext or encrypted connection")
46-
.takes_value(true),
47-
)
48-
.arg(
49-
Arg::with_name("use_test_ca")
50-
.long("use_test_ca")
51-
.help("Whether to replace platform root CAs with ca.pem as the CA root")
52-
.takes_value(true),
53-
)
54-
.get_matches();
55-
let host = matches.value_of("host").unwrap_or("127.0.0.1");
56-
let host_override = matches
57-
.value_of("host_override")
58-
.unwrap_or("foo.test.google.fr");
59-
let port = matches.value_of("port").unwrap_or("8080");
60-
let case = matches.value_of("case");
61-
let use_tls: bool = matches
62-
.value_of("use_tls")
63-
.unwrap_or("false")
64-
.parse()
65-
.unwrap();
66-
let use_test_ca: bool = matches
67-
.value_of("use_test_ca")
68-
.unwrap_or("false")
69-
.parse()
70-
.unwrap();
41+
let cli = ClientCli::parse();
42+
let host = cli.host.as_deref().unwrap_or("127.0.0.1");
43+
let host_override = cli.host_override.as_deref().unwrap_or("foo.test.google.fr");
44+
let port = cli.port.unwrap_or(8080);
45+
let case = cli.case.as_deref();
46+
let use_tls = cli.use_tls.unwrap_or(false);
47+
let use_test_ca = cli.use_test_ca.unwrap_or(false);
7148

7249
let env = Arc::new(Environment::new(1));
7350
let mut builder = ChannelBuilder::new(env).override_ssl_target(host_override.to_owned());

interop/src/bin/server.rs

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,34 @@ extern crate log;
77

88
use std::sync::Arc;
99

10-
use clap::{App, Arg};
10+
use clap::Parser;
1111
use futures_executor::block_on;
1212
use grpc::{Environment, ServerBuilder, ServerCredentials};
1313
use grpc_proto::testing::test_grpc::create_test_service;
1414
use grpc_proto::util;
1515
use interop::InteropTestService;
1616

17+
/// Interoperability Test Server
18+
///
19+
/// ref https://github.com/grpc/grpc/blob/v1.3.x/doc/interop-test-descriptions.md.
20+
#[derive(Parser)]
21+
struct ServerCli {
22+
/// The server host to listen to. For example, "localhost" or "127.0.0.1"
23+
#[arg(long)]
24+
host: Option<String>,
25+
/// The port to listen on. For example, 8080
26+
#[arg(long)]
27+
port: Option<u16>,
28+
/// Whether to use a plaintext or encrypted connection
29+
#[arg(long)]
30+
use_tls: Option<bool>,
31+
}
32+
1733
fn main() {
18-
let matches = App::new("Interoperability Test Server")
19-
.about("ref https://github.com/grpc/grpc/blob/v1.3.x/doc/interop-test-descriptions.md")
20-
.arg(
21-
Arg::with_name("host")
22-
.long("host")
23-
.help("The server host to listen to. For example, \"localhost\" or \"127.0.0.1\"")
24-
.takes_value(true),
25-
)
26-
.arg(
27-
Arg::with_name("port")
28-
.long("port")
29-
.help("The port to listen on. For example, \"8080\"")
30-
.takes_value(true),
31-
)
32-
.arg(
33-
Arg::with_name("use_tls")
34-
.long("use_tls")
35-
.help("Whether to use a plaintext or encrypted connection")
36-
.takes_value(true),
37-
)
38-
.get_matches();
39-
let host = matches.value_of("host").unwrap_or("127.0.0.1");
40-
let mut port: u16 = matches.value_of("port").unwrap_or("8080").parse().unwrap();
41-
let use_tls: bool = matches
42-
.value_of("use_tls")
43-
.unwrap_or("false")
44-
.parse()
45-
.unwrap();
34+
let cli = ServerCli::parse();
35+
let host = cli.host.as_deref().unwrap_or("127.0.0.1");
36+
let mut port: u16 = cli.port.unwrap_or(8080);
37+
let use_tls: bool = cli.use_tls.unwrap_or(false);
4638

4739
let env = Arc::new(Environment::new(2));
4840
let service = create_test_service(InteropTestService);

interop/src/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl Client {
8080

8181
pub async fn server_streaming(&self) -> grpcio::Result<()> {
8282
print!("testing server streaming ... ");
83-
let sizes = vec![31415, 9, 2653, 58979];
83+
let sizes = [31415, 9, 2653, 58979];
8484
let req = StreamingOutputCallRequest {
8585
response_parameters: sizes
8686
.iter()

interop/src/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ impl TestService for InteropTestService {
167167
}
168168

169169
let mut resp = StreamingOutputCallResponse::default();
170-
if let Some(param) = req.response_parameters.get(0) {
170+
if let Some(param) = req.response_parameters.first() {
171171
resp.payload = Some(util::new_payload(param.size as usize)).into();
172172
}
173173
// A workaround for timeout_on_sleeping_server test.

proto/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ prost-codec = ["prost-build", "prost-derive", "prost-types", "bytes", "lazy_stat
2020
[dependencies]
2121
grpcio = { path = "..", features = ["boringssl"], version = "0.13.0", default-features = false }
2222
bytes = { version = "1.0", optional = true }
23-
prost = { version = "0.11", optional = true }
24-
prost-derive = { version = "0.11", optional = true }
25-
prost-types = { version = "0.11", optional = true }
23+
prost = { version = "0.12", optional = true }
24+
prost-derive = { version = "0.12", optional = true }
25+
prost-types = { version = "0.12", optional = true }
2626
protobuf = { version = "2", optional = true }
2727
protobufv3 = { package = "protobuf", version = "3.2", optional = true }
2828
lazy_static = { version = "1.3", optional = true }
2929

3030
[build-dependencies]
31-
prost-build = { version = "0.11", optional = true }
31+
prost-build = { version = "0.12", optional = true }
3232
walkdir = "2.2"

0 commit comments

Comments
 (0)