Skip to content

Commit

Permalink
*: Remove default features from all crates (#2918)
Browse files Browse the repository at this point in the history
Remove default features. You need to enable required features
explicitly now. As a quick workaround, you may want to use the
new `full` feature which activates all features.
  • Loading branch information
thomaseizinger committed Sep 29, 2022
1 parent c71115d commit f6bb846
Show file tree
Hide file tree
Showing 53 changed files with 323 additions and 159 deletions.
26 changes: 25 additions & 1 deletion .github/workflows/ci.yml
Expand Up @@ -165,7 +165,7 @@ jobs:
- uses: Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # v2.0.0

- name: Run ipfs-kad example
run: RUST_LOG=libp2p_swarm=debug,libp2p_kad=trace,libp2p_tcp=debug cargo run --example ipfs-kad
run: RUST_LOG=libp2p_swarm=debug,libp2p_kad=trace,libp2p_tcp=debug cargo run --example ipfs-kad --features full

rustfmt:
runs-on: ubuntu-latest
Expand All @@ -187,3 +187,27 @@ jobs:

- name: Check formatting
run: cargo fmt -- --check

manifest_lint:
runs-on: ubuntu-latest
steps:

- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@bb6001c4ea612bf59c3abfc4756fbceee4f870c7 # 0.10.0
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v3

- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
profile: minimal
toolchain: stable
override: true

- name: Ensure `full` feature contains all features
run: |
ALL_FEATURES=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "libp2p") | .features | keys | map(select(. != "full")) | sort | join(" ")')
FULL_FEATURE=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "libp2p") | .features["full"] | sort | join(" ")')
test "$ALL_FEATURES = $FULL_FEATURE"
52 changes: 29 additions & 23 deletions CHANGELOG.md
Expand Up @@ -45,31 +45,37 @@

# 0.49.0 - [unreleased]

- Update to [`libp2p-core` `v0.36.1`](core/CHANGELOG.md#0361).
- Remove default features. You need to enable required features explicitly now. As a quick workaround, you may want to use the
new `full` feature which activates all features. See [PR 2918].

- Update to [`libp2p-tcp` `v0.37.0`](transports/tcp/CHANGELOG.md#0370).
- Update individual crates.
- Update to [`libp2p-ping` `v0.39.1`](protocols/ping/CHANGELOG.md#0391).
- Update to [`libp2p-floodsub` `v0.39.1`](protocols/floodsub/CHANGELOG.md#0391).
- Update to [`libp2p-gossipsub` `v0.41.1`](protocols/gossipsub/CHANGELOG.md#0411).
- Update to [`libp2p-request-response` `v0.21.1`](protocols/request-response/CHANGELOG.md#0211).
- Update to [`libp2p-pnet` `v0.22.1`](transports/pnet/CHANGELOG.md#0221).
- Update to [`libp2p-mplex` `v0.36.1`](muxers/mplex/CHANGELOG.md#0361).
- Update to [`libp2p-swarm` `v0.39.1`](swarm/CHANGELOG.md#0391).
-
- Update to [`libp2p-noise` `v0.39.1`](transports/noise/CHANGELOG.md#0391).

- Update to [`libp2p-swarm-derive` `v0.30.1`](swarm-derive/CHANGELOG.md#0301).

- Update to [`libp2p-metrics` `v0.10.0`](misc/metrics/CHANGELOG.md#0100).

- Update to [`libp2p-kad` `v0.41.0`](protocols/kad/CHANGELOG.md#0410).
-
- Update to [`libp2p-identify` `v0.39.1`](protocols/identify/CHANGELOG.md#0400).

- Update to [`libp2p-noise` `v0.39.1`](transports/noise/CHANGELOG.md#0391).

- Update to [`libp2p-swarm` `v0.39.1`](swarm/CHANGELOG.md#0391).
- Update to [`libp2p-autonat` `v0.8.0`](protocols/autonat/CHANGELOG.md#0080).
- Update to [`libp2p-core` `v0.37.0`](core/CHANGELOG.md#0370).
- Update to [`libp2p-dcutr` `v0.7.0`](protocols/dcutr/CHANGELOG.md#0070).
- Update to [`libp2p-deflate` `v0.37.0`](transports/deflate/CHANGELOG.md#0370).
- Update to [`libp2p-dns` `v0.37.0`](transports/dns/CHANGELOG.md#0370).
- Update to [`libp2p-floodsub` `v0.40.0`](protocols/floodsub/CHANGELOG.md#0400).
- Update to [`libp2p-gossipsub` `v0.42.0`](protocols/gossipsub/CHANGELOG.md#0420).
- Update to [`libp2p-identify` `v0.40.0`](protocols/identify/CHANGELOG.md#0400).
- Update to [`libp2p-kad` `v0.41.0`](protocols/kad/CHANGELOG.md#0410).
- Update to [`libp2p-mdns` `v0.41.0`](protocols/mdns/CHANGELOG.md#0410).
- Update to [`libp2p-metrics` `v0.10.0`](misc/metrics/CHANGELOG.md#0100).
- Update to [`libp2p-mplex` `v0.37.0`](muxers/mplex/CHANGELOG.md#0370).
- Update to [`libp2p-noise` `v0.40.0`](transports/noise/CHANGELOG.md#0400).
- Update to [`libp2p-ping` `v0.40.0`](protocols/ping/CHANGELOG.md#0400).
- Update to [`libp2p-plaintext` `v0.37.0`](transports/plaintext/CHANGELOG.md#0370).
- Update to [`libp2p-relay` `v0.13.0`](protocols/relay/CHANGELOG.md#0130).
- Update to [`libp2p-rendezvous` `v0.10.0`](protocols/rendezovus/CHANGELOG.md#0100).
- Update to [`libp2p-request-response` `v0.22.0`](protocols/request-response/CHANGELOG.md#0220).
- Update to [`libp2p-swarm-derive` `v0.30.1`](swarm-derive/CHANGELOG.md#0301).
- Update to [`libp2p-swarm` `v0.40.0`](swarm/CHANGELOG.md#0400).
- Update to [`libp2p-tcp` `v0.37.0`](transports/tcp/CHANGELOG.md#0370).
- Update to [`libp2p-uds` `v0.36.0`](transports/uds/CHANGELOG.md#0360).
- Update to [`libp2p-wasm-ext` `v0.37.0`](transports/wasm-ext/CHANGELOG.md#0370).
- Update to [`libp2p-websocket` `v0.39.0`](transports/websocket/CHANGELOG.md#0390).
- Update to [`libp2p-yamux` `v0.41.0`](muxers/mplex/CHANGELOG.md#0410).

- [PR 2918]: https://github.com/libp2p/rust-libp2p/pull/2918

# 0.48.0

Expand Down
87 changes: 56 additions & 31 deletions Cargo.toml
Expand Up @@ -11,32 +11,40 @@ keywords = ["peer-to-peer", "libp2p", "networking"]
categories = ["network-programming", "asynchronous"]

[features]
default = [
full = [
"autonat",
"dcutr",
"deflate",
"dns-async-std",
"dns-tokio",
"ecdsa",
"floodsub",
"gossipsub",
"identify",
"kad",
"gossipsub",
"mdns-async-io",
"mdns-tokio",
"metrics",
"mplex",
"noise",
"ping",
"plaintext",
"pnet",
"relay",
"request-response",
"rendezvous",
"request-response",
"rsa",
"secp256k1",
"serde",
"tcp-async-io",
"tcp-tokio",
"uds",
"wasm-bindgen",
"wasm-ext",
"wasm-ext-websocket",
"websocket",
"yamux",
]

autonat = ["dep:libp2p-autonat"]
dcutr = ["dep:libp2p-dcutr", "libp2p-metrics?/dcutr"]
deflate = ["dep:libp2p-deflate"]
Expand Down Expand Up @@ -67,6 +75,7 @@ websocket = ["dep:libp2p-websocket"]
yamux = ["dep:libp2p-yamux"]
secp256k1 = ["libp2p-core/secp256k1"]
rsa = ["libp2p-core/rsa"]
ecdsa = ["libp2p-core/ecdsa"]
serde = ["libp2p-core/serde", "libp2p-kad?/serde", "libp2p-gossipsub?/serde"]

[package.metadata.docs.rs]
Expand All @@ -80,40 +89,40 @@ getrandom = "0.2.3" # Explicit dependency to be used in `wasm-bindgen` feature
instant = "0.1.11" # Explicit dependency to be used in `wasm-bindgen` feature
lazy_static = "1.2"

libp2p-autonat = { version = "0.7.0", path = "protocols/autonat", optional = true }
libp2p-core = { version = "0.36.1", path = "core", default-features = false }
libp2p-dcutr = { version = "0.6.0", path = "protocols/dcutr", optional = true }
libp2p-floodsub = { version = "0.39.1", path = "protocols/floodsub", optional = true }
libp2p-identify = { version = "0.39.1", path = "protocols/identify", optional = true }
libp2p-autonat = { version = "0.8.0", path = "protocols/autonat", optional = true }
libp2p-core = { version = "0.37.1", path = "core" }
libp2p-dcutr = { version = "0.7.0", path = "protocols/dcutr", optional = true }
libp2p-floodsub = { version = "0.40.1", path = "protocols/floodsub", optional = true }
libp2p-identify = { version = "0.40.1", path = "protocols/identify", optional = true }
libp2p-kad = { version = "0.41.0", path = "protocols/kad", optional = true }
libp2p-metrics = { version = "0.10.0", path = "misc/metrics", optional = true }
libp2p-mplex = { version = "0.36.1", path = "muxers/mplex", optional = true }
libp2p-noise = { version = "0.39.1", path = "transports/noise", optional = true }
libp2p-ping = { version = "0.39.1", path = "protocols/ping", optional = true }
libp2p-plaintext = { version = "0.36.0", path = "transports/plaintext", optional = true }
libp2p-mplex = { version = "0.37.1", path = "muxers/mplex", optional = true }
libp2p-noise = { version = "0.40.0", path = "transports/noise", optional = true }
libp2p-ping = { version = "0.40.1", path = "protocols/ping", optional = true }
libp2p-plaintext = { version = "0.37.0", path = "transports/plaintext", optional = true }
libp2p-pnet = { version = "0.22.1", path = "transports/pnet", optional = true }
libp2p-relay = { version = "0.12.0", path = "protocols/relay", optional = true }
libp2p-rendezvous = { version = "0.9.0", path = "protocols/rendezvous", optional = true }
libp2p-request-response = { version = "0.21.1", path = "protocols/request-response", optional = true }
libp2p-swarm = { version = "0.39.1", path = "swarm" }
libp2p-relay = { version = "0.13.0", path = "protocols/relay", optional = true }
libp2p-rendezvous = { version = "0.10.0", path = "protocols/rendezvous", optional = true }
libp2p-request-response = { version = "0.22.1", path = "protocols/request-response", optional = true }
libp2p-swarm = { version = "0.40.1", path = "swarm" }
libp2p-swarm-derive = { version = "0.30.1", path = "swarm-derive" }
libp2p-uds = { version = "0.35.0", path = "transports/uds", optional = true }
libp2p-wasm-ext = { version = "0.36.0", path = "transports/wasm-ext", default-features = false, optional = true }
libp2p-yamux = { version = "0.40.0", path = "muxers/yamux", optional = true }
libp2p-uds = { version = "0.36.0", path = "transports/uds", optional = true }
libp2p-wasm-ext = { version = "0.37.0", path = "transports/wasm-ext", optional = true }
libp2p-yamux = { version = "0.41.0", path = "muxers/yamux", optional = true }
multiaddr = { version = "0.14.0" }
parking_lot = "0.12.0"
pin-project = "1.0.0"
smallvec = "1.6.1"

[target.'cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))'.dependencies]
libp2p-deflate = { version = "0.36.0", path = "transports/deflate", optional = true }
libp2p-dns = { version = "0.36.0", path = "transports/dns", optional = true, default-features = false }
libp2p-mdns = { version = "0.40.0", path = "protocols/mdns", optional = true, default-features = false }
libp2p-tcp = { version = "0.37.0", path = "transports/tcp", default-features = false, optional = true }
libp2p-websocket = { version = "0.38.0", path = "transports/websocket", optional = true }
libp2p-deflate = { version = "0.37.0", path = "transports/deflate", optional = true }
libp2p-dns = { version = "0.37.0", path = "transports/dns", optional = true }
libp2p-mdns = { version = "0.41.0", path = "protocols/mdns", optional = true }
libp2p-tcp = { version = "0.37.0", path = "transports/tcp", optional = true }
libp2p-websocket = { version = "0.39.0", path = "transports/websocket", optional = true }

[target.'cfg(not(target_os = "unknown"))'.dependencies]
libp2p-gossipsub = { version = "0.41.1", path = "protocols/gossipsub", optional = true }
libp2p-gossipsub = { version = "0.42.1", path = "protocols/gossipsub", optional = true }

[dev-dependencies]
async-std = { version = "1.6.2", features = ["attributes"] }
Expand Down Expand Up @@ -159,20 +168,36 @@ members = [

[[example]]
name = "chat"
required-features = ["floodsub"]
required-features = ["full"]

[[example]]
name = "chat-tokio"
required-features = ["tcp-tokio", "mdns-tokio"]
required-features = ["full"]

[[example]]
name = "file-sharing"
required-features = ["request-response"]
required-features = ["full"]

[[example]]
name = "gossipsub-chat"
required-features = ["gossipsub"]
required-features = ["full"]

[[example]]
name = "ipfs-private"
required-features = ["gossipsub", "pnet", "yamux", "ping", "noise", "tcp-async-io", "identify"]
required-features = ["full"]

[[example]]
name = "ipfs-kad"
required-features = ["full"]

[[example]]
name = "ping"
required-features = ["full"]

[[example]]
name = "mdns-passive-discovery"
required-features = ["full"]

[[example]]
name = "distributed-key-value-store"
required-features = ["full"]
6 changes: 5 additions & 1 deletion core/CHANGELOG.md
@@ -1,8 +1,12 @@
# 0.36.1 - [unreleased]
# 0.37.0 [unreleased]

- Implement `Hash` and `Ord` for `PublicKey`. See [PR 2915].

- Remove default features. If you previously depended on `secp256k1` or `ecdsa` you need to enable these explicitly
now. See [PR 2918].

[PR 2915]: https://github.com/libp2p/rust-libp2p/pull/2915
[PR 2918]: https://github.com/libp2p/rust-libp2p/pull/2918

# 0.36.0

Expand Down
5 changes: 2 additions & 3 deletions core/Cargo.toml
Expand Up @@ -3,7 +3,7 @@ name = "libp2p-core"
edition = "2021"
rust-version = "1.56.1"
description = "Core traits and structs of libp2p"
version = "0.36.1"
version = "0.37.1"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down Expand Up @@ -46,7 +46,7 @@ ring = { version = "0.16.9", features = ["alloc", "std"], default-features = fal
async-std = { version = "1.6.2", features = ["attributes"] }
base64 = "0.13.0"
criterion = "0.4"
libp2p = { path = "../", default-features = false, features = ["mplex", "noise"] }
libp2p = { path = "..", features = ["full"] }
multihash = { version = "0.16", default-features = false, features = ["arb"] }
quickcheck = { package = "quickcheck-ext", path = "../misc/quickcheck-ext" }
rmp-serde = "1.0"
Expand All @@ -56,7 +56,6 @@ serde_json = "1.0"
prost-build = "0.11"

[features]
default = [ "secp256k1", "ecdsa" ]
secp256k1 = [ "libsecp256k1" ]
ecdsa = [ "p256" ]
rsa = [ "dep:ring" ]
Expand Down
2 changes: 1 addition & 1 deletion misc/keygen/Cargo.toml
Expand Up @@ -13,5 +13,5 @@ clap = {version = "3.1.6", features = ["derive"]}
zeroize = "1"
serde = { version = "1.0.136", features = ["derive"] }
serde_json = "1.0.79"
libp2p-core = { path = "../../core", default-features = false, version = "0.36.0"}
libp2p-core = { version = "0.37.0", path = "../../core" }
base64 = "0.13.0"
14 changes: 14 additions & 0 deletions misc/metrics/CHANGELOG.md
Expand Up @@ -4,6 +4,20 @@
-
- Update to `libp2p-identify` `v0.39.1`.

- Update to `libp2p-swarm` `v0.40.0`.

- Update to `libp2p-dcutr` `v0.7.0`.

- Update to `libp2p-ping` `v0.40.0`.

- Update to `libp2p-identify` `v0.40.0`.

- Update to `libp2p-relay` `v0.13.0`.

- Update to `libp2p-core` `v0.37.0`.

- Update to `libp2p-gossipsub` `v0.42.0`.

# 0.9.0

- Update to `libp2p-swarm` `v0.39.0`.
Expand Down
16 changes: 8 additions & 8 deletions misc/metrics/Cargo.toml
Expand Up @@ -19,22 +19,22 @@ relay = ["libp2p-relay"]
dcutr = ["libp2p-dcutr"]

[dependencies]
libp2p-core = { version = "0.36.0", path = "../../core", default-features = false }
libp2p-dcutr = { version = "0.6.0", path = "../../protocols/dcutr", optional = true }
libp2p-identify = { version = "0.39.1", path = "../../protocols/identify", optional = true }
libp2p-core = { version = "0.37.0", path = "../../core" }
libp2p-dcutr = { version = "0.7.0", path = "../../protocols/dcutr", optional = true }
libp2p-identify = { version = "0.40.1", path = "../../protocols/identify", optional = true }
libp2p-kad = { version = "0.41.0", path = "../../protocols/kad", optional = true }
libp2p-ping = { version = "0.39.0", path = "../../protocols/ping", optional = true }
libp2p-relay = { version = "0.12.0", path = "../../protocols/relay", optional = true }
libp2p-swarm = { version = "0.39.0", path = "../../swarm" }
libp2p-ping = { version = "0.40.0", path = "../../protocols/ping", optional = true }
libp2p-relay = { version = "0.13.0", path = "../../protocols/relay", optional = true }
libp2p-swarm = { version = "0.40.0", path = "../../swarm" }
prometheus-client = "0.18.0"

[target.'cfg(not(target_os = "unknown"))'.dependencies]
libp2p-gossipsub = { version = "0.41.0", path = "../../protocols/gossipsub", optional = true }
libp2p-gossipsub = { version = "0.42.0", path = "../../protocols/gossipsub", optional = true }

[dev-dependencies]
log = "0.4.0"
env_logger = "0.9.0"
futures = "0.3.1"
libp2p = { path = "../../", default-features = false, features = ["metrics", "ping", "tcp-async-io", "dns-async-std", "websocket", "noise", "mplex", "yamux"] }
libp2p = { path = "../..", features = ["full"] }
hyper = { version="0.14", features = ["server", "tcp", "http1"] }
tokio = { version = "1", features = ["rt-multi-thread"] }
2 changes: 1 addition & 1 deletion misc/multistream-select/Cargo.toml
Expand Up @@ -21,7 +21,7 @@ unsigned-varint = "0.7"
[dev-dependencies]
async-std = "1.6.2"
env_logger = "0.9"
libp2p = { path = "../../", default-features = false, features = ["mplex", "plaintext"] }
libp2p = { path = "../..", features = ["full"] }
quickcheck = { package = "quickcheck-ext", path = "../../misc/quickcheck-ext" }
rand = "0.8"
rw-stream-sink = { version = "0.3.0", path = "../../misc/rw-stream-sink" }
6 changes: 3 additions & 3 deletions muxers/mplex/Cargo.toml
Expand Up @@ -3,7 +3,7 @@ name = "libp2p-mplex"
edition = "2021"
rust-version = "1.56.1"
description = "Mplex multiplexing protocol for libp2p"
version = "0.36.1"
version = "0.37.1"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand All @@ -14,7 +14,7 @@ categories = ["network-programming", "asynchronous"]
bytes = "1"
futures = "0.3.1"
asynchronous-codec = "0.6"
libp2p-core = { version = "0.36.0", path = "../../core", default-features = false }
libp2p-core = { version = "0.37.0", path = "../../core" }
log = "0.4"
nohash-hasher = "0.2"
parking_lot = "0.12"
Expand All @@ -27,7 +27,7 @@ async-std = "1.7.0"
criterion = "0.4"
env_logger = "0.9"
futures = "0.3"
libp2p = { path = "../../", default-features = false, features = ["tcp-async-io", "plaintext", "mplex"] }
libp2p = { path = "../..", features = ["full"] }
quickcheck = { package = "quickcheck-ext", path = "../../misc/quickcheck-ext" }

[[bench]]
Expand Down
4 changes: 4 additions & 0 deletions muxers/yamux/CHANGELOG.md
@@ -1,3 +1,7 @@
# 0.41.0 [unreleased]

- Update to `libp2p-core` `v0.37.0`.

# 0.40.0

- Update to `libp2p-core` `v0.36.0`
Expand Down

0 comments on commit f6bb846

Please sign in to comment.