Add bitcoin_hashes dependency, rename some features

Because features and dependencies share the same namespace, and we want
to pass down the optional dependence on serde to bitcoin_hashes, we need
to rename the feature to something other than serde. Right now only
features can be passed down to dependencies.

Note that we could have also renamed the dependency to something like
serde-dep and kept the same feature name, however, dependency renaming
has only been available since cargo 0.27.0

Features that represent optional dependencies have been prefixed with
'use-'. The travis file has also been modified to conform to this
change.
This commit is contained in:
Carl Dong 2019-01-15 18:34:48 -05:00
parent b6ec6a0d62
commit b88f00c698
3 changed files with 7 additions and 4 deletions

View File

@ -14,8 +14,8 @@ script:
- cargo test --verbose
- cargo build --verbose --features=bitcoinconsensus
- cargo test --verbose --features=bitcoinconsensus
- cargo build --verbose --features=serde
- cargo test --verbose --features=serde
- cargo build --verbose --features=use-serde
- cargo test --verbose --features=use-serde
- cargo build --verbose --features=serde-decimal
- cargo test --verbose --features=serde-decimal
- if [ "$(rustup show | grep default | grep stable)" != "" ]; then cd fuzz && cargo test --verbose && ./travis-fuzz.sh; fi

View File

@ -15,15 +15,17 @@ name = "bitcoin"
path = "src/lib.rs"
[features]
fuzztarget = ["secp256k1/fuzztarget"]
serde-decimal = ["serde", "strason"]
fuzztarget = ["secp256k1/fuzztarget", "bitcoin_hashes/fuzztarget"]
serde-decimal = ["use-serde", "strason"]
unstable = []
use-serde = ["serde", "bitcoin_hashes/serde"]
[dependencies]
bitcoin-bech32 = "0.8.0"
byteorder = "1.2"
rand = "0.3"
rust-crypto = "0.2"
bitcoin_hashes = "0.3"
bitcoinconsensus = { version = "0.16", optional = true }
[dependencies.serde]

View File

@ -42,6 +42,7 @@
#![deny(missing_docs)]
extern crate bitcoin_bech32;
extern crate bitcoin_hashes;
extern crate byteorder;
extern crate crypto;
extern crate hex;