From 9299edfb02d48e1ec5cec9158508daf71c6cdca9 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Wed, 29 May 2019 17:59:52 +0100 Subject: [PATCH 1/4] Add http feature --- core-client/Cargo.toml | 3 ++- core-client/src/transports/mod.rs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core-client/Cargo.toml b/core-client/Cargo.toml index 764b01153..34b038747 100644 --- a/core-client/Cargo.toml +++ b/core-client/Cargo.toml @@ -20,11 +20,12 @@ categories = [ [features] tls = ["hyper-tls"] +http = ["hyper"] [dependencies] failure = "0.1" futures = "0.1.26" -hyper = "0.12" +hyper = { version = "0.12", optional = true } hyper-tls = { version = "0.3.2", optional = true } jsonrpc-core = { version = "11.0", path = "../core" } log = "0.4" diff --git a/core-client/src/transports/mod.rs b/core-client/src/transports/mod.rs index 09d1c408d..a43c1326c 100644 --- a/core-client/src/transports/mod.rs +++ b/core-client/src/transports/mod.rs @@ -6,6 +6,7 @@ use serde_json::Value; use crate::{RpcError, RpcMessage}; pub mod duplex; +#[cfg(feature = "http")] pub mod http; pub mod local; pub mod ws; From a4eddff16bca83268183c7d56c3c5f2fc77acad4 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Wed, 29 May 2019 18:14:04 +0100 Subject: [PATCH 2/4] Add ws feature --- core-client/Cargo.toml | 9 +++++++-- core-client/src/transports/mod.rs | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core-client/Cargo.toml b/core-client/Cargo.toml index 34b038747..e4a2e3d5f 100644 --- a/core-client/Cargo.toml +++ b/core-client/Cargo.toml @@ -21,6 +21,10 @@ categories = [ [features] tls = ["hyper-tls"] http = ["hyper"] +ws = [ + "websocket", + "tokio", +] [dependencies] failure = "0.1" @@ -31,14 +35,15 @@ jsonrpc-core = { version = "11.0", path = "../core" } log = "0.4" serde = "1.0" serde_json = "1.0" -tokio = "0.1" -websocket = "0.22" +tokio = { version = "0.1", optional = true } +websocket = { version = "0.22", optional = true } [dev-dependencies] assert_matches = "1.1" jsonrpc-http-server = { version = "11.0", path = "../http" } lazy_static = "1.0" env_logger = "0.6" +tokio = "0.1" [badges] travis-ci = { repository = "paritytech/jsonrpc", branch = "master"} diff --git a/core-client/src/transports/mod.rs b/core-client/src/transports/mod.rs index a43c1326c..943caf2ee 100644 --- a/core-client/src/transports/mod.rs +++ b/core-client/src/transports/mod.rs @@ -9,6 +9,7 @@ pub mod duplex; #[cfg(feature = "http")] pub mod http; pub mod local; +#[cfg(feature = "ws")] pub mod ws; pub use duplex::duplex; From e47b966c75e8c05d3b41f1671555feb33d834011 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Wed, 29 May 2019 20:02:02 +0100 Subject: [PATCH 3/4] Check core-client features in CI --- .travis.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3802e0424..78c9459c8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,8 +30,10 @@ before_script: - rustup component add rustfmt script: - - cargo build --all --features "$JSONRPC_CLIENT_FEATURES" - - cargo test --all --features "$JSONRPC_CLIENT_FEATURES" + - cargo build --all + - cargo test --all + - cargo build --manifest-path=core-client/Cargo.toml --features "$JSONRPC_CLIENT_FEATURES" + - cargo test --manifest-path=core-client/Cargo.toml --features "$JSONRPC_CLIENT_FEATURES" - | ([ $TRAVIS_RUST_VERSION = stable ] && cargo fmt --all -- --check) || true @@ -52,4 +54,6 @@ env: - secure: "QA4Rw78VSsP1vH2Yve1eAVpjG32HH9DZZ79xrhxZXp34wKoemp+aGqaFN/8uXPfsXshlYxtMCTT6M9OiWTTLvku5tI5kBsDneu8mLut7eBZHVniYSp2SbKpTeqfpGMDHoCR0WD9AlWDn9Elm6txbghXjrxhCMg8gkhhsLGnQt/ARFF1wRHnXT0TjJg8fQtd+/OK0TaRfknx1RptruaznxfUi3DBwzDdzaMMZfd3VjWR1hPFRpDSL0mM+l6OjNrLbCeiR//k3lV4rpIhedsz0ODjfW2Hdk63qCaLJsXCkG1Bcuf/FYbYC+osm5SrHhGA1j2EgazWcLA6Wkzt15KPOR/HirNj+PCiS0YbGKM5Ac5LT6m6q0iYSF/pq1+jDurcSwBwYrTOY6X2FZCZQBfTP/4qnSjWgGPOkzBSMS6BNEBDQZgdc3xCASXadj7waF4Y4UGD0bDPuBtXopI4ppKLqSa7CsvKz6TX2yW0UVgUuQ5/jz/S+fkcz74o016d5x027yjaxAu/Z8fQFLSaBtiFU8sBzA+MDU3apFgjsYXiaGYZ8gDrp7WjbfHNYfBAMEHHKY4toywB5Vi8zJxF+Wn1n4hkvb/kDqSV9giFmWEg321U+pAGNAH4yY25tIJqS8gT89cz4oQJp7aWjA3Ke01e104yqqZU+N+CSyZHEeksdPt8=" matrix: - JSONRPC_CLIENT_FEATURES='' - - JSONRPC_CLIENT_FEATURES='tls' + - JSONRPC_CLIENT_FEATURES='http, tls' + - JSONRPC_CLIENT_FEATURES='ws' + From 0af3379e2cdc92fbb87e5407df77452410d6aaa1 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 30 May 2019 08:41:55 +0100 Subject: [PATCH 4/4] Remove client features matrix, run tests directly Reduces number of builds --- .travis.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 78c9459c8..7a8b94ec9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,8 +32,9 @@ before_script: script: - cargo build --all - cargo test --all - - cargo build --manifest-path=core-client/Cargo.toml --features "$JSONRPC_CLIENT_FEATURES" - - cargo test --manifest-path=core-client/Cargo.toml --features "$JSONRPC_CLIENT_FEATURES" + - cargo test --manifest-path=core-client/Cargo.toml --features "http" + - cargo test --manifest-path=core-client/Cargo.toml --features "http, tls" + - cargo test --manifest-path=core-client/Cargo.toml --features "ws" - | ([ $TRAVIS_RUST_VERSION = stable ] && cargo fmt --all -- --check) || true @@ -42,7 +43,6 @@ after_success: | [ $TRAVIS_BRANCH = master ] && [ $TRAVIS_PULL_REQUEST = false ] && [ $TRAVIS_RUST_VERSION = stable ] && - [ $JSONRPC_CLIENT_FEATURES = '' ] && cargo doc --all --no-deps && echo '' > target/doc/index.html && pip install --user ghp-import && @@ -52,8 +52,4 @@ after_success: | env: global: - secure: "QA4Rw78VSsP1vH2Yve1eAVpjG32HH9DZZ79xrhxZXp34wKoemp+aGqaFN/8uXPfsXshlYxtMCTT6M9OiWTTLvku5tI5kBsDneu8mLut7eBZHVniYSp2SbKpTeqfpGMDHoCR0WD9AlWDn9Elm6txbghXjrxhCMg8gkhhsLGnQt/ARFF1wRHnXT0TjJg8fQtd+/OK0TaRfknx1RptruaznxfUi3DBwzDdzaMMZfd3VjWR1hPFRpDSL0mM+l6OjNrLbCeiR//k3lV4rpIhedsz0ODjfW2Hdk63qCaLJsXCkG1Bcuf/FYbYC+osm5SrHhGA1j2EgazWcLA6Wkzt15KPOR/HirNj+PCiS0YbGKM5Ac5LT6m6q0iYSF/pq1+jDurcSwBwYrTOY6X2FZCZQBfTP/4qnSjWgGPOkzBSMS6BNEBDQZgdc3xCASXadj7waF4Y4UGD0bDPuBtXopI4ppKLqSa7CsvKz6TX2yW0UVgUuQ5/jz/S+fkcz74o016d5x027yjaxAu/Z8fQFLSaBtiFU8sBzA+MDU3apFgjsYXiaGYZ8gDrp7WjbfHNYfBAMEHHKY4toywB5Vi8zJxF+Wn1n4hkvb/kDqSV9giFmWEg321U+pAGNAH4yY25tIJqS8gT89cz4oQJp7aWjA3Ke01e104yqqZU+N+CSyZHEeksdPt8=" - matrix: - - JSONRPC_CLIENT_FEATURES='' - - JSONRPC_CLIENT_FEATURES='http, tls' - - JSONRPC_CLIENT_FEATURES='ws'