#!/bin/sh gcloud=your-google-cloud-SDK-folder/bin/java_dev_appserver.sh aisources=your-path-to/appinventor-sources do_ant () { ant $1 -buildfile ~/Dev/Web/appinventor-sources/appinventor } display_help () { echo "Usage: ai [OPTIONS]..." echo "Run app inventor tasks like building and testing." echo echo " -a build all of App Inventor" echo " -b build Blockly" echo " -c build Components and install Companion" echo " -r run local webserver" echo " -t run tests" echo " -h, --help display this help text" echo } # Long options. # for var in "$@" do case "$var" in --help) display_help exit esac done # Save everything first so we can execute it in the right order. # while getopts 'abcirth' OPTION; do case "$OPTION" in a) buildAll=true ;; b) buildBlockly=true ;; c) buildComps=true ;; r) runWeb=true ;; t) doTests=true ;; h) display_help exit esac done shift "$(($OPTIND -1))" # Handle building first. # if [ $buildAll ] then do_ant elif [ $buildBlockly ] then do_ant noplay elif [ $buildComps ] then do_ant comps fi # Then handle other stuff. # [ $doTests ] && do_ant tests [ $runWeb ] && $gcloud --port=8888 --address=0.0.0.0 \ "${aisources}/appinventor/appengine/build/war"