Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(jsonrpsee): less deps when defining RPC API. #849

Merged
merged 3 commits into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions jsonrpsee/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,20 @@ tracing = { version = "0.1.34", optional = true }
[features]
client-ws-transport = ["jsonrpsee-client-transport/ws", "jsonrpsee-client-transport/tls"]
client-ws-transport-no-tls = ["jsonrpsee-client-transport/ws"]
client-web-transport = ["jsonrpsee-client-transport/web"]
async-client = ["jsonrpsee-core/async-client"]
http-client = ["jsonrpsee-http-client", "jsonrpsee-types", "jsonrpsee-core"]
http-server = ["jsonrpsee-http-server", "jsonrpsee-types", "jsonrpsee-core"]
wasm-client = ["jsonrpsee-wasm-client", "jsonrpsee-types", "jsonrpsee-core"]
ws-client = ["jsonrpsee-ws-client", "jsonrpsee-types", "jsonrpsee-core"]
ws-server = ["jsonrpsee-ws-server", "jsonrpsee-types", "jsonrpsee-core"]
macros = ["jsonrpsee-proc-macros", "jsonrpsee-types", "jsonrpsee-core/client", "tracing"]
http-client = ["jsonrpsee-http-client", "jsonrpsee-types", "jsonrpsee-core/client"]
http-server = ["jsonrpsee-http-server", "jsonrpsee-types", "jsonrpsee-core/server"]
wasm-client = ["jsonrpsee-wasm-client", "jsonrpsee-types", "jsonrpsee-core/client"]
ws-client = ["jsonrpsee-ws-client", "jsonrpsee-types", "jsonrpsee-core/client"]
ws-server = ["jsonrpsee-ws-server", "jsonrpsee-types", "jsonrpsee-core/server"]
macros = ["jsonrpsee-proc-macros", "jsonrpsee-types", "tracing"]

client = ["http-client", "ws-client", "wasm-client"]
server = ["http-server", "ws-server"]
full = ["client", "server", "macros", "async-client", "client-ws-transport"]
client = ["http-client", "ws-client", "wasm-client", "client-ws-transport", "client-web-transport", "async-client", "client-core"]
client-core = ["jsonrpsee-core/client"]
server = ["http-server", "ws-server", "server-core"]
server-core = ["jsonrpsee-core/server"]
full = ["client", "server", "macros"]

[package.metadata.docs.rs]
all-features = true
Expand Down
11 changes: 7 additions & 4 deletions jsonrpsee/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,23 @@
//! The `jsonrpsee` crate composes JSON-RPC functionality behind optional feature
//! flags to provide for client and server communication over specific protocols.
//! There are no default features, all functionality must be opted in to accordingly.
//! The following features are avaliable.
//! The following features are available.
//!
//! - **`http-client`** - JSON-RPC client functionality over HTTP protocol.
//! - **`http-server`** - JSON-RPC server functionality over HTTP protocol.
//! - **`wasm-client`** - JSON-RPC client functionality over web-sys.
//! - **`ws-client`** - JSON-RPC client functionality over WebSocket protocol.
//! - **`ws-server`** - JSON-RPC server functionality over WebSocket protocol.
//! - **`macros`** - JSON-RPC API generation convenience by derive macros.
//! - **`client`** - Enables `http-client` and `ws-client` features.
//! - **`server`** - Enables `http-server` and `ws-server` features.
//! - **`full`** - Enables `client`, `server` and `macros` features.
//! - **`client-core`** - Enables minimal client features to generate the RPC API without transports.
//! - **`client`** - Enables all client features including transports.
//! - **`server-core`** - Enables minimal server features to generate the RPC API without transports.
//! - **`server`** - Enables all server features including transports.
//! - **`full`** - Enables all features.
//! - **`async-client`** - Enables the async client without any transport.
//! - **`client-ws-transport`** - Enables `ws` transport with TLS.
//! - **`client-ws-transport-no-tls`** - Enables `ws` transport without TLS.
//! - **`client-web-transport`** - Enables `websys` transport.

#![cfg_attr(docsrs, feature(doc_cfg))]

Expand Down
6 changes: 3 additions & 3 deletions jsonrpsee/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ macro_rules! cfg_feature {
macro_rules! cfg_client {
($($item:item)*) => {
$(
#[cfg(any(feature = "jsonrpsee-http-client", feature = "jsonrpsee-wasm-client", feature = "jsonrpsee-ws-client", feature = "client", feature = "async-client"))]
#[cfg(any(feature = "jsonrpsee-http-client", feature = "jsonrpsee-wasm-client", feature = "jsonrpsee-ws-client", feature = "client", feature = "async-client", feature = "client-core"))]
$item
)*
}
Expand Down Expand Up @@ -50,7 +50,7 @@ macro_rules! cfg_client_transport {
macro_rules! cfg_server {
($($item:item)*) => {
$(
#[cfg(any(feature = "jsonrpsee-http-server", feature = "jsonrpsee-ws-server"))]
#[cfg(any(feature = "server", feature = "server-core", feature = "ws-server", feature = "http-server"))]
$item
)*
}
Expand Down Expand Up @@ -83,7 +83,7 @@ macro_rules! cfg_types {
macro_rules! cfg_client_or_server {
($($item:item)*) => {
$(
#[cfg(any(feature = "jsonrpsee-http-client", feature = "jsonrpsee-ws-client", feature = "jsonrpsee-wasm-client", feature = "client", feature = "async-client", feature = "jsonrpsee-ws-server", feature = "jsonrpsee-http-server"))]
#[cfg(any(feature = "jsonrpsee-http-client", feature = "jsonrpsee-wasm-client", feature = "jsonrpsee-ws-client", feature = "client", feature = "async-client", feature = "client-core", feature = "server", feature = "server-core", feature = "ws-server", feature = "http-server"))]
$item
)*
}
Expand Down