Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix Dart code generation #484

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions scripts/generate_dart_codes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,34 @@ if [[ $# -gt 0 ]]; then
fi

if [ ! -d "$ROOT_DIR" ]; then
echo "Error: Directory $ROOT_DIR does not exist."
echo "\033[1;31mError: Directory $ROOT_DIR does not exist.\033[0m"
exit 1
fi

for dir in "$ROOT_DIR"/*/; do
if [ -f "$dir/pubspec.yaml" ]; then
echo "Found package in $dir"
echo "Running dart pub get in $dir"
echo "\033[1;32m====== Found package in $dir ======\033[0m"

echo "\033[1;34mRunning dart pub get in $dir\033[0m"
(cd "$dir" && dart pub get)
echo "Running build_runner in $dir"

echo "\033[1;34mRunning build_runner in $dir\033[0m"
(cd "$dir" && dart run build_runner build --delete-conflicting-outputs)

if [ $? -ne 0 ]; then
echo "\033[1;31mError during build_runner in $dir\033[0m"
echo "\033[1;33mRunning dart pub upgrade in $dir...\033[0m"

(cd "$dir" && dart pub upgrade)

echo "\033[1;34mRetrying build_runner in $dir after upgrading...\033[0m"
(cd "$dir" && dart run build_runner build --delete-conflicting-outputs)
fi

echo "\033[1;33mFinished processing $dir\033[0m"
else
echo "No pubspec.yaml found in $dir"
echo "\033[1;31mNo pubspec.yaml found in $dir\033[0m"
fi
done

echo "All packages processed."
echo "\033[1;32m======== All packages processed. ========\033[0m"
Loading