Chore: Rework crate features (#139)
All dependencies have been moved to the new "dep:x" and "x?/feature" syntax to remove the bloat from the docs.rs/crates.io/lib.rs feature panes. Accordingly, this lets us break "rustls" and "native" out from annoying hybrids like "serenity-rustls" or "twilight-native" -- specify your library and your backend, and it should just work. The complete list of features is now: driver, gateway, serenity, twilight, rustls, native, builtin-queue, simd-json, internals (plus "default" and "full-doc").
This commit is contained in:
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -54,10 +54,10 @@ jobs:
|
|||||||
features: driver rustls
|
features: driver rustls
|
||||||
dont-test: true
|
dont-test: true
|
||||||
- name: gateway only
|
- name: gateway only
|
||||||
features: serenity-rustls
|
features: gateway serenity rustls
|
||||||
dont-test: true
|
dont-test: true
|
||||||
- name: simd json
|
- name: simd json
|
||||||
features: simd-json serenity-rustls driver gateway serenity/simd_json
|
features: simd-json serenity rustls driver gateway serenity?/simd_json
|
||||||
rustflags: -C target-cpu=native
|
rustflags: -C target-cpu=native
|
||||||
dont-test: true
|
dont-test: true
|
||||||
|
|
||||||
|
|||||||
269
Cargo.toml
269
Cargo.toml
@@ -10,153 +10,65 @@ license = "ISC"
|
|||||||
name = "songbird"
|
name = "songbird"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
repository = "https://github.com/serenity-rs/songbird.git"
|
repository = "https://github.com/serenity-rs/songbird.git"
|
||||||
version = "0.2.2"
|
|
||||||
rust-version = "1.61"
|
rust-version = "1.61"
|
||||||
|
version = "0.3.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
async-trait = { optional = true, version = "0.1" }
|
||||||
|
audiopus = { optional = true, version = "0.3.0-rc.0" }
|
||||||
|
byteorder = { optional = true, version = "1" }
|
||||||
|
dashmap = { optional = true, version = "5" }
|
||||||
derivative = "2"
|
derivative = "2"
|
||||||
|
discortp = { features = ["discord-full"], optional = true, version = "0.5" }
|
||||||
|
flume = { optional = true, version = "0.10" }
|
||||||
|
futures = "0.3"
|
||||||
|
once_cell = { optional = true, version = "1" }
|
||||||
|
parking_lot = { optional = true, version = "0.12" }
|
||||||
pin-project = "1"
|
pin-project = "1"
|
||||||
|
rand = { optional = true, version = "0.8" }
|
||||||
|
reqwest = { default-features = false, features = ["stream"], optional = true, version = "0.11" }
|
||||||
|
ringbuf = { optional = true, version = "0.2" }
|
||||||
|
rubato = { optional = true, version = "0.12" }
|
||||||
|
rusty_pool = { optional = true, version = "0.7" }
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
|
serde-aux = { default-features = false, optional = true, version = "3"}
|
||||||
|
simd-json = { features = ["serde_impl"], optional = true, version = "0.6.0" }
|
||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
|
streamcatcher = { optional = true, version = "1" }
|
||||||
|
tokio = { default-features = false, optional = true, version = "1.0" }
|
||||||
|
tokio-tungstenite = { optional = true, version = "0.17" }
|
||||||
|
tokio-util = { features = ["io"], optional = true, version = "0.7" }
|
||||||
tracing = { version = "0.1", features = ["log"] }
|
tracing = { version = "0.1", features = ["log"] }
|
||||||
tracing-futures = "0.2"
|
tracing-futures = "0.2"
|
||||||
|
twilight-gateway = { default-features = false, optional = true, version = "0.12.0" }
|
||||||
[dependencies.async-trait]
|
twilight-model = { default-features = false, optional = true, version = "0.12.0" }
|
||||||
optional = true
|
typemap_rev = { optional = true, version = "0.1" }
|
||||||
version = "0.1"
|
url = { optional = true, version = "2" }
|
||||||
|
uuid = { features = ["v4"], optional = true, version = "1" }
|
||||||
[dependencies.audiopus]
|
xsalsa20poly1305 = { features = ["std"], optional = true, version = "0.8" }
|
||||||
optional = true
|
|
||||||
version = "0.3.0-rc.0"
|
|
||||||
|
|
||||||
[dependencies.byteorder]
|
|
||||||
optional = true
|
|
||||||
version = "1"
|
|
||||||
|
|
||||||
[dependencies.dashmap]
|
|
||||||
optional = true
|
|
||||||
version = "5"
|
|
||||||
|
|
||||||
[dependencies.discortp]
|
|
||||||
features = ["discord-full"]
|
|
||||||
optional = true
|
|
||||||
version = "0.5"
|
|
||||||
|
|
||||||
[dependencies.flume]
|
|
||||||
optional = true
|
|
||||||
version = "0.10"
|
|
||||||
|
|
||||||
[dependencies.futures]
|
|
||||||
version = "0.3"
|
|
||||||
|
|
||||||
[dependencies.once_cell]
|
|
||||||
version = "1"
|
|
||||||
optional = true
|
|
||||||
|
|
||||||
[dependencies.parking_lot]
|
|
||||||
optional = true
|
|
||||||
version = "0.12"
|
|
||||||
|
|
||||||
[dependencies.rand]
|
|
||||||
optional = true
|
|
||||||
version = "0.8"
|
|
||||||
|
|
||||||
[dependencies.reqwest]
|
|
||||||
optional = true
|
|
||||||
default-features = false
|
|
||||||
features = ["stream"]
|
|
||||||
version = "0.11"
|
|
||||||
|
|
||||||
[dependencies.ringbuf]
|
|
||||||
optional = true
|
|
||||||
version = "0.2"
|
|
||||||
|
|
||||||
[dependencies.rubato]
|
|
||||||
optional = true
|
|
||||||
version = "0.12"
|
|
||||||
|
|
||||||
[dependencies.rusty_pool]
|
|
||||||
optional = true
|
|
||||||
version = "0.7"
|
|
||||||
|
|
||||||
[dependencies.serde-aux]
|
|
||||||
default-features = false
|
|
||||||
optional = true
|
|
||||||
version = "3"
|
|
||||||
|
|
||||||
[dependencies.serenity]
|
[dependencies.serenity]
|
||||||
optional = true
|
|
||||||
version = "0.11"
|
version = "0.11"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["voice", "gateway"]
|
features = ["voice", "gateway"]
|
||||||
|
optional = true
|
||||||
|
|
||||||
[dependencies.serenity-voice-model]
|
[dependencies.serenity-voice-model]
|
||||||
|
version = "0.11"
|
||||||
optional = true
|
optional = true
|
||||||
version = "0.1"
|
|
||||||
|
|
||||||
[dependencies.simd-json]
|
|
||||||
optional = true
|
|
||||||
features = ["serde_impl"]
|
|
||||||
version = "0.6.0"
|
|
||||||
|
|
||||||
[dependencies.streamcatcher]
|
|
||||||
optional = true
|
|
||||||
version = "1"
|
|
||||||
|
|
||||||
[dependencies.symphonia]
|
[dependencies.symphonia]
|
||||||
optional = true
|
|
||||||
default-features = false
|
|
||||||
version = "0.5"
|
|
||||||
git = "https://github.com/FelixMcFelix/Symphonia"
|
|
||||||
branch = "songbird-fixes"
|
branch = "songbird-fixes"
|
||||||
|
git = "https://github.com/FelixMcFelix/Symphonia"
|
||||||
|
default-features = false
|
||||||
|
optional = true
|
||||||
|
version = "0.5"
|
||||||
|
|
||||||
[dependencies.symphonia-core]
|
[dependencies.symphonia-core]
|
||||||
|
branch = "songbird-fixes"
|
||||||
|
git = "https://github.com/FelixMcFelix/Symphonia"
|
||||||
optional = true
|
optional = true
|
||||||
version = "0.5"
|
version = "0.5"
|
||||||
git = "https://github.com/FelixMcFelix/Symphonia"
|
|
||||||
branch = "songbird-fixes"
|
|
||||||
|
|
||||||
[dependencies.tokio]
|
|
||||||
optional = true
|
|
||||||
version = "1.0"
|
|
||||||
default-features = false
|
|
||||||
|
|
||||||
[dependencies.tokio-tungstenite]
|
|
||||||
optional = true
|
|
||||||
version = "0.17"
|
|
||||||
|
|
||||||
[dependencies.tokio-util]
|
|
||||||
optional = true
|
|
||||||
version = "0.7"
|
|
||||||
features = ["io"]
|
|
||||||
|
|
||||||
[dependencies.twilight-gateway]
|
|
||||||
optional = true
|
|
||||||
version = "0.12.0"
|
|
||||||
default-features = false
|
|
||||||
|
|
||||||
[dependencies.twilight-model]
|
|
||||||
optional = true
|
|
||||||
version = "0.12.0"
|
|
||||||
default-features = false
|
|
||||||
|
|
||||||
[dependencies.typemap_rev]
|
|
||||||
optional = true
|
|
||||||
version = "0.1"
|
|
||||||
|
|
||||||
[dependencies.url]
|
|
||||||
optional = true
|
|
||||||
version = "2"
|
|
||||||
|
|
||||||
[dependencies.uuid]
|
|
||||||
optional = true
|
|
||||||
version = "1"
|
|
||||||
features = ["v4"]
|
|
||||||
|
|
||||||
[dependencies.xsalsa20poly1305]
|
|
||||||
optional = true
|
|
||||||
version = "0.8"
|
|
||||||
features = ["std"]
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
criterion = "0.3"
|
criterion = "0.3"
|
||||||
@@ -168,72 +80,74 @@ tokio = { version = "1", features = ["rt", "rt-multi-thread"] }
|
|||||||
[features]
|
[features]
|
||||||
# Core features
|
# Core features
|
||||||
default = [
|
default = [
|
||||||
"serenity-rustls",
|
|
||||||
"driver",
|
"driver",
|
||||||
"gateway",
|
"gateway",
|
||||||
|
"rustls",
|
||||||
|
"serenity",
|
||||||
]
|
]
|
||||||
gateway = [
|
gateway = [
|
||||||
"dashmap",
|
"dep:async-trait",
|
||||||
"flume",
|
"dep:dashmap",
|
||||||
"once_cell",
|
"dep:flume",
|
||||||
"parking_lot",
|
"dep:once_cell",
|
||||||
"tokio/sync",
|
"dep:parking_lot",
|
||||||
"tokio/time",
|
"dep:tokio",
|
||||||
|
"tokio?/sync",
|
||||||
|
"tokio?/time",
|
||||||
]
|
]
|
||||||
driver = [
|
driver = [
|
||||||
"async-trait",
|
"dep:async-trait",
|
||||||
"audiopus",
|
"dep:audiopus",
|
||||||
"byteorder",
|
"dep:byteorder",
|
||||||
"discortp",
|
"dep:discortp",
|
||||||
"reqwest",
|
"dep:reqwest",
|
||||||
"flume",
|
"dep:flume",
|
||||||
"once_cell",
|
"dep:once_cell",
|
||||||
"parking_lot",
|
"dep:parking_lot",
|
||||||
"rand",
|
"dep:rand",
|
||||||
"ringbuf",
|
"dep:ringbuf",
|
||||||
"rubato",
|
"dep:rubato",
|
||||||
"serde-aux",
|
"dep:rusty_pool",
|
||||||
"serenity-voice-model",
|
"dep:serde-aux",
|
||||||
"streamcatcher",
|
"dep:serenity-voice-model",
|
||||||
"symphonia",
|
"dep:streamcatcher",
|
||||||
"symphonia-core",
|
"dep:symphonia",
|
||||||
"rusty_pool",
|
"dep:symphonia-core",
|
||||||
"tokio/fs",
|
"dep:tokio",
|
||||||
"tokio/io-util",
|
"dep:tokio-tungstenite",
|
||||||
"tokio/macros",
|
"dep:tokio-util",
|
||||||
"tokio/net",
|
"dep:typemap_rev",
|
||||||
"tokio/process",
|
"dep:url",
|
||||||
"tokio/rt",
|
"dep:uuid",
|
||||||
"tokio/sync",
|
"dep:xsalsa20poly1305",
|
||||||
"tokio/time",
|
"tokio?/fs",
|
||||||
"tokio-tungstenite",
|
"tokio?/io-util",
|
||||||
"tokio-util",
|
"tokio?/macros",
|
||||||
"typemap_rev",
|
"tokio?/net",
|
||||||
"url",
|
"tokio?/process",
|
||||||
"uuid",
|
"tokio?/rt",
|
||||||
"xsalsa20poly1305",
|
"tokio?/sync",
|
||||||
|
"tokio?/time",
|
||||||
]
|
]
|
||||||
rustls = ["tokio-tungstenite/rustls-tls-webpki-roots", "reqwest/rustls-tls", "rustls-marker"]
|
rustls = [
|
||||||
native = ["tokio-tungstenite/native-tls", "native-marker", "reqwest/native-tls"]
|
"reqwest?/rustls-tls",
|
||||||
serenity-rustls = ["serenity/rustls_backend", "rustls", "gateway", "serenity-deps"]
|
"serenity?/rustls_backend",
|
||||||
serenity-native = ["serenity/native_tls_backend", "native", "gateway", "serenity-deps"]
|
"tokio-tungstenite?/rustls-tls-webpki-roots",
|
||||||
twilight-rustls = ["twilight", "twilight-gateway/rustls-native-roots", "rustls", "gateway"]
|
"twilight-gateway?/rustls-native-roots",
|
||||||
twilight-native = ["twilight", "twilight-gateway/native", "native", "gateway"]
|
]
|
||||||
twilight = ["twilight-model"]
|
native = [
|
||||||
zlib-simd = ["twilight-gateway/zlib-simd"]
|
"reqwest?/native-tls",
|
||||||
zlib-stock = ["twilight-gateway/zlib-stock"]
|
"serenity?/native_tls_backend",
|
||||||
serenity-deps = ["async-trait"]
|
"tokio-tungstenite?/native-tls",
|
||||||
|
"twilight-gateway?/native",
|
||||||
simdjson = []
|
]
|
||||||
|
twilight = ["dep:twilight-gateway","dep:twilight-model"]
|
||||||
rustls-marker = []
|
|
||||||
native-marker = []
|
|
||||||
|
|
||||||
# Behaviour altering features.
|
# Behaviour altering features.
|
||||||
builtin-queue = []
|
builtin-queue = []
|
||||||
|
|
||||||
# Used for docgen/testing/benchmarking.
|
# Used for docgen/testing/benchmarking.
|
||||||
full-doc = ["default", "twilight-rustls", "builtin-queue", "zlib-stock"]
|
full-doc = ["default", "twilight", "builtin-queue"]
|
||||||
internals = []
|
internals = []
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
@@ -250,3 +164,4 @@ harness = false
|
|||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
features = ["full-doc"]
|
features = ["full-doc"]
|
||||||
|
rustdoc-args = ["--cfg", "docsrs"]
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ args = ["build", "--features", "full-doc"]
|
|||||||
dependencies = ["format"]
|
dependencies = ["format"]
|
||||||
|
|
||||||
[tasks.build-simd]
|
[tasks.build-simd]
|
||||||
args = ["build", "--features", "full-doc,simd-json,serenity/simd_json,twilight-gateway/simd-json"]
|
args = ["build", "--features", "full-doc,simd-json,serenity?/simd_json,twilight-gateway?/simd-json"]
|
||||||
command = "cargo"
|
command = "cargo"
|
||||||
dependencies = ["format"]
|
dependencies = ["format"]
|
||||||
env = { "RUSTFLAGS" = "-C target-cpu=native" }
|
env = { "RUSTFLAGS" = "-C target-cpu=native" }
|
||||||
@@ -20,7 +20,7 @@ command = "cargo"
|
|||||||
dependencies = ["format"]
|
dependencies = ["format"]
|
||||||
|
|
||||||
[tasks.build-gateway]
|
[tasks.build-gateway]
|
||||||
args = ["build", "--no-default-features", "--features", "serenity-rustls"]
|
args = ["build", "--no-default-features", "--features", "gateway,serenity,rustls"]
|
||||||
command = "cargo"
|
command = "cargo"
|
||||||
dependencies = ["format"]
|
dependencies = ["format"]
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ dependencies = ["format"]
|
|||||||
args = ["test", "--features", "full-doc"]
|
args = ["test", "--features", "full-doc"]
|
||||||
|
|
||||||
[tasks.test-simd]
|
[tasks.test-simd]
|
||||||
args = ["test", "--features", "full-doc,simd-json,serenity/simd_json,twilight-gateway/simd-json"]
|
args = ["test", "--features", "full-doc,simd-json,serenity?/simd_json,twilight-gateway?/simd-json"]
|
||||||
command = "cargo"
|
command = "cargo"
|
||||||
env = { "RUSTFLAGS" = "-C target-cpu=native" }
|
env = { "RUSTFLAGS" = "-C target-cpu=native" }
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
Songbird is an async, cross-library compatible voice system for Discord, written in Rust.
|
Songbird is an async, cross-library compatible voice system for Discord, written in Rust.
|
||||||
The library offers:
|
The library offers:
|
||||||
* A standalone gateway frontend compatible with [serenity] and [twilight] using the
|
* A standalone gateway frontend compatible with [serenity] and [twilight] using the
|
||||||
`"gateway"` and `"[serenity/twilight]-[rustls/native]"` features. You can even run
|
`"gateway"` and `"[serenity/twilight]"` plus `"[rustls/native]"` features. You can even run
|
||||||
driverless, to help manage your [lavalink] sessions.
|
driverless, to help manage your [lavalink] sessions.
|
||||||
* A standalone driver for voice calls, via the `"driver"` feature. If you can create
|
* A standalone driver for voice calls, via the `"driver"` feature. If you can create
|
||||||
a `ConnectionInfo` using any other gateway, or language for your bot, then you
|
a `ConnectionInfo` using any other gateway, or language for your bot, then you
|
||||||
|
|||||||
16
build.rs
16
build.rs
@@ -1,7 +1,4 @@
|
|||||||
#[cfg(all(
|
#[cfg(all(feature = "driver", not(any(feature = "rustls", feature = "native"))))]
|
||||||
feature = "driver",
|
|
||||||
not(any(feature = "rustls-marker", feature = "native-marker"))
|
|
||||||
))]
|
|
||||||
compile_error!(
|
compile_error!(
|
||||||
"You have the `driver` feature enabled: \
|
"You have the `driver` feature enabled: \
|
||||||
either the `rustls` or `native` feature must be
|
either the `rustls` or `native` feature must be
|
||||||
@@ -12,15 +9,4 @@ compile_error!(
|
|||||||
If you are unsure, go with `rustls`."
|
If you are unsure, go with `rustls`."
|
||||||
);
|
);
|
||||||
|
|
||||||
#[cfg(all(
|
|
||||||
feature = "twilight",
|
|
||||||
not(any(feature = "zlib-simd", feature = "zlib-stock"))
|
|
||||||
))]
|
|
||||||
compile_error!(
|
|
||||||
"Twilight requires you to specify a zlib backend: \
|
|
||||||
either the `zlib-simd` or `zlib-stock` feature must be
|
|
||||||
selected.\n\
|
|
||||||
If you are unsure, go with `zlib-stock`."
|
|
||||||
);
|
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ twilight-standby = "0.12"
|
|||||||
[dependencies.songbird]
|
[dependencies.songbird]
|
||||||
default-features = false
|
default-features = false
|
||||||
path = "../.."
|
path = "../.."
|
||||||
features = ["driver", "twilight-rustls", "zlib-stock"]
|
features = ["driver", "gateway", "twilight", "rustls"]
|
||||||
|
|
||||||
[dependencies.symphonia]
|
[dependencies.symphonia]
|
||||||
version = "0.5"
|
version = "0.5"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
html_logo_url = "https://raw.githubusercontent.com/serenity-rs/songbird/current/songbird.png",
|
html_logo_url = "https://raw.githubusercontent.com/serenity-rs/songbird/current/songbird.png",
|
||||||
html_favicon_url = "https://raw.githubusercontent.com/serenity-rs/songbird/current/songbird-ico.png"
|
html_favicon_url = "https://raw.githubusercontent.com/serenity-rs/songbird/current/songbird-ico.png"
|
||||||
)]
|
)]
|
||||||
|
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
#![deny(rustdoc::broken_intra_doc_links)]
|
#![deny(rustdoc::broken_intra_doc_links)]
|
||||||
//! ![project logo][logo]
|
//! ![project logo][logo]
|
||||||
@@ -9,7 +10,7 @@
|
|||||||
//! Songbird is an async, cross-library compatible voice system for Discord, written in Rust.
|
//! Songbird is an async, cross-library compatible voice system for Discord, written in Rust.
|
||||||
//! The library offers:
|
//! The library offers:
|
||||||
//! * A standalone gateway frontend compatible with [serenity] and [twilight] using the
|
//! * A standalone gateway frontend compatible with [serenity] and [twilight] using the
|
||||||
//! `"gateway"` and `"[serenity/twilight]-[rustls/native]"` features. You can even run
|
//! `"gateway"` and `"[serenity/twilight]"` plus `"[rustls/native]"` features. You can even run
|
||||||
//! driverless, to help manage your [lavalink] sessions.
|
//! driverless, to help manage your [lavalink] sessions.
|
||||||
//! * A standalone driver for voice calls, via the `"driver"` feature. If you can create
|
//! * A standalone driver for voice calls, via the `"driver"` feature. If you can create
|
||||||
//! a [`ConnectionInfo`] using any other gateway, or language for your bot, then you
|
//! a [`ConnectionInfo`] using any other gateway, or language for your bot, then you
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//! Compatability and convenience methods for working with [serenity].
|
//! Compatability and convenience methods for working with [serenity].
|
||||||
//! Requires the `"serenity-rustls"` or `"serenity-native"` features.
|
//! Requires the `"serenity"` feature.
|
||||||
//!
|
//!
|
||||||
//! [serenity]: https://crates.io/crates/serenity/0.9.0-rc.2
|
//! [serenity]: https://crates.io/crates/serenity/0.9.0-rc.2
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user