language: rust
rust:
  - stable
  - nightly

os:
  - linux
  - osx
  - windows
  
env:
  matrix:
    - RELEASE=
    - RELEASE=--release

before_script:
# rustfmt may not always be available in nightly
- if [[ "$TRAVIS_RUST_VERSION" != *nightly* ]]; then rustup component add rustfmt; fi

script:
  # We cannot run `cargo test` with the mp4parse_fallible feature enabled
  # (see comment where the feature is defined in mp4parse_capi/Cargo.toml),
  # but we can at least check for changes behind features that would break the
  # build.
  - cargo check --all --verbose $RELEASE --tests --all-features
  - cargo test --all --verbose $RELEASE
  - cargo doc --package mp4parse_capi
  # The `false` after `echo` is necessary to avoid false negatives due to `echo` returning success
  - if [[ "$TRAVIS_RUST_VERSION" != *nightly* ]]; then cargo fmt -- --check || (echo "Please reformat your code with 'cargo fmt' (version $(cargo fmt -- --version))"; false); fi

language: rust
rust:
  - stable
  - nightly

os:
  - linux
  - osx
  - windows

env:
  matrix:
    - RELEASE=
    - RELEASE=--release

install:
  # rustfmt may not always be available in nightly
  - if [[ "$TRAVIS_RUST_VERSION" != *nightly* ]]; then rustup component add rustfmt; fi
  - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then T=x86_64-pc-windows-msvc; rustup target add $T; TARGET=--target=$T; fi

script:
  # We cannot run `cargo test` with the mp4parse_fallible feature enabled
  # (see comment where the feature is defined in mp4parse_capi/Cargo.toml),
  # but we can at least check for changes behind features that would break the
  # build.
  - cargo check --all --verbose $RELEASE --tests --all-features
  - cargo test --all --verbose $RELEASE $TARGET
  - cargo doc --package mp4parse_capi
  # The `false` after `echo` is necessary to avoid false negatives due to `echo` returning success
  - if [[ "$TRAVIS_RUST_VERSION" != *nightly* ]]; then cargo fmt -- --check || (echo "Please reformat your code with 'cargo fmt' (version $(cargo fmt -- --version))"; false); fi

Switch Windows CI builds from windows-gnu to windows-msvc.
Switch Windows CI builds from windows-gnu to windows-msvc.

The Travis default of windows-gnu suffers from rust-lang/rust#47048, I
think. I don't see an easy way to address this right now, but switching
our Windows builds to windows-msvc will avoid this and is more realistic
target anyway.
