diff --git a/.circleci/config.yml b/.circleci/config.yml index a43c9317..92f98ee3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: diff --git a/libp2p/Cargo.toml b/libp2p/Cargo.toml index 883799f7..c3b8af5f 100644 --- a/libp2p/Cargo.toml +++ b/libp2p/Cargo.toml @@ -3,6 +3,9 @@ name = "libp2p" version = "0.1.0" authors = ["Parity Technologies "] +[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" diff --git a/libp2p/src/lib.rs b/libp2p/src/lib.rs index 123ff073..fdbcdd1b 100644 --- a/libp2p/src/lib.rs +++ b/libp2p/src/lib.rs @@ -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;