-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.bat
88 lines (68 loc) · 1.6 KB
/
build.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
@echo off
rem set the active directory
cd /D "%~dp0"
rem download python if it does not exist
python --version 2>NUL
if errorlevel 1 goto errorNoPython
echo python is installed
java -version 2>NUL
if errorlevel 1 goto errorNoJava
echo java is installed
goto setJavaHome
:continue
if not exist %~dp0tools\maven\bin\mvn.cmd goto installMavenTask
goto maven_installed
:maven_installed
echo maven is installed
goto buildTask
pause
pause
goto:eof
:errorNoPython
echo.
echo error^: python not installed
echo please install the latest version from https://www.python.org/downloads/
pause
:errorNoJava
echo.
echo error^: java not installed
echo please install the latest version from https://jdk.java.net/
pause
:installMavenTask
python scripts/install_maven.py
goto maven_installed
pause
:buildTask
echo starting build
rem run maven package task
%~dp0tools\maven\bin\mvn.cmd clean package
pause
:setJavaHomex64
set arch=64
for /d %%i in ("C:\Program Files\Java\jdk*") do set jdk=%%i
goto doSetJavaHome
pause
:setJavaHomex86
set arch=x86
for /d %%i in ("C:\Program Files (x86)\Java\jdk*") do set jdk=%%i
goto doSetJavaHome
pause
:setJavaHome
if exist "C:\Program Files\Java\" goto setJavaHomex64 else goto setJavaHomex86
:doSetJavaHome
if exist %~dp0tools\openjdk goto setToInstalledJDK
if "%jdk%"=="" goto noJDK
set JAVA_HOME=%jdk%
echo set java (%arch%) path to %JAVA_HOME%
goto continue
:setToInstalledJDK
set JAVA_HOME=%~dp0tools\openjdk
echo set java (64) path to %JAVA_HOME%
goto continue
:noJDK
echo no java jdk was detected
echo installing OpenJDK
python scripts/install_openjdk.py
goto setToInstalledJDK
:done
pause