diff --git a/Cargo.toml b/Cargo.toml index 02b7070f7..9d72a15c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,8 +27,8 @@ ethcore = { path = "ethcore" } ethcore-util = { path = "util" } ethsync = { path = "sync" } ethcore-devtools = { path = "devtools" } -ethcore-rpc = { path = "rpc", optional = true } -ethcore-signer = { path = "signer", optional = true } +ethcore-rpc = { path = "rpc" } +ethcore-signer = { path = "signer" } ethcore-dapps = { path = "dapps", optional = true } semver = "0.2" ethcore-ipc-nano = { path = "ipc/nano" } @@ -48,8 +48,7 @@ version = "0.8" default-features = false [features] -default = ["rpc", "dapps", "ethcore-signer"] -rpc = ["ethcore-rpc"] +default = ["dapps"] dapps = ["ethcore-dapps"] dev = ["clippy", "ethcore/dev", "ethcore-util/dev", "ethsync/dev", "ethcore-rpc/dev", "ethcore-dapps/dev", "ethcore-signer/dev"] diff --git a/parity/main.rs b/parity/main.rs index dc7f7e352..f1f018cc2 100644 --- a/parity/main.rs +++ b/parity/main.rs @@ -46,16 +46,14 @@ extern crate hyper; // for price_info.rs extern crate json_ipc_server as jsonipc; extern crate ethcore_ipc_hypervisor as hypervisor; - -#[cfg(feature = "rpc")] extern crate ethcore_rpc; +extern crate ethcore_signer; +extern crate ansi_term; + #[cfg(feature = "dapps")] extern crate ethcore_dapps; -#[cfg(feature = "ethcore-signer")] -extern crate ethcore_signer; - #[macro_use] mod die; mod upgrade; diff --git a/parity/rpc.rs b/parity/rpc.rs index df1e14524..7317aa2e6 100644 --- a/parity/rpc.rs +++ b/parity/rpc.rs @@ -24,12 +24,8 @@ use jsonipc; use rpc_apis; use std::fmt; -#[cfg(feature = "rpc")] pub use ethcore_rpc::Server as RpcServer; -#[cfg(feature = "rpc")] use ethcore_rpc::{RpcServerError, RpcServer as Server}; -#[cfg(not(feature = "rpc"))] -pub struct RpcServer; pub struct HttpConfiguration { pub enabled: bool, @@ -79,17 +75,6 @@ fn setup_rpc_server(apis: Vec<&str>, deps: &Dependencies) -> Server { rpc_apis::setup_rpc(server, deps.apis.clone(), rpc_apis::ApiSet::List(apis)) } -#[cfg(not(feature = "rpc"))] -pub fn setup_http_rpc_server( - _deps: &Dependencies, - _url: &SocketAddr, - _cors_domain: Vec, - _apis: Vec<&str>, -) -> ! { - die!("Your Parity version has been compiled without JSON-RPC support.") -} - -#[cfg(feature = "rpc")] pub fn setup_http_rpc_server( dependencies: &Dependencies, url: &SocketAddr, @@ -111,18 +96,12 @@ pub fn setup_http_rpc_server( } } -#[cfg(not(feature = "rpc"))] -pub fn setup_ipc_rpc_server(_dependencies: &Dependencies, _addr: &str, _apis: Vec<&str>) -> ! { - die!("Your Parity version has been compiled without JSON-RPC support.") -} - pub fn new_ipc(conf: IpcConfiguration, deps: &Dependencies) -> Option { if !conf.enabled { return None; } let apis = conf.apis.split(',').collect(); Some(setup_ipc_rpc_server(deps, &conf.socket_addr, apis)) } -#[cfg(feature = "rpc")] pub fn setup_ipc_rpc_server(dependencies: &Dependencies, addr: &str, apis: Vec<&str>) -> jsonipc::Server { let server = setup_rpc_server(apis, dependencies); match server.start_ipc(addr) { diff --git a/parity/rpc_apis.rs b/parity/rpc_apis.rs index 7606ccd0b..16ba2e8cb 100644 --- a/parity/rpc_apis.rs +++ b/parity/rpc_apis.rs @@ -25,13 +25,8 @@ use util::RotatingLogger; use ethcore::account_provider::AccountProvider; use util::network_settings::NetworkSettings; -#[cfg(feature="rpc")] pub use ethcore_rpc::ConfirmationsQueue; -#[cfg(not(feature="rpc"))] -#[derive(Default)] -pub struct ConfirmationsQueue; -#[cfg(feature="rpc")] use ethcore_rpc::Extendable; pub enum Api { diff --git a/parity/signer.rs b/parity/signer.rs index 5c3379592..8cc63a857 100644 --- a/parity/signer.rs +++ b/parity/signer.rs @@ -15,23 +15,19 @@ // along with Parity. If not, see . use std::io; -use std::path::PathBuf; use std::sync::Arc; -use util::{Colour, Applyable}; -use util::panics::{PanicHandler, ForwardPanic}; +use std::path::PathBuf; +use ansi_term::Colour; +use util::panics::{ForwardPanic, PanicHandler}; use util::path::restrict_permissions_owner; -use die::*; +use util::Applyable; use rpc_apis; - -const CODES_FILENAME: &'static str = "authcodes"; - -#[cfg(feature = "ethcore-signer")] use ethcore_signer as signer; -#[cfg(feature = "ethcore-signer")] +use die::*; + pub use ethcore_signer::Server as SignerServer; -#[cfg(not(feature = "ethcore-signer"))] -pub struct SignerServer; +const CODES_FILENAME: &'static str = "authcodes"; pub struct Configuration { pub enabled: bool, @@ -59,8 +55,6 @@ fn codes_path(path: String) -> PathBuf { p } - -#[cfg(feature = "ethcore-signer")] pub fn new_token(path: String) -> io::Result<()> { let path = codes_path(path); let mut codes = try!(signer::AuthCodes::from_file(&path)); @@ -70,7 +64,6 @@ pub fn new_token(path: String) -> io::Result<()> { Ok(()) } -#[cfg(feature = "ethcore-signer")] fn do_start(conf: Configuration, deps: Dependencies) -> SignerServer { let addr = format!("127.0.0.1:{}", conf.port).parse().unwrap_or_else(|_| { die!("Invalid port specified: {}", conf.port) @@ -95,13 +88,4 @@ fn do_start(conf: Configuration, deps: Dependencies) -> SignerServer { } } -#[cfg(not(feature = "ethcore-signer"))] -fn do_start(_conf: Configuration) -> ! { - die!("Your Parity version has been compiled without Trusted Signer support.") -} - -#[cfg(not(feature = "ethcore-signer"))] -pub fn new_token(_path: String) -> ! { - die!("Your Parity version has been compiled without Trusted Signer support.") -}