-
Notifications
You must be signed in to change notification settings - Fork 20
/
build.bat
108 lines (82 loc) · 3.5 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
@echo on
if [%generator%] == [] call:usage generator
if [%INFINISPAN_VERSION%] == [] call:usage INFINISPAN_VERSION
if [%SWIG_DIR%] == [] call:usage SWIG_DIR
if [%SWIG_EXECUTABLE%] == [] call:usage SWIG_EXECUTABLE
if [%MVN_PROGRAM%] == [] call:usage MVN_PROGRAM
if [%PROTOBUF_LIBRARY%] == [] call:usage PROTOBUF_LIBRARY
if [%PROTOBUF_INCLUDE_DIR%] == [] call:usage PROTOBUF_INCLUDE_DIR
set JBOSS_HOME=%cd%\infinispan-server-%INFINISPAN_VERSION%
set JBOSS_ZIP=infinispan-server-%INFINISPAN_VERSION%.zip
set JBOSS_URL=http://download.jboss.org/infinispan/%INFINISPAN_VERSION%/%JBOSS_ZIP%
if not exist %JBOSS_HOME% (
if not exist %JBOSS_ZIP% (
powershell.exe -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (new-object System.Net.WebClient).DownloadFile('%JBOSS_URL%','%JBOSS_ZIP%')"
)
"C:\Program Files\7-zip\7z.exe" x %JBOSS_ZIP%
)
copy test\data\*.* %JBOSS_HOME%\server\conf /y
xcopy /E /I /Y %JBOSS_HOME%\server %JBOSS_HOME%\server1\
call:do_build %generator%
goto:eof
:do_build
setlocal
set build_dir=build_win
rem set PATH=%JAVA_HOME%\bin;%PATH%
echo "Using JAVA_HOME=%JAVA_HOME%"
if exist %build_dir% rmdir %build_dir% /s /q
mkdir %build_dir%
cd %build_dir%
if [%CLIENT_VERSION%] neq [] set V1=%CLIENT_VERSION:*/=%
for /f "tokens=1,2,3,4 delims=.-" %%a in ("%V1%") do (
set version_1major=%%a
set version_2minor=%%b
set version_3micro=%%c
set version_4qualifier=%%d
)
rem If empty or not a numnber, set values to default
if [%version_1major%] equ [] set version_1major=0
if [%version_2minor%] equ [] set version_2minor=1
if [%version_3micro%] equ [] set version_3micro=0
if [%version_4qualifier%] equ [] set version_4qualifier=SNAPSHOT
if 1%version_1major% neq +1%version_1major% set version_1major=0
if 1%version_2minor% neq +1%version_2minor% set version_2minor=1
if 1%version_3micro% neq +1%version_3micro% set version_3micro=0
set version_patch=%version_3micro%-%version_4qualifier%
call %JBOSS_HOME%\bin\cli.bat install org.openjdk.nashorn:nashorn-core:15.4 org.ow2.asm:asm:7.3.1 org.ow2.asm:asm-util:7.3.1
cmake -G "%~1" -DCPACK_PACKAGE_VERSION_MAJOR="%version_1major%" -DCPACK_PACKAGE_VERSION_MINOR="%version_2minor%" -DCPACK_PACKAGE_VERSION_PATCH="%version_patch%" -DSWIG_EXECUTABLE=%SWIG_EXECUTABLE% -DMVN_PROGRAM=%MVN_PROGRAM% -DPROTOBUF_LIBRARY="%PROTOBUF_LIBRARY%" -DPROTOBUF_PROTOC_LIBRARY="%PROTOBUF_PROTOC_LIBRARY%" -DProtobuf_INCLUDE_DIR="%PROTOBUF_INCLUDE_DIR%" -DPROTOBUF_INCLUDE_DIR="%PROTOBUF_INCLUDE_DIR%" -DPROTOBUF_PROTOC_EXECUTABLE="%PROTOBUF_PROTOC_EXECUTABLE%" -DOPENSSL_ROOT_DIR="%OPENSSL_ROOT_DIR%" -DNOENABLE_VALGRIND=OFF -DENABLE_VALGRIND=OFF ..
if %errorlevel% neq 0 goto fai
set home_drive=%CD:~0,2%
subst /D Y:
subst Y: .
Y:
PATH=Y:\RelWithDebInfo;%PATH%
cmake --build . --config RelWithDebInfo
if not "%buildTest%"=="skip" (
ctest -V --timeout 120
)
if %errorlevel% neq 0 goto fail
cpack -G ZIP -C RelWithDebInfo -DCPACK_PACKAGE_VERSION_MAJOR=%version_1major% -DCPACK_PACKAGE_VERSION_MINOR=%version_2minor% -DCPACK_PACKAGE_VERSION_PATCH="%version_patch%"
%home_drive%
subst /D Y:
if %errorlevel% neq 0 goto fail
endlocal
goto:eof
:usage
@echo "%~1" is null
@echo This script needs these env variables:
@echo generator: Cmake generator
@echo JAVA_HOME_64: Java home 64 bit
@echo INFINISPAN_VERSION: Version for the Infinispan server
@echo SWIG_DIR: Swig installation dir
@echo SWIG_EXECUTABLE: Swig executable
@echo MVN_PROGRAM: Mvn executable
()
exit /b 2
:fail
subst /D Y:
@echo off
echo "Failure!"
()
exit /b 1
:eof