Put secio behind a feature flag in the facade (#219)

* Put secio behind a feature flag in the facade

* Define the features required by examples

* Test both with and without Cargo features
This commit is contained in:
Pierre Krieger
2018-05-24 16:24:20 +02:00
committed by GitHub
parent 89087f021d
commit c7f654a815
3 changed files with 36 additions and 4 deletions

View File

@ -32,8 +32,11 @@ jobs:
name: Prepare docker container for building
command: docker build --pull --no-cache -t rust-libp2p -f .circleci/images/rust-libp2p/Dockerfile .
- run:
name: Run tests, inside a docker image
command: docker run --rm -v "/cache/cargo/registry:/usr/local/cargo/registry" -v "/cache/target:/app/target" -it rust-libp2p cargo test
name: Run tests, inside a docker image, with no feature
command: docker run --rm -v "/cache/cargo/registry:/usr/local/cargo/registry" -v "/cache/target:/app/target" -it rust-libp2p cargo test --no-default-features
- run:
name: Run tests, inside a docker image, with all features
command: docker run --rm -v "/cache/cargo/registry:/usr/local/cargo/registry" -v "/cache/target:/app/target" -it rust-libp2p cargo test --all-features
- save_cache:
key: test-cache
paths:

View File

@ -3,6 +3,9 @@ name = "libp2p"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
[features]
default = ["libp2p-secio"]
[dependencies]
bytes = "0.4"
futures = "0.1"
@ -21,7 +24,7 @@ tokio-io = "0.1"
[target.'cfg(not(target_os = "emscripten"))'.dependencies]
libp2p-dns = { path = "../dns" }
libp2p-secio = { path = "../secio" }
libp2p-secio = { path = "../secio", optional = true }
libp2p-tcp-transport = { path = "../tcp-transport" }
tokio-core = "0.1"
@ -36,3 +39,29 @@ structopt = "0.2"
tokio-core = "0.1"
tokio-io = "0.1"
tokio-stdin = "0.1"
[[example]]
name = "echo-dialer"
required-features = ["libp2p-secio"]
[[example]]
name = "echo-server"
required-features = ["libp2p-secio"]
[[example]]
name = "floodsub"
required-features = ["libp2p-secio"]
[[example]]
name = "kademlia"
required-features = ["libp2p-secio"]
[[example]]
name = "ping-client"
required-features = ["libp2p-secio"]
[[example]]
name = "random_peerid"
[[example]]
name = "relay"

View File

@ -36,7 +36,7 @@ pub extern crate libp2p_peerstore as peerstore;
pub extern crate libp2p_ping as ping;
pub extern crate libp2p_ratelimit as ratelimit;
pub extern crate libp2p_relay as relay;
#[cfg(not(target_os = "emscripten"))]
#[cfg(all(not(target_os = "emscripten"), feature = "libp2p-secio"))]
pub extern crate libp2p_secio as secio;
#[cfg(not(target_os = "emscripten"))]
pub extern crate libp2p_tcp_transport as tcp;