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 5function absPath { 6 python3 -c "import os.path; print(os.path.abspath('$1'))" 7} 8 9WORKING_DIR=$(pwd) 10PLAYGROUND_REL_PATH=$(dirname $0) 11SUPPORT_ROOT_ABS_PATH=$(absPath "$PLAYGROUND_REL_PATH/..") 12PLAYGROUND_ABS_PATH=$(absPath $PLAYGROUND_REL_PATH) 13 14# re-runs the playground setup script on the given folder 15function 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 22PLAYGROUND_SETTINGS_FILES=$(egrep -lr --include=settings.gradle "setupPlayground" $SUPPORT_ROOT_ABS_PATH) 23for SETTINGS_FILE in $PLAYGROUND_SETTINGS_FILES 24do 25 PROJECT_DIR=$(absPath $(dirname $SETTINGS_FILE)) 26 setupPlayground $PROJECT_DIR 27done 28