-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgradlew.bat
57 lines (43 loc) · 1.02 KB
/
gradlew.bat
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
@echo off
setlocal enabledelayedexpansion
set CURR_PATH=%cd%
set REAL_GRADLEW=%CURR_PATH%\gradlew.bat
set REAL_MASTER_GRADLEW=%CURR_PATH%\master\gradlew.bat
rem Check current directory, which might be top directory for gradlew.bat
if exist %REAL_GRADLEW% (
goto :found
)
rem Check master next to current directory
if exist %REAL_MASTER_GRADLEW% (
goto :foundInMaster
)
:while1
call :getdir "%CURR_PATH%"
set REAL_GRADLEW=!CURR_PATH!\gradlew.bat
if exist !REAL_GRADLEW! (
goto :found
)
rem Need to check next for a master directory off to the side
set REAL_MASTER_GRADLEW=!CURR_PATH!\master\gradlew.bat
if exist !REAL_MASTER_GRADLEW! (
goto :foundInMaster
)
if "%CURR_PATH:~-1%" == ":" (
goto :notfound
)
goto :while1
:notfound
echo Unable to find gradlew.bat file upwards in filesystem
goto :goodbye
:found
call !REAL_GRADLEW! %*
goto :goodbye
:foundInMaster
call !REAL_MASTER_GRADLEW! %*
goto :goodbye
:goodbye
endlocal
goto :EOF
:getdir
set "CURR_PATH=%~dp1"
set "CURR_PATH=%CURR_PATH:~0,-1%"