Skip to content

Instantly share code, notes, and snippets.

@zhoulifu
Last active August 4, 2017 08:15
Show Gist options
  • Save zhoulifu/6fc3784d47badabaa71b0ae805215a13 to your computer and use it in GitHub Desktop.
Save zhoulifu/6fc3784d47badabaa71b0ae805215a13 to your computer and use it in GitHub Desktop.
A wrapper of gradle wrapper for saving time from typing './'
#!/usr/bin/env bash
echoGreen() { echo $'\e[0;32m'"$1"$'\e[0m'; }
echoYellow() { echo $'\e[0;33m'"$1"$'\e[0m'; }
abort() {
echoYellow "Command 'gradle' not found in your PATH."
echoYellow "And could not found 'gradlew' in current directory."
echoYellow "Abort."
exit 1
}
EXEC=`pwd`/gradlew
[[ -f $EXEC ]] || EXEC=`which gradle` || abort
echoGreen "Using gradle: $EXEC"
echo
exec "$EXEC" "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment