Skip to content

Commit

Permalink
chore: fix cargo udeps warnings in tari_metrics (#3869)
Browse files Browse the repository at this point in the history
Description
---
- adds `optional` attribute to some dependencies in tari_metrics that are only used with certain features.
- `cargo udeps` no longer gives any warnings about unused dependencies.
- moves openssl-sys vendoring dependency to from comms to tari_p2p (used by tari_p2p dns-seed implementation) 

Motivation and Context
---
`cargo udeps` passes

How Has This Been Tested?
---
cargo +nightly udeps
  • Loading branch information
sdbondi authored Feb 25, 2022
1 parent 64efeff commit 7f85073
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 79 deletions.
60 changes: 7 additions & 53 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions base_layer/p2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ fs2 = "0.3.0"
futures = { version = "^0.3.1" }
lmdb-zero = "0.4.4"
log = "0.4.6"
openssl-sys = { version = "=0.9.66", features = ["vendored"], optional = true }
pgp = { version = "0.7.2", optional = true }
prost = "=0.9.0"
rand = "0.8"
Expand All @@ -49,15 +50,13 @@ clap = "2.33.0"
lazy_static = "1.3.0"
tempfile = "3.1.0"

[dev-dependencies.log4rs]
version = "^0.8"
features = ["console_appender", "file_appender", "file", "yaml_format"]
default-features = false

[build-dependencies]
tari_common = { version = "^0.28", path = "../../common", features = ["build"] }

[features]
test-mocks = []
auto-update = ["reqwest/default", "pgp"]
avx2 = ["tari_crypto/avx2"]

[package.metadata.cargo-udeps.ignore]
normal = ["openssl-sys"]
25 changes: 12 additions & 13 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,30 @@ version = "0.28.1"
edition = "2018"

[features]
build = ["toml", "anyhow", "prost-build"]
build = ["toml", "prost-build"]
static-application-info = ["git2"]

[dependencies]
structopt = { version = "0.3.13", default_features = false }
tari_storage = { version = "^0.28", path = "../infrastructure/storage"}

anyhow = "1.0.53"
config = { version = "0.9.3", default_features = false, features = ["toml"] }
serde = { version = "1.0.106", default_features = false }
serde_json = "1.0.51"
dirs-next = "1.0.2"
fs2 = "0.4.3"
get_if_addrs = "0.5.3"
git2 = { version = "0.8", optional = true }
log = "0.4.8"
log4rs = { version = "1.0.0", default_features = false, features = ["config_parsing", "threshold_filter", "yaml_format"] }
multiaddr = { version = "0.13.0" }
sha2 = "0.9.5"
path-clean = "0.1.0"
tari_storage = { version = "^0.28", path = "../infrastructure/storage"}

anyhow = { version = "1.0.53", optional = true }
git2 = { version = "0.8", optional = true }
prost-build = { version = "0.9.0", optional = true }
toml = { version = "0.5", optional = true }
thiserror = "1.0.29"
fs2 = "0.4.3"
serde = { version = "1.0.106", default_features = false }
serde_json = "1.0.51"
sha2 = "0.9.5"
structopt = { version = "0.3.13", default_features = false }
tempfile = "3.1.0"
thiserror = "1.0.29"
toml = { version = "0.5", optional = true }

[dev-dependencies]
tari_test_utils = { version = "^0.28", path = "../infrastructure/test_utils"}
anyhow = "1.0.53"
5 changes: 1 addition & 4 deletions comms/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ edition = "2018"

[dependencies]
tari_crypto = { git = "https://github.com/tari-project/tari-crypto.git", branch = "main" }
tari_metrics = { path = "../infrastructure/metrics" }
tari_storage = { version = "^0.28", path = "../infrastructure/storage" }
tari_shutdown = { version = "^0.28", path = "../infrastructure/shutdown" }

Expand All @@ -32,7 +33,6 @@ log-mdc = "0.1.0"
multiaddr = { version = "0.13.0" }
nom = { version = "5.1.0", features = ["std"], default-features = false }
once_cell = "1.8.0"
openssl-sys = { version = "=0.9.66", features = ["vendored"], optional = true }
pin-project = "1.0.8"
prost = "=0.9.0"
prost-types = "0.9.0"
Expand All @@ -48,9 +48,6 @@ tower = {version = "0.4", features = ["util"]}
tracing = "0.1.26"
yamux = "=0.9.0"

# Metrics
tari_metrics = { path = "../infrastructure/metrics" }

[dev-dependencies]
tari_test_utils = { version = "^0.28", path = "../infrastructure/test_utils" }
tari_comms_rpc_macros = { version = "*", path = "./rpc_macros" }
Expand Down
8 changes: 4 additions & 4 deletions infrastructure/metrics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ readme = "README.md"
license = "BSD-3-Clause"

[dependencies]
log = "0.4.14"
log = { version = "0.4.14", optional = true }
once_cell = "1.8.0"
prometheus = "0.13.0"

futures = { version = "0.3.15", default-features = false, optional = false }
futures = { version = "0.3.15", default-features = false, optional = true }
reqwest = { version = "0.11.4", default-features = false, optional = true }
tokio = { version = "1.7.1", optional = true, features = ["time", "rt-multi-thread"] }
warp = { version = "0.3.1", optional = true, default-features = false }
thiserror = "1.0.25"
anyhow = "1.0.53"
anyhow = { version = "1.0.53", optional = true }

[features]
pull = ["warp"]
push = ["reqwest", "tokio"]
server = ["pull", "push"]
server = ["pull", "push", "log", "anyhow", "futures"]

0 comments on commit 7f85073

Please sign in to comment.