-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfind-gradle
More file actions
executable file
·74 lines (70 loc) · 2.09 KB
/
find-gradle
File metadata and controls
executable file
·74 lines (70 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#
# The Gradle wrapper[1] is a simple and convenient way of making Gradle
# builds self-contained and reproducible. However, in multi-project
# builds, it can be cumbersome to type in relative paths e.g.:
# ./gradlew # when in root
# ../gradlew # when in subdir
#
# This script finds any Gradle wrapper (gradlew) executable in the
# current directory or any directory above it. If none can be found,
# it will fall back to the system-wide installation at $SYSTEM_GRADLE.
#
#
# INSTALLATION
#
# 1. Place this script somewhere on your PATH with precedence over GRADLE_HOME.
# For example, put this script in $HOME/bin and then add $HOME/bin as the
# first element on your $PATH.
##
# USAGE
#
# Use exactly like you would a normal Gradle executable. All arguments
# supplied are `exec`d against the gradle(w) executable once found.
#
# $ gradle [options]
#
#
# DEBUGGING
#
# To observe the search for gradlew and to ensure which one is
# ultimately used, invoke the script with Bash's "-x" option. Below you
# can see the directory traversal at work, finally selecting the
# 'gradlew' script one directory up from where 'gradle' was invoked.
#
# $ cd /Work/spring-framework/spring-context
# $ bash -x $(which gradle) --version
# + GRADLEW=/Work/spring-framework/spring-context/gradlew
# + GRADLEW=/Work/spring-framework/gradlew
# + /Work/spring-framework/gradlew --version
#
# ------------------------------------------------------------
# Gradle 1.11
# ------------------------------------------------------------
# ...
#
#
# AUTHOR
#
# Chris Beams (http://twitter.com/cbeams)
#
#
# BUGS
#
# It doesn't look for 'gradlew' in the root directory. Why would you
# want it to? Improvements welcome at http://github.com/cbeams/dotfiles.
#
# [1] http://gradle.org/docs/current/userguide/gradle_wrapper.html
#SYSTEM_GRADLE=/usr/local/Cellar/gradle/1.12/bin/gradle
OWD=$PWD
CWD=$PWD
until [ $CWD == / ]; do
GRADLEW=$CWD/gradlew
if [ -e $GRADLEW ]; then
exec $GRADLEW $@
fi
CWD=$(dirname $CWD)
cd $CWD
done
echo No Gradle wrapper found
cd $OWD
#exec $SYSTEM_GRADLE "$@"