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

provide feature to use eyre instead of anyhow #85

Closed
wants to merge 1 commit into from
Closed
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
17 changes: 15 additions & 2 deletions crates/ibc-types-core-channel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ publish = true
all-features = true

[features]
default = ["std"]
default = ["std", "anyhow"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 in favor of this as a default.

std = [
"ibc-types-timestamp/std",
"ibc-types-identifier/std",
Expand Down Expand Up @@ -52,6 +52,17 @@ upgrade_client = []
mocks = ["tendermint-testgen", "tendermint/clock", "cfg-if", "parking_lot"]
mocks-no-std = ["cfg-if"]

anyhow = [
"dep:anyhow",
"ibc-types-core-commitment/anyhow",
"ibc-types-domain-type/anyhow",
]
eyre = [
"dep:eyre",
"ibc-types-core-commitment/eyre",
"ibc-types-domain-type/eyre",
]

[dependencies]
ibc-types-core-client = { version = "0.13.0", path = "../ibc-types-core-client", default-features = false }
ibc-types-core-connection = { version = "0.13.0", path = "../ibc-types-core-connection", default-features = false }
Expand Down Expand Up @@ -84,7 +95,9 @@ subtle-encoding = { version = "0.5", default-features = false }
time = { version = "0.3", default-features = false }
tracing = { version = "0.1.36", default-features = false }
scale-info = { version = "2.1.2", default-features = false, features = ["derive"], optional = true }
anyhow = { version = "1", default-features = false }

anyhow = { version = "1", default-features = false, optional = true }
eyre = { version = "0.6.12", optional = true }

[dependencies.tendermint]
version = "0.34.0"
Expand Down
8 changes: 8 additions & 0 deletions crates/ibc-types-core-channel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ extern crate alloc;
#[cfg(any(test, feature = "std"))]
extern crate std;

#[cfg(all(feature = "anyhow", feature = "eyre"))]
compile_error!("feature \"anyhow\" and feature \"eyre\" cannot be enabled at the same time");

#[cfg(feature = "anyhow")]
extern crate anyhow;
#[cfg(feature = "eyre")]
extern crate eyre as anyhow;

pub mod channel;
pub mod packet;

Expand Down
11 changes: 9 additions & 2 deletions crates/ibc-types-core-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ description = """
all-features = true

[features]
default = ["std"]
default = ["std", "anyhow"]
std = [
"bytes/std",
"displaydoc/std",
Expand All @@ -34,6 +34,10 @@ std = [
"tendermint/clock",
"tendermint/std",
]

anyhow = ["dep:anyhow"]
eyre = ["dep:eyre"]

parity-scale-codec = ["dep:parity-scale-codec", "dep:scale-info"]
borsh = ["dep:borsh"]

Expand Down Expand Up @@ -69,7 +73,10 @@ serde_json = { version = "1", default-features = false, optional = true }
sha2 = { version = "0.10.6", default-features = false }
subtle-encoding = { version = "0.5", default-features = false }
time = { version = "0.3", default-features = false }
anyhow = { version = "1", default-features = false }

# anyhow and eyre are mutually exclusive features
anyhow = { version = "1", default-features = false, optional = true }
eyre = { version = "0.6.12", optional = true}

[dependencies.tendermint]
version = "0.34.0"
Expand Down
15 changes: 13 additions & 2 deletions crates/ibc-types-core-commitment/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ publish = true
all-features = true

[features]
default = ["std"]
default = ["std", "anyhow"]
std = [
"ibc-types-timestamp/std",
"ibc-types-identifier/std",
Expand Down Expand Up @@ -54,6 +54,15 @@ upgrade_client = []
mocks = ["tendermint-testgen", "tendermint/clock", "cfg-if", "parking_lot"]
mocks-no-std = ["cfg-if"]

anyhow = [
"dep:anyhow",
"ibc-types-domain-type/anyhow",
]
eyre = [
"dep:eyre",
"ibc-types-domain-type/eyre",
]

[dependencies]
ibc-types-timestamp = { version = "0.13.0", path = "../ibc-types-timestamp", default-features = false }
ibc-types-identifier = { version = "0.13.0", path = "../ibc-types-identifier", default-features = false }
Expand Down Expand Up @@ -85,9 +94,11 @@ scale-info = { version = "2.1.2", default-features = false, features = ["derive"
borsh = {version = "0.10.0", default-features = false, optional = true }
parking_lot = { version = "0.12.1", default-features = false, optional = true }
cfg-if = { version = "1.0.0", optional = true }
anyhow = "1"
hex = { version = "0.4.3", default-features = false }

anyhow = { version = "1", optional = true }
eyre = { version = "0.6.12", optional = true}

[dependencies.tendermint]
version = "0.34.0"
default-features = false
Expand Down
8 changes: 8 additions & 0 deletions crates/ibc-types-core-commitment/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ extern crate alloc;
#[cfg(any(test, feature = "std"))]
extern crate std;

#[cfg(all(feature = "anyhow", feature = "eyre"))]
compile_error!("feature \"anyhow\" and feature \"eyre\" cannot be enabled at the same time");

#[cfg(feature = "anyhow")]
extern crate anyhow;
#[cfg(feature = "eyre")]
extern crate eyre as anyhow;

mod prelude;

mod error;
Expand Down
16 changes: 14 additions & 2 deletions crates/ibc-types-core-connection/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ publish = true
all-features = true

[features]
default = ["std"]
default = ["std", "anyhow"]
std = [
"bytes/std",
"displaydoc/std",
Expand Down Expand Up @@ -50,6 +50,17 @@ upgrade_client = []
mocks = ["tendermint-testgen", "tendermint/clock", "cfg-if", "parking_lot"]
mocks-no-std = ["cfg-if"]

anyhow = [
"dep:anyhow",
"ibc-types-core-commitment/anyhow",
"ibc-types-domain-type/anyhow",
]
eyre = [
"dep:eyre",
"ibc-types-core-commitment/eyre",
"ibc-types-domain-type/eyre",
]

[dependencies]
ibc-types-timestamp = { version = "0.13.0", path = "../ibc-types-timestamp", default-features = false }
ibc-types-core-commitment = { version = "0.13.0", path = "../ibc-types-core-commitment", default-features = false }
Expand All @@ -75,7 +86,8 @@ serde_json = { version = "1", default-features = false, optional = true }
sha2 = { version = "0.10.6", default-features = false }
subtle-encoding = { version = "0.5", default-features = false }
time = { version = "0.3", default-features = false }
anyhow = { version = "1", default-features = false }
anyhow = { version = "1", default-features = false, optional = true }
eyre = { version = "0.6.12", optional = true }

[dependencies.tendermint]
version = "0.34.0"
Expand Down
8 changes: 7 additions & 1 deletion crates/ibc-types-domain-type/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ all-features = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = ["anyhow"]
anyhow = ["dep:anyhow"]
eyre = ["dep:eyre"]

[dependencies]
anyhow = { version = "1", default-features = false }
anyhow = { version = "1", default-features = false, optional = true }
eyre = { version = "0.6.12", optional = true}
prost = { version = "0.12", default-features = false }
bytes = { version = "1.2.1", default-features = false }
8 changes: 8 additions & 0 deletions crates/ibc-types-domain-type/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
#[cfg(any(test, feature = "std"))]
extern crate std;

#[cfg(all(feature = "anyhow", feature = "eyre"))]
compile_error!("feature \"anyhow\" and feature \"eyre\" cannot be enabled at the same time");

Check failure on line 11 in crates/ibc-types-domain-type/src/lib.rs

View workflow job for this annotation

GitHub Actions / test-stable

feature "anyhow" and feature "eyre" cannot be enabled at the same time

Check failure on line 11 in crates/ibc-types-domain-type/src/lib.rs

View workflow job for this annotation

GitHub Actions / doc

feature "anyhow" and feature "eyre" cannot be enabled at the same time

#[cfg(feature = "anyhow")]
extern crate anyhow;
#[cfg(feature = "eyre")]
extern crate eyre as anyhow;

Check failure on line 16 in crates/ibc-types-domain-type/src/lib.rs

View workflow job for this annotation

GitHub Actions / test-stable

the name `anyhow` is defined multiple times

Check failure on line 16 in crates/ibc-types-domain-type/src/lib.rs

View workflow job for this annotation

GitHub Actions / doc

the name `anyhow` is defined multiple times

mod prelude;
use prelude::*;

Expand Down
21 changes: 19 additions & 2 deletions crates/ibc-types-lightclients-tendermint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ publish = true
all-features = true

[features]
default = ["std"]
default = ["std", "anyhow"]
std = [
"ibc-types-timestamp/std",
"ibc-types-identifier/std",
Expand Down Expand Up @@ -55,6 +55,21 @@ upgrade_client = []
mocks = ["tendermint-testgen", "tendermint/clock", "cfg-if", "parking_lot"]
mocks-no-std = ["cfg-if"]

anyhow = [
"dep:anyhow",
"ibc-types-core-client/anyhow",
"ibc-types-core-commitment/anyhow",
"ibc-types-core-connection/anyhow",
"ibc-types-domain-type/anyhow",
]
eyre = [
"dep:eyre",
"ibc-types-core-client/eyre",
"ibc-types-core-commitment/eyre",
"ibc-types-core-connection/eyre",
"ibc-types-domain-type/eyre",
]

[dependencies]
ibc-types-timestamp = { version = "0.13.0", path = "../ibc-types-timestamp", default-features = false }
ibc-types-identifier = { version = "0.13.0", path = "../ibc-types-identifier", default-features = false }
Expand Down Expand Up @@ -89,7 +104,9 @@ scale-info = { version = "2.1.2", default-features = false, features = ["derive"
borsh = {version = "0.10.0", default-features = false, optional = true }
parking_lot = { version = "0.12.1", default-features = false, optional = true }
cfg-if = { version = "1.0.0", optional = true }
anyhow = { version = "1", default-features = false }

anyhow = { version = "1", default-features = false, optional = true }
eyre = { version = "0.6.12", optional = true }

[dependencies.tendermint]
version = "0.34.0"
Expand Down
Loading