From 6cc3b4ec52c922bfcf562a29b5805c3150e37c75 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Tue, 22 Mar 2022 11:22:17 +0100 Subject: [PATCH] *: Import `libp2p` with `default-features = false` (#2574) * *: Import `libp2p` with `default-features = false` While not a win in most cases, it reduces compile time for tests of individual crates. * Cargo.toml: Set features for examples --- Cargo.toml | 16 ++++++++++++++++ misc/metrics/Cargo.toml | 2 +- protocols/dcutr/Cargo.toml | 2 +- protocols/mdns/Cargo.toml | 2 +- protocols/relay/Cargo.toml | 2 +- protocols/rendezvous/Cargo.toml | 2 +- swarm-derive/Cargo.toml | 2 +- 7 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 65729eb8848..7a6d6b93409 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -152,6 +152,22 @@ members = [ "transports/wasm-ext" ] +[[example]] +name = "chat" +required-features = ["floodsub"] + [[example]] name = "chat-tokio" required-features = ["tcp-tokio", "mdns"] + +[[example]] +name = "file-sharing" +required-features = ["request-response"] + +[[example]] +name = "gossipsub-chat" +required-features = ["gossipsub"] + +[[example]] +name = "ipfs-private" +required-features = ["gossipsub"] diff --git a/misc/metrics/Cargo.toml b/misc/metrics/Cargo.toml index 01ca7364c3f..dc8becc5023 100644 --- a/misc/metrics/Cargo.toml +++ b/misc/metrics/Cargo.toml @@ -35,6 +35,6 @@ libp2p-gossipsub = { version = "0.37.0", path = "../../protocols/gossipsub", op log = "0.4.0" env_logger = "0.8.1" futures = "0.3.1" -libp2p = { path = "../../", features = ["metrics"] } +libp2p = { path = "../../", default-features = false, features = ["metrics", "ping", "tcp-async-io", "dns-async-std", "websocket", "noise", "mplex", "yamux"] } hyper = { version="0.14", features = ["server", "tcp", "http1"] } tokio = { version = "1", features = ["rt-multi-thread"] } diff --git a/protocols/dcutr/Cargo.toml b/protocols/dcutr/Cargo.toml index fe16f2f12a2..2641c9367c0 100644 --- a/protocols/dcutr/Cargo.toml +++ b/protocols/dcutr/Cargo.toml @@ -30,7 +30,7 @@ prost-build = "0.9" [dev-dependencies] env_logger = "0.8.3" -libp2p = { path = "../..", features = ["dcutr"] } +libp2p = { path = "../..", default-features = false, features = ["dcutr", "relay", "plaintext", "identify", "tcp-async-io", "ping", "noise", "dns-async-std"] } libp2p-identify = { path = "../identify" } libp2p-plaintext = { path = "../../transports/plaintext" } libp2p-relay = { path = "../relay" } diff --git a/protocols/mdns/Cargo.toml b/protocols/mdns/Cargo.toml index 92566f6d43b..8873e701dcc 100644 --- a/protocols/mdns/Cargo.toml +++ b/protocols/mdns/Cargo.toml @@ -28,5 +28,5 @@ void = "1.0.2" [dev-dependencies] async-std = { version = "1.9.0", features = ["attributes"] } env_logger = "0.9.0" -libp2p = { path = "../.." } +libp2p = { path = "../..", default-features = false, features = ["mdns", "tcp-async-io", "dns-async-std", "websocket", "noise", "mplex", "yamux"] } tokio = { version = "1.15", default-features = false, features = ["macros", "rt", "rt-multi-thread", "time"] } diff --git a/protocols/relay/Cargo.toml b/protocols/relay/Cargo.toml index 5dfcce41949..33a5aa7d23a 100644 --- a/protocols/relay/Cargo.toml +++ b/protocols/relay/Cargo.toml @@ -34,7 +34,7 @@ prost-build = "0.9" [dev-dependencies] env_logger = "0.9.0" -libp2p = { path = "../.." } +libp2p = { path = "../..", default-features = false, features = ["identify", "relay", "ping", "noise", "plaintext", "tcp-async-io"] } libp2p-identify = { path = "../identify" } libp2p-kad = { path = "../kad" } libp2p-ping = { path = "../ping" } diff --git a/protocols/rendezvous/Cargo.toml b/protocols/rendezvous/Cargo.toml index 54f35bc0e0b..e1881433b63 100644 --- a/protocols/rendezvous/Cargo.toml +++ b/protocols/rendezvous/Cargo.toml @@ -29,7 +29,7 @@ instant = "0.1.11" [dev-dependencies] async-trait = "0.1" env_logger = "0.8" -libp2p = { path = "../.." } +libp2p = { path = "../..", default-features = false, features = ["ping", "identify", "tcp-async-io", "dns-async-std", "websocket", "noise", "mplex", "yamux", "rendezvous"] } rand = "0.8" tokio = { version = "1.15", features = [ "rt-multi-thread", "time", "macros", "sync", "process", "fs", "net" ] } diff --git a/swarm-derive/Cargo.toml b/swarm-derive/Cargo.toml index 1ab584c12e3..4fc0ac26b27 100644 --- a/swarm-derive/Cargo.toml +++ b/swarm-derive/Cargo.toml @@ -18,6 +18,6 @@ syn = { version = "1.0.8", default-features = false, features = ["clone-impls", quote = "1.0" [dev-dependencies] -libp2p = { path = "../" } +libp2p = { path = "../", default-features = false, features = ["ping", "identify", "kad"] } either = "1.6.0" futures = "0.3.1"