Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tenderdash-abci): ensure crate features build without default features #39

Merged
merged 3 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[workspace]

resolver = "2"
members = ["abci", "proto-compiler", "proto"]
1 change: 1 addition & 0 deletions abci/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use std::io;
pub use application::{check_version, Application, RequestDispatcher};
use prost::{DecodeError, EncodeError};
#[allow(deprecated)]
#[cfg(feature = "server")]
pub use server::{start_server, CancellationToken, Server, ServerBuilder};
pub use tenderdash_proto as proto;

Expand Down
15 changes: 10 additions & 5 deletions abci/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,25 @@
mod codec;
mod generic;

#[cfg(feature = "tcp")]
use std::{
net::{IpAddr, SocketAddr, SocketAddrV4, SocketAddrV6},
str::FromStr,
};

use tokio::{
net::{TcpListener, UnixListener},
runtime::{Handle, Runtime},
};
#[cfg(feature = "tcp")]
use tokio::net::TcpListener;
#[cfg(feature = "unix")]
use tokio::net::UnixListener;
use tokio::runtime::{Handle, Runtime};
pub use tokio_util::sync::CancellationToken;

use self::generic::GenericServer;
use crate::{application::RequestDispatcher, Error};

#[cfg(not(any(feature = "tcp", feature = "unix")))]
compile_error!("At least one of `tcp` or `unix` features must be enabled");

/// ABCI Server handle.
///
/// Use [`Server::handle_connection()`] to accept connection and process all
Expand Down Expand Up @@ -247,7 +252,7 @@ where
{
ServerBuilder::new(app, bind_address.as_ref()).build()
}

#[cfg(feature = "tcp")]
fn parse_tcp_uri(uri: url::Url) -> SocketAddr {
let host = uri.host_str().unwrap();
// remove '[' and ']' from ipv6 address, as per https://github.com/servo/rust-url/issues/770
Expand Down
16 changes: 10 additions & 6 deletions abci/src/server/generic.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
//! Generic ABCI server
#[cfg(feature = "tcp")]
use std::net::ToSocketAddrs;
use std::{fmt::Debug, sync::Arc};
#[cfg(feature = "unix")]
use std::{fs, path::Path};

use std::{fmt::Debug, fs, net::ToSocketAddrs, path::Path, sync::Arc};

use tokio::{
net::{TcpListener, UnixListener},
sync::Mutex,
};
#[cfg(feature = "tcp")]
use tokio::net::TcpListener;
#[cfg(feature = "unix")]
use tokio::net::UnixListener;
use tokio::sync::Mutex;
use tokio_util::net::Listener;
use tracing::info;

Expand Down
4 changes: 3 additions & 1 deletion proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ description = """
all-features = true

[dependencies]
prost = { version = "0.12", default-features = false }
prost = { version = "0.12", default-features = false, features = [
"prost-derive",
] }
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 = [
Expand Down
Loading