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

chore: remove unused dependencies in Cargo.toml #109

Merged
merged 4 commits into from
Dec 19, 2018
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
385 changes: 150 additions & 235 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,11 @@ ckb-pow = { path = "pow" }
ckb-network = { path = "network"}
ckb-pool = { path = "pool"}
ckb-rpc = { path = "rpc"}
ckb-verification = { path = "verification"}
ckb-time = { path = "util/time"}
ckb-script= { path = "script"}
logger = { path = "util/logger" }
numext-fixed-hash = { version = "0.1", features = ["support_rand", "support_heapsize", "support_serde"] }
numext-fixed-uint = { version = "0.1", features = ["support_rand", "support_heapsize", "support_serde"] }
dir = { path = "util/dir" }
ctrlc = { version = "3.1", features = ["termination"] }
lazy_static = "1.0"
ckb-sync = { path = "sync"}
serde_json = "1.0"
crypto = { path = "util/crypto"}
Expand Down
6 changes: 0 additions & 6 deletions chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ authors = ["Nervos Core Dev <dev@nervos.org>"]
edition = "2018"

[dependencies]
serde = "1.0"
serde_derive = "1.0"
bincode = "1.0"
log = "0.4"
ckb-core = { path = "../core" }
ckb-shared = { path = "../shared" }
Expand All @@ -17,11 +14,8 @@ ckb-db = { path = "../db" }
ckb-time = { path = "../util/time" }
ckb-notify = { path = "../notify" }
ckb-verification = { path = "../verification" }
avl-merkle = { path = "../util/avl" }
numext-fixed-hash = { version = "0.1", features = ["support_rand", "support_heapsize", "support_serde"] }
numext-fixed-uint = { version = "0.1", features = ["support_rand", "support_heapsize", "support_serde"] }
lru-cache = { git = "https://github.com/nervosnetwork/lru-cache" }
fnv = "1.0.3"
channel = { package= "crossbeam-channel", version = "0.3" }


Expand Down
2 changes: 0 additions & 2 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ numext-fixed-hash = { version = "0.1", features = ["support_rand", "support_heap
numext-fixed-uint = { version = "0.1", features = ["support_rand", "support_heapsize", "support_serde"] }
hash = {path = "../util/hash"}
crypto = {path = "../util/crypto"}
ckb-time = { path = "../util/time" }
bit-vec = "0.5.0"
channel = { package= "crossbeam-channel", version = "0.3" }
rayon = "1.0"
ckb-util = { path = "../util" }
fnv = "1.0.3"
merkle-root = {path = "../util/merkle-root"}
2 changes: 0 additions & 2 deletions db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ edition = "2018"
[dependencies]
bincode = "1.0"
ckb-util = { path = "../util" }
ckb-core = { path = "../core" }
numext-fixed-hash = { version = "0.1", features = ["support_rand", "support_heapsize", "support_serde"] }
rocksdb = { git = "https://github.com/nervosnetwork/rust-rocksdb" }
fnv = "1.0.3"

Expand Down
28 changes: 28 additions & 0 deletions devtools/release/dependencies_check.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env ruby
# find unused dependencies in Cargo.toml
# this is a rough checker, please double check the result for special cases, e.g. features / macro / crate_name::fn()

require 'toml-rb'
require 'colorize'

def crates_in_rust_files(folder)
Dir["#{folder}/**/*.rs"].inject([]) do |crates, file_name|
File.readlines(file_name).grep(/use (\w*)(?:::|;)/) {|_| crates << $1}
crates
end.uniq
end

def crates_in_cargo_toml(folder)
(TomlRB.load_file(File.join(folder, 'Cargo.toml'))['dependencies'] || {}).keys.map{|s| s.gsub(/-/, '_')}
end

def find_unused_dependencies(folder)
puts "checking #{folder}/Cargo.toml"
unused = crates_in_cargo_toml(folder) - crates_in_rust_files(folder)
puts unused.empty? ? "OK".green : "Found #{unused}".red
end

folders = TomlRB.load_file(File.join(ARGV[0], 'Cargo.toml'))['workspace']['members'] + [ARGV[0]]
folders.each do |folder|
find_unused_dependencies(folder)
end
1 change: 0 additions & 1 deletion miner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ ckb-util = { path = "../util" }
ckb-notify = { path = "../notify" }
ckb-pool = { path = "../pool" }
ckb-time = { path = "../util/time" }
flatbuffers = "0.5.0"
rand = "0.6"
serde = "1.0"
serde_derive = "1.0"
Expand Down
1 change: 0 additions & 1 deletion notify/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ edition = "2018"

[dependencies]
fnv = "1.0"
ckb-util = { path = "../util" }
ckb-core = { path = "../core" }
channel = { package= "crossbeam-channel", version = "0.3" }
log = "0.4"
3 changes: 0 additions & 3 deletions pool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ edition = "2018"
ckb-core = { path = "../core" }
ckb-shared = { path = "../shared" }
ckb-chain-spec = { path = "../spec" }
ckb-util = { path = "../util" }
ckb-time = { path = "../util/time" }
ckb-notify = { path = "../notify" }
ckb-verification = { path = "../verification" }
Expand All @@ -18,8 +17,6 @@ lru-cache = { git = "https://github.com/nervosnetwork/lru-cache" }
linked-hash-map = { git = "https://github.com/nervosnetwork/linked-hash-map", rev = "df27f21" }
serde = "1.0"
serde_derive = "1.0"
bincode = "1.0"
rand = "0.6"
log = "0.4"
fnv = "1.0.3"
channel = { package= "crossbeam-channel", version = "0.3" }
Expand Down
2 changes: 0 additions & 2 deletions script/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ numext-fixed-hash = { version = "0.1", features = ["support_rand", "support_heap
byteorder = "1.2.2"
crypto = {path = "../util/crypto"}
ckb-core = { path = "../core" }
serde = "1.0"
serde_derive = "1.0"
hash = {path = "../util/hash"}
ckb-vm = { git = "https://github.com/nervosnetwork/ckb-vm", rev = "1622ba0" }
faster-hex = "0.1"
Expand Down
3 changes: 0 additions & 3 deletions shared/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,15 @@ edition = "2018"
serde = "1.0"
serde_derive = "1.0"
bincode = "1.0"
log = "0.4"
ckb-core = { path = "../core" }
ckb-chain-spec = { path = "../spec" }
ckb-util = { path = "../util" }
ckb-db = { path = "../db" }
ckb-time = { path = "../util/time" }
avl = { package = "avl-merkle", path = "../util/avl" }
numext-fixed-hash = { version = "0.1", features = ["support_rand", "support_heapsize", "support_serde"] }
numext-fixed-uint = { version = "0.1", features = ["support_rand", "support_heapsize", "support_serde"] }
lru-cache = { git = "https://github.com/nervosnetwork/lru-cache" }
fnv = "1.0.3"
crossbeam-channel = "0.3"

[dev-dependencies]
env_logger = "0.6"
Expand Down
2 changes: 0 additions & 2 deletions sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ ckb-shared = { path = "../shared" }
ckb-core = { path = "../core" }
numext-fixed-hash = { version = "0.1", features = ["support_rand", "support_heapsize", "support_serde"] }
numext-fixed-uint = { version = "0.1", features = ["support_rand", "support_heapsize", "support_serde"] }
multiaddr = "0.3"
ckb-network = { path = "../network" }
log = "0.4"
fnv = "1.0"
ckb-protocol = { path = "../protocol" }
ckb-util = { path = "../util" }
ckb-pool = { path = "../pool" }
ckb-time = { path = "../util/time" }
lazy_static = "1.0"
bitflags = "1.0"
ckb-verification = { path = "../verification" }
serde = "1.0"
Expand Down
1 change: 0 additions & 1 deletion util/crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ edition = "2018"
secp256k1 = { git = "https://github.com/nervosnetwork/rust-secp256k1", optional = true, features = ["rand"] }
lazy_static = "1.0"
failure = "0.1.1"
failure_derive = "0.1.1"
rand = "0.6"
numext-fixed-hash = { version = "0.1", features = ["support_rand", "support_heapsize", "support_serde"] }
faster-hex = "0.1"
Expand Down
3 changes: 0 additions & 3 deletions verification/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@ authors = ["Nervos Core Dev <dev@nervos.org>"]
edition = "2018"

[dependencies]
log = "0.4"
ckb-core = { path = "../core" }
ckb-time = { path = "../util/time" }
ckb-shared = { path = "../shared" }
ckb-util = { path = "../util" }
ckb-script = { path = "../script" }
ckb-pow = { path = "../pow" }
merkle-root = {path = "../util/merkle-root"}
numext-fixed-hash = { version = "0.1", features = ["support_rand", "support_heapsize", "support_serde"] }
numext-fixed-uint = { version = "0.1", features = ["support_rand", "support_heapsize", "support_serde"] }
rayon = "1.0"
fnv = "1.0.3"
crossbeam-channel = "0.3"

[dev-dependencies]
ckb-db = { path = "../db" }
Expand Down