-
Notifications
You must be signed in to change notification settings - Fork 40
/
build.bat
94 lines (68 loc) · 3.14 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
@echo off
setlocal EnableDelayedExpansion
cls
echo "***** Build started. (%~nx0)"
Rem ******************************************************************************************
rem "Build everything"
Rem ******************************************************************************************
call "%~dp0/defaults.inc.bat" %1
Rem ******************************************************************************************
echo "* BUILD_TYPE=%BUILD_TYPE%"
echo "* BUILD_TARGETS=%BUILD_TARGETS%"
rem Reference: https://ss64.com/nt/setlocal.html
rem Reference: https://ss64.com/nt/start.html
Rem ******************************************************************************************
rem "check for required environment variables"
Rem ******************************************************************************************
call :testEnv PROJECT_PATH
call :testEnv BUILD_TYPE
call :testEnv BUILD_TARGETS
call :testEnv Png2Ico_EXECUTABLE
call :testEnv VS_VERSION
call :testEnv VCINSTALLDIR
call :testEnv WIN_GIT_PATH
if %ERRORLEVEL% neq 0 goto onError
Rem ******************************************************************************************
rem "desktop"
Rem ******************************************************************************************
echo "***** build desktop."
start "build-desktop.bat %BUILD_TYPE%" /D "%PROJECT_PATH%/" /B /wait "%~dp0/build-desktop.bat" %BUILD_TYPE%
if %ERRORLEVEL% neq 0 goto onError
Rem ******************************************************************************************
rem "collect files for the installer"
Rem ******************************************************************************************
echo "***** collect files for the installer."
start "build-installer-collect.bat %BUILD_TYPE%" /D "%PROJECT_PATH%/" /B /wait "%~dp0/build-installer-collect.bat" %BUILD_TYPE%
if %ERRORLEVEL% neq 0 goto onError
Rem ******************************************************************************************
rem "build the installer"
Rem ******************************************************************************************
if "%BUILD_INSTALLER%" == "0" (
echo "** Don't build the installer (disabled by BUILD_INSTALLER)"
) else (
echo "***** build the installer."
start "build-installer-exe.bat %BUILD_TYPE%" /D "%PROJECT_PATH%/" /B /wait "%~dp0/build-installer-exe.bat" %BUILD_TYPE%
)
if %ERRORLEVEL% neq 0 goto onError
Rem Note: Signing and upload of the installer is triggered by NSIS. see: nextcloud.nsi
if "%BUILD_INSTALLER_MSI%" == "0" (
echo "** Don't build the MSI installer (disabled by BUILD_INSTALLER_MSI)"
) else (
echo "***** build the MSI installer."
start "build-installer-msi.bat %BUILD_TYPE%" /D "%PROJECT_PATH%/" /B /wait "%~dp0/build-installer-msi.bat" %BUILD_TYPE%
)
if %ERRORLEVEL% neq 0 goto onError
Rem ******************************************************************************************
echo "***** Build finished. (%~nx0)"
exit 0
:onError
echo "***** Build FAILED! (%~nx0)"
if %ERRORLEVEL% neq 0 exit %ERRORLEVEL%
if !ERRORLEVEL! neq 0 exit !ERRORLEVEL!
exit 1
:testEnv
if "!%*!" == "" (
echo "Missing environment variable: %*"
exit /B 1
)
exit /B