Skip to content

Commit

Permalink
Upgrade prost & tonic
Browse files Browse the repository at this point in the history
Updates prost and tonic. These had some breaking changes that I
wanted to checkin since they were not trivial and spent the time
now to resolve the issues.
  • Loading branch information
allada committed Apr 19, 2022
1 parent cf6dd3d commit baad561
Show file tree
Hide file tree
Showing 54 changed files with 2,802 additions and 1,740 deletions.
147 changes: 128 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 10 additions & 6 deletions Cargo.toml
Expand Up @@ -8,16 +8,16 @@ version = "0.0.0"
path = "needed_only_to_make_cargo_tooling_happy.rs"

[dependencies]
prost = "0.9.0"
prost-types = "0.9.0"
prost = "0.10.1"
prost-types = "0.10.1"
hex = "0.4.3"
async-trait = "0.1.51"
fixed-buffer = "0.2.3"
futures = "0.3.17"
tokio = { version = "1.13.0", features = ["macros", "io-util", "fs", "rt-multi-thread"] }
tokio-stream = { version = "0.1.8", features = ["fs", "sync"] }
tokio-util = { version = "0.6.9", features = ["io", "io-util"] }
tonic = "0.6.1"
tokio-util = { version = "0.6.9", features = ["io", "io-util", "codec"] }
tonic = "0.7.1"
lazy-init = "0.5.0"
log = "0.4.14"
env_logger = "0.9.0"
Expand Down Expand Up @@ -45,8 +45,8 @@ shlex = "1.1.0"

[dev-dependencies]
stdext = "0.2.1"
prost-build = "0.9.0"
tonic-build = "0.6.0"
prost-build = "0.10.1"
tonic-build = "0.7.0"
pretty_assertions = "0.7.2"
# Crates.io does not have `rustfmt` that is sufficient version, so load from github directly.
rustfmt-nightly = { git = "https://github.com/rust-lang/rustfmt", tag = "v1.4.38" }
Expand All @@ -71,6 +71,10 @@ compile_data_attr = "['README.md']"
gen_buildrs = true
additional_deps = ["@com_google_protobuf//:protoc"]
additional_env = { PROTOC = "bazel-out/host/bin/external/com_google_protobuf/protoc" }
buildrs_additional_environment_variables = { PROTOC = "bazel-out/host/bin/external/com_google_protobuf/protoc", PROTOC_NO_VENDOR = "1" }

[package.metadata.raze.crates.axum.'*']
compile_data_attr = "glob(['**/*.md'])"

[package.metadata.raze.crates.rustfmt-nightly.'*']
gen_buildrs = true
Expand Down
9 changes: 5 additions & 4 deletions proto/BUILD
Expand Up @@ -12,7 +12,8 @@ load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library")

_proto_files = glob(["**/*.proto"])
_proto_base_files = depset(['.'.join(file[:-len(".proto")].split('/')[:-1]) for file in _proto_files]).to_list()
_genproto_files = ["%s.pb.rs" % pkg for pkg in _proto_base_files]
_proto_base_files_without_google = [name for name in _proto_base_files if name != "google.protobuf"]
_genproto_files = ["%s.pb.rs" % pkg for pkg in _proto_base_files_without_google]

_checked_in_proto_files = ["genproto/%s" % file for file in _genproto_files]

Expand Down Expand Up @@ -46,7 +47,7 @@ genrule(
"$(execpath :gen_protos_tool) --output_dir $(RULEDIR) " + " ".join([
("--input $(location :%s)" % file) for file in _proto_files
]),
] + ["mv $(RULEDIR)/{name}.rs $(RULEDIR)/{name}.pb.rs".format(name=name) for name in _proto_base_files]),
] + ["mv $(RULEDIR)/{name}.rs $(RULEDIR)/{name}.pb.rs".format(name=name) for name in _proto_base_files_without_google]),
tools = [
":gen_protos_tool",
"@com_google_protobuf//:protoc",
Expand Down Expand Up @@ -85,7 +86,7 @@ rust_library(
py_binary(
name = "update_protos",
srcs = ["update_protos.py"],
args = ["--update"] + _proto_base_files,
args = ["--update"] + _proto_base_files_without_google,
data = _genproto_files,
python_version = "PY3",
srcs_version = "PY3",
Expand All @@ -95,7 +96,7 @@ py_binary(
py_test(
name = "update_protos_test",
srcs = ["update_protos.py"],
args = ["--check"] + _proto_base_files,
args = ["--check"] + _proto_base_files_without_google,
data = _genproto_files + glob(_checked_in_proto_files),
main = "update_protos.py",
python_version = "PY3",
Expand Down
1 change: 0 additions & 1 deletion proto/gen_protos_tool.rs
Expand Up @@ -32,7 +32,6 @@ fn main() -> std::io::Result<()> {
config.bytes(&["."]);
tonic_build::configure()
.out_dir(&output_dir)
.format(true) // don't run `rustfmt`; shouldn't be needed to build
.compile_with_config(config, &paths, &["proto"])?;
Ok(())
}

0 comments on commit baad561

Please sign in to comment.