Yigit Boyar | 5592a0c | 2022-05-03 12:40:17 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # Helper script to update all playground setups when we make changes |
| 3 | # on how playground works (in other words, when we update setup-playground.sh). |
| 4 | |
| 5 | function absPath { |
| 6 | python3 -c "import os.path; print(os.path.abspath('$1'))" |
| 7 | } |
| 8 | |
| 9 | WORKING_DIR=$(pwd) |
| 10 | PLAYGROUND_REL_PATH=$(dirname $0) |
| 11 | SUPPORT_ROOT_ABS_PATH=$(absPath "$PLAYGROUND_REL_PATH/..") |
| 12 | PLAYGROUND_ABS_PATH=$(absPath $PLAYGROUND_REL_PATH) |
| 13 | |
| 14 | # re-runs the playground setup script on the given folder |
| 15 | function setupPlayground { |
| 16 | echo "setting up playground in $1" |
| 17 | cd $1 && $PLAYGROUND_ABS_PATH/setup-playground.sh |
| 18 | echo "finished setting up playground in $1" |
| 19 | } |
| 20 | |
| 21 | # find all playground settings files |
| 22 | PLAYGROUND_SETTINGS_FILES=$(egrep -lr --include=settings.gradle "setupPlayground" $SUPPORT_ROOT_ABS_PATH) |
| 23 | for SETTINGS_FILE in $PLAYGROUND_SETTINGS_FILES |
| 24 | do |
| 25 | PROJECT_DIR=$(absPath $(dirname $SETTINGS_FILE)) |
| 26 | setupPlayground $PROJECT_DIR |
| 27 | done |