monorepo/build.sh

52 lines
804 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
RUST_ALL_TARGETS=(
"dashboard"
"ifc"
"memorycache"
"geo-types"
"fluent-ergonomics"
"cyberpunk-splash"
"screenplay"
"emseries"
"coordinates"
"flow"
"sgf"
"changeset"
"hex-grid"
)
build_rust_targets() {
local CMD=$1
local TARGETS=${@/$CMD}
for target in $TARGETS; do
MODULE=$target CMD=$CMD ./builders/rust.sh
done
}
export CARGO=`which cargo`
if [ -z "${TARGET-}" ]; then
TARGET="all"
fi
if [ -z "${CMD-}" ]; then
CMD="test release"
fi
if [ "${CMD}" == "clean" ]; then
cargo clean
exit 0
fi
for cmd in $CMD; do
if [ "${TARGET}" == "all" ]; then
build_rust_targets $cmd ${RUST_ALL_TARGETS[*]}
else
build_rust_targets $cmd $TARGET
fi
done