Cargo.toml: Deprecate executor specific features for sub-crates (#2962)

This commit is contained in:
Thomas Eizinger
2022-10-11 23:10:10 +11:00
committed by GitHub
parent aba5ccbce3
commit 31a45f2d76
3 changed files with 122 additions and 22 deletions

View File

@ -48,6 +48,16 @@
- Remove default features. You need to enable required features explicitly now. As a quick workaround, you may want to use the - 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]. new `full` feature which activates all features. See [PR 2918].
- Introduce `tokio` and `async-std` features and deprecate the following ones:
- `tcp-tokio` in favor of `tcp` + `tokio`
- `mdns-tokio` in favor of `mdns` + `tokio`
- `dns-tokio` in favor of `dns` + `tokio`
- `tcp-async-io` in favor of `tcp` + `async-std`
- `mdns-async-io` in favor of `mdns` + `async-std`
- `dns-async-std` in favor of `dns` + `async-std`
See [PR 2962].
- Update individual crates. - Update individual crates.
- Update to [`libp2p-autonat` `v0.8.0`](protocols/autonat/CHANGELOG.md#0080). - 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-core` `v0.37.0`](core/CHANGELOG.md#0370).
@ -75,7 +85,8 @@
- Update to [`libp2p-websocket` `v0.39.0`](transports/websocket/CHANGELOG.md#0390). - Update to [`libp2p-websocket` `v0.39.0`](transports/websocket/CHANGELOG.md#0390).
- Update to [`libp2p-yamux` `v0.41.0`](muxers/mplex/CHANGELOG.md#0410). - Update to [`libp2p-yamux` `v0.41.0`](muxers/mplex/CHANGELOG.md#0410).
- [PR 2918]: https://github.com/libp2p/rust-libp2p/pull/2918 [PR 2918]: https://github.com/libp2p/rust-libp2p/pull/2918
[PR 2962]: https://github.com/libp2p/rust-libp2p/pull/2962
# 0.48.0 # 0.48.0

View File

@ -12,9 +12,11 @@ categories = ["network-programming", "asynchronous"]
[features] [features]
full = [ full = [
"async-std",
"autonat", "autonat",
"dcutr", "dcutr",
"deflate", "deflate",
"dns",
"dns-async-std", "dns-async-std",
"dns-tokio", "dns-tokio",
"ecdsa", "ecdsa",
@ -22,6 +24,7 @@ full = [
"gossipsub", "gossipsub",
"identify", "identify",
"kad", "kad",
"mdns",
"mdns-async-io", "mdns-async-io",
"mdns-tokio", "mdns-tokio",
"metrics", "metrics",
@ -36,8 +39,10 @@ full = [
"rsa", "rsa",
"secp256k1", "secp256k1",
"serde", "serde",
"tcp",
"tcp-async-io", "tcp-async-io",
"tcp-tokio", "tcp-tokio",
"tokio",
"uds", "uds",
"wasm-bindgen", "wasm-bindgen",
"wasm-ext", "wasm-ext",
@ -48,6 +53,7 @@ full = [
autonat = ["dep:libp2p-autonat"] autonat = ["dep:libp2p-autonat"]
dcutr = ["dep:libp2p-dcutr", "libp2p-metrics?/dcutr"] dcutr = ["dep:libp2p-dcutr", "libp2p-metrics?/dcutr"]
deflate = ["dep:libp2p-deflate"] deflate = ["dep:libp2p-deflate"]
dns = ["dep:libp2p-dns"]
dns-async-std = ["dep:libp2p-dns", "libp2p-dns?/async-std"] dns-async-std = ["dep:libp2p-dns", "libp2p-dns?/async-std"]
dns-tokio = ["dep:libp2p-dns", "libp2p-dns?/tokio"] dns-tokio = ["dep:libp2p-dns", "libp2p-dns?/tokio"]
floodsub = ["dep:libp2p-floodsub"] floodsub = ["dep:libp2p-floodsub"]
@ -55,6 +61,7 @@ identify = ["dep:libp2p-identify", "libp2p-metrics?/identify"]
kad = ["dep:libp2p-kad", "libp2p-metrics?/kad"] kad = ["dep:libp2p-kad", "libp2p-metrics?/kad"]
gossipsub = ["dep:libp2p-gossipsub", "libp2p-metrics?/gossipsub"] gossipsub = ["dep:libp2p-gossipsub", "libp2p-metrics?/gossipsub"]
metrics = ["dep:libp2p-metrics"] metrics = ["dep:libp2p-metrics"]
mdns = ["dep:libp2p-mdns"]
mdns-async-io = ["dep:libp2p-mdns", "libp2p-mdns?/async-io"] mdns-async-io = ["dep:libp2p-mdns", "libp2p-mdns?/async-io"]
mdns-tokio = ["dep:libp2p-mdns", "libp2p-mdns?/tokio"] mdns-tokio = ["dep:libp2p-mdns", "libp2p-mdns?/tokio"]
mplex = ["dep:libp2p-mplex"] mplex = ["dep:libp2p-mplex"]
@ -65,6 +72,7 @@ pnet = ["dep:libp2p-pnet"]
relay = ["dep:libp2p-relay", "libp2p-metrics?/relay"] relay = ["dep:libp2p-relay", "libp2p-metrics?/relay"]
request-response = ["dep:libp2p-request-response"] request-response = ["dep:libp2p-request-response"]
rendezvous = ["dep:libp2p-rendezvous"] rendezvous = ["dep:libp2p-rendezvous"]
tcp = ["dep:libp2p-tcp"]
tcp-async-io = ["dep:libp2p-tcp", "libp2p-tcp?/async-io"] tcp-async-io = ["dep:libp2p-tcp", "libp2p-tcp?/async-io"]
tcp-tokio = ["dep:libp2p-tcp", "libp2p-tcp?/tokio"] tcp-tokio = ["dep:libp2p-tcp", "libp2p-tcp?/tokio"]
uds = ["dep:libp2p-uds"] uds = ["dep:libp2p-uds"]
@ -77,6 +85,8 @@ secp256k1 = ["libp2p-core/secp256k1"]
rsa = ["libp2p-core/rsa"] rsa = ["libp2p-core/rsa"]
ecdsa = ["libp2p-core/ecdsa"] ecdsa = ["libp2p-core/ecdsa"]
serde = ["libp2p-core/serde", "libp2p-kad?/serde", "libp2p-gossipsub?/serde"] serde = ["libp2p-core/serde", "libp2p-kad?/serde", "libp2p-gossipsub?/serde"]
tokio = ["libp2p-mdns?/tokio", "libp2p-tcp?/tokio", "libp2p-dns?/tokio"]
async-std = ["libp2p-mdns?/async-io", "libp2p-tcp?/async-io", "libp2p-dns?/async-std"]
[package.metadata.docs.rs] [package.metadata.docs.rs]
all-features = true all-features = true
@ -128,7 +138,7 @@ libp2p-gossipsub = { version = "0.42.1", path = "protocols/gossipsub", optional
async-std = { version = "1.6.2", features = ["attributes"] } async-std = { version = "1.6.2", features = ["attributes"] }
async-trait = "0.1" async-trait = "0.1"
env_logger = "0.9.0" env_logger = "0.9.0"
clap = {version = "3.1.6", features = ["derive"]} clap = { version = "3.1.6", features = ["derive"] }
tokio = { version = "1.15", features = ["io-util", "io-std", "macros", "rt", "rt-multi-thread"] } tokio = { version = "1.15", features = ["io-util", "io-std", "macros", "rt", "rt-multi-thread"] }
[workspace] [workspace]

View File

@ -54,14 +54,31 @@ pub use libp2p_dcutr as dcutr;
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))] #[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))]
#[doc(inline)] #[doc(inline)]
pub use libp2p_deflate as deflate; pub use libp2p_deflate as deflate;
#[cfg(any(feature = "dns-async-std", feature = "dns-tokio"))] #[deprecated(
since = "0.49.0",
note = "The `dns-tokio` and `dns-async-std` features are deprecated. Use the new `dns` feature together with the `tokio` or `async-std` features."
)]
#[cfg(all(
any(feature = "dns-tokio", feature = "dns-async-std"),
not(feature = "dns")
))]
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))]
#[cfg_attr( #[cfg_attr(
docsrs, docsrs,
doc(cfg(any(feature = "dns-async-std", feature = "dns-tokio"))) doc(cfg(any(feature = "dns-tokio", feature = "dns-async-std")))
)] )]
pub mod dns {
#[doc(inline)]
pub use libp2p_dns::*;
}
#[cfg(feature = "dns")]
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))] #[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))]
#[doc(inline)] #[cfg_attr(docsrs, doc(cfg(feature = "dns")))]
pub use libp2p_dns as dns; pub mod dns {
#[doc(inline)]
pub use libp2p_dns::*;
}
#[cfg(feature = "floodsub")] #[cfg(feature = "floodsub")]
#[cfg_attr(docsrs, doc(cfg(feature = "floodsub")))] #[cfg_attr(docsrs, doc(cfg(feature = "floodsub")))]
#[doc(inline)] #[doc(inline)]
@ -79,14 +96,31 @@ pub use libp2p_identify as identify;
#[cfg_attr(docsrs, doc(cfg(feature = "kad")))] #[cfg_attr(docsrs, doc(cfg(feature = "kad")))]
#[doc(inline)] #[doc(inline)]
pub use libp2p_kad as kad; pub use libp2p_kad as kad;
#[cfg(any(feature = "mdns-async-io", feature = "mdns-tokio"))] #[deprecated(
since = "0.49.0",
note = "The `mdns-tokio` and `mdns-async-io` features are deprecated. Use the new `mdns` feature together with the `tokio` or `async-std` features."
)]
#[cfg(all(
any(feature = "mdns-async-io", feature = "mdns-tokio"),
not(feature = "mdns")
))]
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))]
#[cfg_attr( #[cfg_attr(
docsrs, docsrs,
doc(cfg(any(feature = "mdns-tokio", feature = "mdns-async-io"))) doc(cfg(any(feature = "mdns-tokio", feature = "mdns-async-io")))
)] )]
pub mod mdns {
#[doc(inline)]
pub use libp2p_mdns::*;
}
#[cfg(feature = "mdns")]
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))] #[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))]
#[doc(inline)] #[cfg_attr(docsrs, doc(cfg(feature = "mdns")))]
pub use libp2p_mdns as mdns; pub mod mdns {
#[doc(inline)]
pub use libp2p_mdns::*;
}
#[cfg(feature = "metrics")] #[cfg(feature = "metrics")]
#[cfg_attr(docsrs, doc(cfg(feature = "metrics")))] #[cfg_attr(docsrs, doc(cfg(feature = "metrics")))]
#[doc(inline)] #[doc(inline)]
@ -125,11 +159,28 @@ pub use libp2p_rendezvous as rendezvous;
pub use libp2p_request_response as request_response; pub use libp2p_request_response as request_response;
#[doc(inline)] #[doc(inline)]
pub use libp2p_swarm as swarm; pub use libp2p_swarm as swarm;
#[cfg(any(feature = "tcp-async-io", feature = "tcp-tokio"))] #[deprecated(
#[cfg_attr(docsrs, doc(cfg(any(feature = "tcp-async-io", feature = "tcp-tokio"))))] since = "0.49.0",
note = "The `tcp-tokio` and `tcp-async-io` features are deprecated. Use the new `tcp` feature together with the `tokio` or `async-std` features."
)]
#[cfg(all(
any(feature = "tcp-tokio", feature = "tcp-async-io"),
not(feature = "tcp")
))]
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))] #[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))]
#[doc(inline)] #[cfg_attr(docsrs, doc(cfg(any(feature = "tcp-tokio", feature = "tcp-async-io"))))]
pub use libp2p_tcp as tcp; pub mod tcp {
#[doc(inline)]
pub use libp2p_tcp::*;
}
#[cfg(feature = "tcp")]
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))]
#[cfg_attr(docsrs, doc(cfg(feature = "tcp")))]
pub mod tcp {
#[doc(inline)]
pub use libp2p_tcp::*;
}
#[cfg(feature = "uds")] #[cfg(feature = "uds")]
#[cfg_attr(docsrs, doc(cfg(feature = "uds")))] #[cfg_attr(docsrs, doc(cfg(feature = "uds")))]
#[doc(inline)] #[doc(inline)]
@ -181,8 +232,10 @@ pub use libp2p_swarm_derive::NetworkBehaviour;
/// > reserves the right to support additional protocols or remove deprecated protocols. /// > reserves the right to support additional protocols or remove deprecated protocols.
#[cfg(all( #[cfg(all(
not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")), not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")),
feature = "tcp-async-io", any(
feature = "dns-async-std", all(feature = "tcp-async-io", feature = "dns-async-std"),
all(feature = "tcp", feature = "dns", feature = "async-std")
),
feature = "websocket", feature = "websocket",
feature = "noise", feature = "noise",
feature = "mplex", feature = "mplex",
@ -192,14 +245,26 @@ pub use libp2p_swarm_derive::NetworkBehaviour;
docsrs, docsrs,
doc(cfg(all( doc(cfg(all(
not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")), not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")),
feature = "tcp-async-io", any(
feature = "dns-async-std", all(feature = "tcp-async-io", feature = "dns-async-std"),
all(feature = "tcp", feature = "dns", feature = "async-std")
),
feature = "websocket", feature = "websocket",
feature = "noise", feature = "noise",
feature = "mplex", feature = "mplex",
feature = "yamux" feature = "yamux"
))) )))
)] )]
#[cfg_attr(
all(
any(feature = "tcp-async-io", feature = "dns-async-std"),
not(feature = "async-std")
),
deprecated(
since = "0.49.0",
note = "The `tcp-async-io` and `dns-async-std` features are deprecated. Use the new `tcp` and `dns` features together with the `async-std` feature."
)
)]
pub async fn development_transport( pub async fn development_transport(
keypair: identity::Keypair, keypair: identity::Keypair,
) -> std::io::Result<core::transport::Boxed<(PeerId, core::muxing::StreamMuxerBox)>> { ) -> std::io::Result<core::transport::Boxed<(PeerId, core::muxing::StreamMuxerBox)>> {
@ -241,8 +306,10 @@ pub async fn development_transport(
/// > reserves the right to support additional protocols or remove deprecated protocols. /// > reserves the right to support additional protocols or remove deprecated protocols.
#[cfg(all( #[cfg(all(
not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")), not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")),
feature = "tcp-tokio", any(
feature = "dns-tokio", all(feature = "tcp-tokio", feature = "dns-tokio"),
all(feature = "tcp", feature = "dns", feature = "tokio")
),
feature = "websocket", feature = "websocket",
feature = "noise", feature = "noise",
feature = "mplex", feature = "mplex",
@ -252,14 +319,26 @@ pub async fn development_transport(
docsrs, docsrs,
doc(cfg(all( doc(cfg(all(
not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")), not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")),
feature = "tcp-tokio", any(
feature = "dns-tokio", all(feature = "tcp-tokio", feature = "dns-tokio"),
all(feature = "tcp", feature = "dns", feature = "tokio")
),
feature = "websocket", feature = "websocket",
feature = "noise", feature = "noise",
feature = "mplex", feature = "mplex",
feature = "yamux" feature = "yamux"
))) )))
)] )]
#[cfg_attr(
all(
any(feature = "tcp-tokio", feature = "dns-tokio"),
not(feature = "tokio")
),
deprecated(
since = "0.49.0",
note = "The `tcp-tokio` and `dns-tokio` features are deprecated. Use the new `tcp` and `dns` feature together with the `tokio` feature."
)
)]
pub fn tokio_development_transport( pub fn tokio_development_transport(
keypair: identity::Keypair, keypair: identity::Keypair,
) -> std::io::Result<core::transport::Boxed<(PeerId, core::muxing::StreamMuxerBox)>> { ) -> std::io::Result<core::transport::Boxed<(PeerId, core::muxing::StreamMuxerBox)>> {