Files
plezy/scripts/codegen.sh
T

29 lines
687 B
Bash
Raw Normal View History

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/.."
2026-07-12 00:28:24 +02:00
check=false
if [[ "${1:-}" == "--check" ]]; then
check=true
shift
fi
2026-05-18 22:52:51 +02:00
dart run slang
2026-07-12 00:28:24 +02:00
dart run build_runner build --delete-conflicting-outputs "$@"
if $check; then
generated_changes="$({
git diff --name-only -- lib
git ls-files --others --exclude-standard -- \
':(glob)lib/**/*.g.dart' \
':(glob)lib/**/*.freezed.dart'
} | grep -E '\.(g|freezed)\.dart$' || true)"
if [[ -n "$generated_changes" ]]; then
echo "Generated files are out of date:" >&2
printf ' %s\n' "$generated_changes" >&2
echo "Run 'scripts/codegen.sh' and commit the result." >&2
exit 1
fi
fi