83 lines
2.1 KiB
Bash
83 lines
2.1 KiB
Bash
#!/usr/bin/env bash
|
|
#
|
|
# Build (and optionally test) all module solutions under src/.
|
|
#
|
|
# Usage:
|
|
# ./scripts/build-all-solutions.sh # build only
|
|
# ./scripts/build-all-solutions.sh --test # build + test
|
|
# ./scripts/build-all-solutions.sh --test --configuration Release
|
|
|
|
set -euo pipefail
|
|
|
|
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
SRC_DIR="$REPO_ROOT/src"
|
|
|
|
RUN_TESTS=false
|
|
CONFIGURATION="Debug"
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--test|-t) RUN_TESTS=true; shift ;;
|
|
--configuration|-c) CONFIGURATION="$2"; shift 2 ;;
|
|
*) echo "Unknown option: $1" >&2; exit 1 ;;
|
|
esac
|
|
done
|
|
|
|
# Discover solutions (exclude root StellaOps.sln)
|
|
mapfile -t SOLUTIONS < <(find "$SRC_DIR" -name '*.sln' ! -name 'StellaOps.sln' | sort)
|
|
|
|
if [[ ${#SOLUTIONS[@]} -eq 0 ]]; then
|
|
echo "ERROR: No solution files found under src/." >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "Found ${#SOLUTIONS[@]} solution(s) to build."
|
|
echo ""
|
|
|
|
build_pass=()
|
|
build_fail=()
|
|
test_pass=()
|
|
test_fail=()
|
|
|
|
for sln in "${SOLUTIONS[@]}"; do
|
|
rel="${sln#"$REPO_ROOT/"}"
|
|
echo "--- BUILD: $rel ---"
|
|
|
|
if dotnet build "$sln" --configuration "$CONFIGURATION" --nologo -v quiet; then
|
|
build_pass+=("$rel")
|
|
else
|
|
build_fail+=("$rel")
|
|
echo " FAILED"
|
|
continue
|
|
fi
|
|
|
|
if $RUN_TESTS; then
|
|
echo "--- TEST: $rel ---"
|
|
if dotnet test "$sln" --configuration "$CONFIGURATION" --nologo --no-build -v quiet; then
|
|
test_pass+=("$rel")
|
|
else
|
|
test_fail+=("$rel")
|
|
echo " TEST FAILED"
|
|
fi
|
|
fi
|
|
done
|
|
|
|
echo ""
|
|
echo "========== Summary =========="
|
|
echo "Build passed : ${#build_pass[@]}"
|
|
if [[ ${#build_fail[@]} -gt 0 ]]; then
|
|
echo "Build failed : ${#build_fail[@]}"
|
|
for f in "${build_fail[@]}"; do echo " - $f"; done
|
|
fi
|
|
if $RUN_TESTS; then
|
|
echo "Test passed : ${#test_pass[@]}"
|
|
if [[ ${#test_fail[@]} -gt 0 ]]; then
|
|
echo "Test failed : ${#test_fail[@]}"
|
|
for f in "${test_fail[@]}"; do echo " - $f"; done
|
|
fi
|
|
fi
|
|
|
|
if [[ ${#build_fail[@]} -gt 0 ]] || [[ ${#test_fail[@]} -gt 0 ]]; then
|
|
exit 1
|
|
fi
|