#!/usr/bin/env bash # The media player interface compiles for Linux and Windows too. set -euo pipefail root=$(cd "$(dirname "$0")/../.." && pwd) targets=(x86_64-unknown-linux-gnu x86_64-pc-windows-msvc) installed=$(cd "$root" && rustup target list --installed) for target in "${targets[@]}"; do if ! grep -qx "$target" <<<"$installed"; then echo "SKIP: media-targets needs rustup target $target" exit 0 fi done work=$(mktemp -d) trap 'rm -rf "$work"' EXIT mkdir -p "$work/src" cp "$root/rust-toolchain.toml" "$work/" cat >"$work/Cargo.toml" <"$work/src/lib.rs" < anyhow::Result> { let player = media::Player::open(path)?; let _: media::State = player.state(); let (_, _): (bool, f64) = (player.playing(), player.position()); player.play(); player.pause(); player.seek(0.0); Ok(player.frame()) } RS for target in "${targets[@]}"; do (cd "$work" && cargo check --quiet --target "$target") \ || { echo "FAIL: media does not compile for $target"; exit 1; } done echo "media-targets: the player interface compiles for ${targets[*]}"