From 1e9689df2c0dafb65ed636a67bac460de22c2b26 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Fri, 1 Mar 2024 16:36:22 +0100 Subject: [PATCH] chore: self review, simplify features --- abci/Cargo.toml | 10 +++++++++- abci/tests/grpc.rs | 2 +- proto/Cargo.toml | 11 ++++++++++- proto/build.rs | 3 --- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/abci/Cargo.toml b/abci/Cargo.toml index 8fd7b4f..6b9a7b1 100644 --- a/abci/Cargo.toml +++ b/abci/Cargo.toml @@ -11,7 +11,15 @@ description = """tenderdash-abci provides a simple framework with which to build low-level applications on top of Tenderdash.""" [features] -default = ["server", "docker-tests", "crypto", "tcp", "unix", "tracing-span"] +default = [ + "server", + "docker-tests", + "crypto", + "tcp", + "unix", + "grpc", + "tracing-span", +] # docker-tests includes integration tests that require docker to be available docker-tests = ["server"] server = [ diff --git a/abci/tests/grpc.rs b/abci/tests/grpc.rs index 9d4a1ce..f0ce962 100644 --- a/abci/tests/grpc.rs +++ b/abci/tests/grpc.rs @@ -21,7 +21,7 @@ use tenderdash_abci::proto; use tonic::{async_trait, Response, Status}; #[cfg(feature = "docker-tests")] -#[tokio::test(flavor = "multi_thread", worker_threads = 4)] +#[tokio::test] /// Test server listening on ipv4 address. /// /// See [tcp_server_test()]. diff --git a/proto/Cargo.toml b/proto/Cargo.toml index a9851d2..edc7a12 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -16,6 +16,14 @@ description = """ all-features = true [features] +# Features configuration. +# +# Note that, due to the way build.rs scripts work, change of features does not trigger +# regeneration of protobuf files. This means you need to be extra careful when changing +# features, as you might end up with outdated and/or conflicting generated files. +# +# Sometimes cleaning the build cache with `cargo clean` might be necessary to solve +# issues related to outdated generated files. default = ["grpc"] # Enable standard library support @@ -25,6 +33,7 @@ grpc = [ "std", "tenderdash-proto-compiler/server", "tenderdash-proto-compiler/client", + "dep:tonic", ] [dependencies] @@ -32,7 +41,7 @@ prost = { version = "0.12", default-features = false, features = [ "prost-derive", ] } prost-types = { version = "0.12", default-features = false } -tonic = { version = "0.11" } +tonic = { version = "0.11", optional = true } bytes = { version = "1.0", default-features = false, features = ["serde"] } serde = { version = "1.0", default-features = false, features = ["derive"] } subtle-encoding = { version = "0.5", default-features = false, features = [ diff --git a/proto/build.rs b/proto/build.rs index d29a2f8..80894aa 100644 --- a/proto/build.rs +++ b/proto/build.rs @@ -16,7 +16,4 @@ fn main() { println!("cargo:rerun-if-changed=Cargo.toml"); println!("cargo:rerun-if-env-changed=CARGO_PKG_VERSION"); println!("cargo:rerun-if-env-changed=TENDERDASH_COMMITISH"); - println!("cargo:rerun-if-env-changed=CARGO_FEATURE_STD"); - println!("cargo:rerun-if-env-changed=CARGO_FEATURE_GRPC_SERVER"); - println!("cargo:rerun-if-env-changed=CARGO_FEATURE_GRPC_CLIENT"); }