This repository has been archived by the owner on Jun 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_calimero.bat
113 lines (84 loc) · 3.64 KB
/
build_calimero.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
@echo off
echo Build Calimero Project to Java 8
setlocal enabledelayedexpansion
::In order to not have to run prepare again
:: To set env variables explicitly
IF "%TOOLSPATH%"=="" ( call prepare.bat ) else set PATH=%TOOLSPATH%;%PATH%
if not exist "%START%out/calimero" mkdir "%START%out/calimero"
set START=%~dp0
set VERSION=2.5-SNAPSHOT
for /f tokens^=2-5^ delims^=.-_^" %%j in ('javac11 -fullversion 2^>^&1') do set "jver=%%j%%k"
echo Found java version %jver%
IF "%jver%" NEQ "110" (
echo Setting Java to Version 11
set JAVA_HOME=%JAVA11_HOME%
set path=%JAVA11_HOME%\bin;%PATH:)=^)%
)
::rmdir /S /Q out
CALL :BUILDCALIMERO calimero-core %VERSION%
IF ERRORLEVEL 1 (
echo [31m[FAILURE][0m Could not build calimero-core
EXIT /B 1
) ELSE echo [32m[SUCCESS][0m Build calimero-core
cd %START%
call 7za x "%START%source\calimero-core\build\distributions\calimero-core-%VERSION%.zip" -spe -bd -y -o"%START%source\calimero-core\build\distributions\"
call downpile.bat "%START%source\calimero-core\build\distributions\calimero-core-%VERSION%\lib\calimero-core-%VERSION%.jar"
cd %START%
IF ERRORLEVEL 1 (
echo [31m[FAILURE][0m Could not downpile calimero-core
EXIT /B 1
) ELSE echo [32m[SUCCESS][0m Downpiled calimero-core
CALL :BUILDCALIMERO calimero-device %VERSION%
IF ERRORLEVEL 1 (
echo [31m[FAILURE][0m Could not build calimero-device
EXIT /B 1
) ELSE echo [32m[SUCCESS][0m Build calimero-device
cd %START%
call downpile.bat "%START%source\calimero-device\build\libs\calimero-device-%VERSION%.jar" %_result% --lib "%START%source\calimero-core\build\distributions\calimero-core-%VERSION%\lib\calimero-core-%VERSION%.jar"
:: SETS %_result% with found CP
cd %START%
IF ERRORLEVEL 1 (
echo [31m[FAILURE][0m Could not downpile calimero-device
EXIT /B 1
) ELSE echo [32m[SUCCESS][0m Downpiled calimero-device
if not exist "%START%tmp\nrjavaserial-3.15.0.jar" wget --no-check-certificate -nv -O "%START%tmp\nrjavaserial-3.15.0.jar" "https://repo1.maven.org/maven2/com/neuronrobotics/nrjavaserial/3.15.0/nrjavaserial-3.15.0.jar"
IF ERRORLEVEL 1 (
echo [31m[FAILURE][0m Could not get nrjavaserial
EXIT /B 1
) ELSE echo [32m[SUCCESS][0m Got nrjavaserial
CALL :BUILDCALIMERO calimero-rxtx %VERSION%
IF ERRORLEVEL 1 (
echo [31m[FAILURE][0m Could not build calimero-rxtx
EXIT /B 1
) ELSE echo [32m[SUCCESS][0m Build calimero-rxtx
cd %START%
call downpile.bat "%START%source\calimero-rxtx\build\libs\calimero-rxtx-%VERSION%.jar" --lib "%START%tmp\nrjavaserial-3.15.0.jar" %_result%
cd %START%
IF ERRORLEVEL 1 (
echo [31m[FAILURE][0m Could not downpile calimero-rxtx
EXIT /B 1
) ELSE echo [32m[SUCCESS][0m Downpiled calimero-rxtx
move "%START%out\calimero*" "%START%out\calimero\"
GOTO :EOF
::EXIT /B 0
:BUILDCALIMERO
SETLOCAL
SET PROJECT=%1
SET VERSION=%2
echo Building: %PROJECT%-%VERSION%
:: if exist "%START%source/%PROJECT%" rmdir /S /Q "%START%source/%PROJECT%"
if not exist "%START%source/%PROJECT%" call git clone --quiet https://github.com/calimero-project/%PROJECT%.git "%START%source/%PROJECT%"
IF ERRORLEVEL 1 (
echo [31m[FAILURE][0m Could not clone %PROJECT%
EXIT /B 1
) ELSE echo [32m[SUCCESS][0m Cloned %PROJECT%
if "%PROJECT" EQU "calimero-rxrx" fart --c-style "source\calimero-rxtx\build.gradle" "mavenLocal()" "flatDir { dirs '../calimero-core/build/libs' }\r\n mavenLocal()"
cd "%START%source/%PROJECT%"
call gradlew build -x test
IF ERRORLEVEL 1 (
echo [31m[FAILURE][0m Could not build %PROJECT%
EXIT /B 1
) ELSE echo [32m[SUCCESS][0m Built %PROJECT%
cd %START%
ENDLOCAL
EXIT /B 0