Skip to content

Commit

Permalink
Merge pull request #830 from pinchbv/tools_scripts
Browse files Browse the repository at this point in the history
Update shell scripts to have more reuse
  • Loading branch information
stephanmantel authored May 27, 2024
2 parents e500e47 + bcf02e3 commit aab7264
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 72 deletions.
19 changes: 4 additions & 15 deletions tool/analyze.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
#!/bin/bash

cd ..
# Make foreach_module script executable, in case it isn't yet
chmod u+x foreach_module.sh

cd floor
flutter analyze
cd ..

cd floor_annotation
dart analyze --fatal-infos --fatal-warnings .
cd ..

cd floor_generator
dart analyze --fatal-infos --fatal-warnings .
cd ..

cd example
flutter analyze
# Run dart analyze . on every module
./foreach_module.sh 'dart analyze --fatal-infos --fatal-warnings .'
33 changes: 33 additions & 0 deletions tool/foreach_module.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

# This script lists all Flutter module folders in this project. Next it iterates over them
# and runs the passed in command in every one of those folders.
# Example usage: ./foreach_module.sh 'dart analyze .'

if [ $# -eq 0 ]; then
echo "No arguments supplied. Pass the desired command as a string argument.
For example: ./foreach_module.sh 'dart analyze .'"
fi

# All Flutter module folders
folders=(
example
floor
floor_annotation
floor_common
floor_ffi
floor_generator
)

# Navigate up one level from where this script lives
cd ..

# Iterate over the modules
for folder in "${folders[@]}"; do
# Navigate to the module folder, or continue to the next one if that fails
cd "$folder" || continue;
# Run the passed in command
$1
# Navigate back up to the root
cd ..
done
19 changes: 4 additions & 15 deletions tool/format.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
#!/bin/bash

cd ..
# Make foreach_module script executable, in case it isn't yet
chmod u+x foreach_module.sh

cd floor
dart format .
cd ..

cd floor_annotation
dart format .
cd ..

cd floor_generator
dart format .
cd ..

cd example
dart format .
# Run dart format . on every module
./foreach_module.sh 'dart format .'
7 changes: 7 additions & 0 deletions tool/generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# Make foreach_module script executable, in case it isn't yet
chmod u+x foreach_module.sh

# Run build_runner on every module
./foreach_module.sh 'dart run build_runner build --delete-conflicting-outputs'
4 changes: 0 additions & 4 deletions tool/generate_example_database.sh

This file was deleted.

4 changes: 0 additions & 4 deletions tool/generate_test_database.sh

This file was deleted.

19 changes: 4 additions & 15 deletions tool/get.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
#!/bin/bash

cd ..
# Make foreach_module script executable, in case it isn't yet
chmod u+x foreach_module.sh

cd floor
flutter packages pub get
cd ..

cd floor_annotation
flutter packages pub get
cd ..

cd floor_generator
flutter packages pub get
cd ..

cd example
flutter packages pub get
# Run flutter packages pub get on every module
./foreach_module.sh 'flutter packages pub get'
23 changes: 4 additions & 19 deletions tool/upgrade.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
#!/bin/bash

cd ..
# Make foreach_module script executable, in case it isn't yet
chmod u+x foreach_module.sh

cd floor
flutter packages pub upgrade
cd ..

cd floor_common
flutter packages pub upgrade
cd ..

cd floor_annotation
flutter packages pub upgrade
cd ..

cd floor_generator
flutter packages pub upgrade
cd ..

cd example
flutter packages pub upgrade
# Run flutter packages pub upgrade on every module
./foreach_module.sh 'flutter packages pub upgrade'

0 comments on commit aab7264

Please sign in to comment.