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

Bitcoin hashes no default features #410

Merged
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
7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ default = ["std"]
std = ["secp256k1-sys/std"]
# allow use of Secp256k1::new and related API that requires an allocator
alloc = []
bitcoin-hashes-std = ["bitcoin_hashes/std"]
rand-std = ["rand/std"]
recovery = ["secp256k1-sys/recovery"]
lowmemory = ["secp256k1-sys/lowmemory"]
Expand All @@ -37,10 +38,12 @@ global-context-less-secure = []

[dependencies]
secp256k1-sys = { version = "0.4.2", default-features = false, path = "./secp256k1-sys" }
bitcoin_hashes = { version = "0.10", optional = true }
rand = { version = "0.6", default-features = false, optional = true }
serde = { version = "1.0", default-features = false, optional = true }

# You likely only want to enable these if you explicitly do not want to use "std", otherwise enable
# the respective -std feature e.g., bitcoin-hashes-std
bitcoin_hashes = { version = "0.10", default-features = false, optional = true }
rand = { version = "0.6", default-features = false, optional = true }

[dev-dependencies]
rand = "0.6"
Expand Down
13 changes: 10 additions & 3 deletions contrib/test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/sh -ex

# TODO: Add "alloc" once we bump MSRV to past 1.29
FEATURES="bitcoin_hashes global-context lowmemory rand rand-std recovery serde std"
FEATURES="bitcoin_hashes global-context lowmemory rand recovery serde std"
# These features are typically enabled along with the 'std' feature, so we test
# them together with 'std'.
STD_FEATURES="rand-std bitcoin-hashes-std"

# Use toolchain if explicitly specified
if [ -n "$TOOLCHAIN" ]
Expand Down Expand Up @@ -32,11 +35,15 @@ if [ "$DO_FEATURE_MATRIX" = true ]; then
cargo build --all --no-default-features --features="$feature"
cargo test --all --no-default-features --features="$feature"
done

# Features tested with 'std' feature enabled.
for feature in ${FEATURES}
do
cargo build --all --no-default-features --features="std,$feature"
cargo test --all --no-default-features --features="std,$feature"
done
# Other combos
RUSTFLAGS='--cfg=fuzzing' RUSTDOCFLAGS=$RUSTFLAGS cargo test --all
RUSTFLAGS='--cfg=fuzzing' RUSTDOCFLAGS=$RUSTFLAGS cargo test --all --features="$FEATURES"
cargo test --all --features="rand rand-std"
cargo test --all --features="rand serde"

if [ "$DO_BENCH" = true ]; then # proxy for us having a nightly compiler
Expand Down