Created
July 2, 2013 21:08
-
-
Save breskeby/5913145 to your computer and use it in GitHub Desktop.
This file contains 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 | |
FOUND=0 | |
CURR_PATH="$PWD" | |
REAL_GRADLEW="$CURR_PATH/gradlew" | |
REAL_MASTER_GRADLEW="$CURR_PATH/master/gradlew" | |
# Check current directory, which might be root directory for gradlew | |
if [ -x "$REAL_GRADLEW" ]; then | |
FOUND=1 | |
elif [ -x "$REAL_MASTER_GRADLEW" ]; then | |
FOUND=2 | |
else | |
while [ "$CURR_PATH" != "/" ]; do | |
CURR_PATH=$(dirname "$CURR_PATH") | |
REAL_GRADLEW="$CURR_PATH/gradlew" | |
if [ -x "$REAL_GRADLEW" ]; then | |
FOUND=1 | |
break | |
fi | |
REAL_MASTER_GRADLEW="$CURR_PATH/master/gradlew" | |
if [ -x "$REAL_MASTER_GRADLEW" ]; then | |
FOUND=2 | |
break | |
fi | |
done | |
fi | |
if [ $FOUND -eq 1 ]; then | |
"$REAL_GRADLEW" "$@" | |
elif [ $FOUND -eq 2 ]; then | |
"$REAL_MASTER_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
This is a custom gradlew script, that you can put on your bash path. It delegates to the gradlew script in the root project folder. It allows you to run a gradle build from a subdirectory using the wrapper. I havn't created this one on my own, but don't remember anymore where I found it.