Consolidate variables

pull/4/head
Diego Barrios Romero 2018-11-16 18:46:38 +01:00
parent a5c8b8afaa
commit eb614c73a0
1 changed files with 7 additions and 6 deletions

View File

@ -1,24 +1,25 @@
set -exo pipefail set -exo pipefail
main() { main() {
export CARGO_OPTIONS="--target $TARGET"
if [[ ! $TARGET =~ .*linux.* ]]; then if [[ ! $TARGET =~ .*linux.* ]]; then
sed -i "s/linux-embedded-hal/#linux-embedded-hal/g" Cargo.toml sed -i "s/linux-embedded-hal/#linux-embedded-hal/g" Cargo.toml
sed -i "s/embedded-hal-mock/#embedded-hal-mock/g" Cargo.toml sed -i "s/embedded-hal-mock/#embedded-hal-mock/g" Cargo.toml
fi fi
if [ ! -z $FEATURES ]; then if [ ! -z $FEATURES ]; then
export FEATURES="--features $FEATURES" export CARGO_OPTIONS="$CARGO_OPTIONS --features $FEATURES"
fi fi
cargo check --target $TARGET $FEATURES cargo check $CARGO_OPTIONS
cargo build --target $TARGET --release $FEATURES cargo build $CARGO_OPTIONS
if [ -z $DISABLE_EXAMPLES ] && [[ $TARGET =~ .*linux.* ]]; then if [ -z $DISABLE_EXAMPLES ] && [[ $TARGET =~ .*linux.* ]]; then
cargo build --target $TARGET $FEATURES --examples cargo build $CARGO_OPTIONS --examples
fi fi
cargo doc --target $TARGET $FEATURES cargo doc $CARGO_OPTIONS
if [ -z $DISABLE_TESTS ] && [ $TRAVIS_RUST_VERSION = nightly ] && [[ $TARGET =~ .*linux.* ]]; then if [ -z $DISABLE_TESTS ] && [ $TRAVIS_RUST_VERSION = nightly ] && [[ $TARGET =~ .*linux.* ]]; then
cargo test --target $TARGET $FEATURES cargo test $CARGO_OPTIONS
fi fi
} }