-
-
Save ae6rt/6227681 to your computer and use it in GitHub Desktop.
A shell script which searches the current working directory and upward for Gradle gradlew wrapper script. Place the file on your path and make it executable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -u | |
FOUND=0 | |
CURR_PATH="$PWD" | |
REAL_GRADLEW="$CURR_PATH/gradlew" | |
if [ -x "$REAL_GRADLEW" ] | |
then | |
FOUND=1 | |
else | |
while [ "$CURR_PATH" != "/" ] | |
do | |
CURR_PATH=$(dirname "$CURR_PATH") | |
REAL_GRADLEW="$CURR_PATH/gradlew" | |
if [ -x "$REAL_GRADLEW" ] | |
then | |
FOUND=1 | |
break | |
fi | |
done | |
fi | |
if [ $FOUND -eq 1 ] | |
then | |
$REAL_GRADLEW "$@" | |
else | |
echo "Unable to find gradlew file upwards in filesystem" | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment