Skip to content

Commit d1ffa4e

Browse files
committed
update prost to 0.12
update bindgen to 0.69 to keep compatible with latest llvm update rand to 0.8 update clap to 4 Signed-off-by: Jay Lee <[email protected]>
1 parent c90eb78 commit d1ffa4e

File tree

20 files changed

+475
-1557
lines changed

20 files changed

+475
-1557
lines changed

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+
deriver_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.deriver_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: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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()

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/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 {

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);

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"

proto/src/proto/prost/example/helloworld.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
/// The request message containing the user's name.
23
#[allow(clippy::derive_partial_eq_without_eq)]
34
#[derive(Clone, PartialEq, ::prost::Message)]

proto/src/proto/prost/example/routeguide.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
/// Points are represented as latitude-longitude pairs in the E7 representation
23
/// (degrees multiplied by 10**7 and rounded to the nearest integer).
34
/// Latitudes should be in the range +/- 90 degrees and longitude should be in

proto/src/proto/prost/google/rpc/google.rpc.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
// This file is @generated by prost-build.
12
/// The `Status` type defines a logical error model that is suitable for different
23
/// programming environments, including REST APIs and RPC APIs. It is used by
3-
/// \[gRPC\](<https://github.com/grpc>). The error model is designed to be:
4+
/// [gRPC](<https://github.com/grpc>). The error model is designed to be:
45
///
56
/// - Simple to use and understand for most users
67
/// - Flexible enough to meet unexpected needs
@@ -9,7 +10,7 @@
910
///
1011
/// The `Status` message contains three pieces of data: error code, error message,
1112
/// and error details. The error code should be an enum value of
12-
/// \[google.rpc.Code][google.rpc.Code\], but it may accept additional error codes if needed. The
13+
/// [google.rpc.Code][google.rpc.Code], but it may accept additional error codes if needed. The
1314
/// error message should be a developer-facing English message that helps
1415
/// developers *understand* and *resolve* the error. If a localized user-facing
1516
/// error message is needed, put the localized message in the error details or
@@ -53,12 +54,12 @@
5354
#[allow(clippy::derive_partial_eq_without_eq)]
5455
#[derive(Clone, PartialEq, ::prost::Message)]
5556
pub struct Status {
56-
/// The status code, which should be an enum value of \[google.rpc.Code][google.rpc.Code\].
57+
/// The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
5758
#[prost(int32, tag = "1")]
5859
pub code: i32,
5960
/// A developer-facing error message, which should be in English. Any
6061
/// user-facing error message should be localized and sent in the
61-
/// \[google.rpc.Status.details][google.rpc.Status.details\] field, or localized by the client.
62+
/// [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
6263
#[prost(string, tag = "2")]
6364
pub message: ::prost::alloc::string::String,
6465
/// A list of messages that carry the error details. There will be a

proto/src/proto/prost/testing/grpc.testing.rs

Lines changed: 2 additions & 1 deletion
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 ByteBufferParams {
@@ -193,7 +194,7 @@ pub struct ClientConfig {
193194
#[prost(int32, tag = "4")]
194195
pub outstanding_rpcs_per_channel: i32,
195196
/// Number of independent client channels to create.
196-
/// i-th channel will connect to server_target[i % server_targets.size()]
197+
/// i-th channel will connect to server_target\[i % server_targets.size()\]
197198
#[prost(int32, tag = "5")]
198199
pub client_channels: i32,
199200
/// Only for async client. Number of threads to use to start/manage RPCs.

tests-and-examples/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ futures-util = { version = "0.3", features = ["sink"] }
2020
futures-timer = "3.0"
2121
protobuf = { version = "2", optional = true }
2222
protobufv3 = { package = "protobuf", version = "3.2", optional = true }
23-
prost = { version = "0.11", optional = true }
23+
prost = { version = "0.12", optional = true }
2424
bytes = { version = "1.0", optional = true }
2525
log = "0.4"
2626
grpcio = { path = "..", default-features = false, features = ["boringssl"] }
@@ -31,7 +31,7 @@ serde_json = "1.0"
3131
serde = "1.0"
3232
serde_derive = "1.0"
3333
grpcio-proto = { path = "../proto", default-features = false }
34-
rand = "0.7"
34+
rand = "0.8"
3535
slog = "2.0"
3636
slog-async = "2.1"
3737
slog-stdlog = "4.0"

tests-and-examples/examples/route_guide/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ async fn record_route(client: &RouteGuideClient) -> Result<()> {
9494
let point = f.location.0.clone().unwrap().as_ref().clone();
9595
info!("Visiting {}", util::format_point(&point));
9696
sink.send((point, WriteFlags::default())).await?;
97-
thread::sleep(Duration::from_millis(rng.gen_range(500, 1500)));
97+
thread::sleep(Duration::from_millis(rng.gen_range(500..1500)));
9898
}
9999
// flush
100100
sink.close().await?;

0 commit comments

Comments
 (0)