forked from nextcloud/client-building
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.bat
114 lines (84 loc) · 4.11 KB
/
init.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
114
@echo off
setlocal EnableDelayedExpansion
cls
echo "***** Init started. (%~nx0)"
Rem ******************************************************************************************
rem "init: git clone everything, create folders"
Rem ******************************************************************************************
call "%~dp0/defaults.inc.bat"
Rem ******************************************************************************************
rem Reference: https://ss64.com/nt/setlocal.html
rem Reference: https://ss64.com/nt/start.html
echo "* BUILD_TARGETS=%BUILD_TARGETS%"
echo "* PROJECT_PATH=%PROJECT_PATH%"
echo "* WIN_GIT_PATH=%WIN_GIT_PATH%"
echo "* INSTALLER_OUTPUT_PATH=%INSTALLER_OUTPUT_PATH%"
Rem ******************************************************************************************
rem "check for required environment variables"
Rem ******************************************************************************************
call :testEnv PROJECT_PATH
call :testEnv BUILD_TARGETS
call :testEnv WIN_GIT_PATH
call :testEnv CUSTOMIZATION_SERVICE
if "%BUILD_INSTALLER%" == "1" (
call :testEnv INSTALLER_OUTPUT_PATH
)
if %ERRORLEVEL% neq 0 goto onError
Rem ******************************************************************************************
Rem Create directory for extra deployment resources (EXTRA_DEPLOY_PATH)
for %%G in (Debug, Release) do (
for %%H in (%BUILD_TARGETS%) do (
set EXTRA_DEPLOY_PATH=%PROJECT_PATH%/deploy-extra/%%G/%%H
echo "* Create extra deployment directory: !EXTRA_DEPLOY_PATH! (recursive)."
start "mkdir !EXTRA_DEPLOY_PATH!" /D "%PROJECT_PATH%/" /B /wait "%WIN_GIT_PATH%\usr\bin\mkdir.exe" -p "!EXTRA_DEPLOY_PATH!"
Rem Note: Force the use Git Bash's mkdir.exe, usually found in C:\Program Files\Git\usr\bin
Rem This also creates PROJECT_PATH if necessary.
if !ERRORLEVEL! neq 0 exit !ERRORLEVEL!
)
)
Rem Create output directory for the Installer
if "%BUILD_INSTALLER%" == "1" (
echo "* Create output directory for the Installer: %INSTALLER_OUTPUT_PATH% (recursive)."
start "mkdir %INSTALLER_OUTPUT_PATH%" /D "%PROJECT_PATH%/" /B /wait "%WIN_GIT_PATH%\usr\bin\mkdir.exe" -p "%INSTALLER_OUTPUT_PATH%"
)
if %ERRORLEVEL% neq 0 goto onError
Rem ******************************************************************************************
rem "qtkeychain"
Rem ******************************************************************************************
echo "* git clone qtkeychain."
start "git clone qtkeychain" /D "%PROJECT_PATH%/" /B /wait git clone https://github.com/frankosterfeld/qtkeychain
if %ERRORLEVEL% neq 0 goto onError
echo "* Create qtkeychain build directory (recursive)."
start "mkdir qtkeychain/build" /D "%PROJECT_PATH%/" /B /wait "%WIN_GIT_PATH%\usr\bin\mkdir.exe" -p "%PROJECT_PATH%/qtkeychain/build"
if %ERRORLEVEL% neq 0 goto onError
Rem ******************************************************************************************
rem "zlib"
Rem ******************************************************************************************
echo "* git clone zlib."
start "git clone zlib" /D "%PROJECT_PATH%/" /B /wait git clone https://github.com/madler/zlib.git
if %ERRORLEVEL% neq 0 goto onError
echo "* Create zlib build directory (recursive)."
start "mkdir zlib/build" /D "%PROJECT_PATH%/" /B /wait "%WIN_GIT_PATH%\usr\bin\mkdir.exe" -p "%PROJECT_PATH%/zlib/build"
if %ERRORLEVEL% neq 0 goto onError
echo "* git clone desktop %TAG_DESKTOP% at %PROJECT_PATH%/desktop/."
if "%CUSTOMIZATION_SERVICE%" == "1" (
set "GIT_CLONE_DEPTH="
) else (
set "GIT_CLONE_DEPTH=--depth=1"
)
start "git clone desktop %TAG_DESKTOP%" /B /wait git clone %GIT_CLONE_DEPTH% --branch=%TAG_DESKTOP% https://github.com/nextcloud/client %PROJECT_PATH%/desktop
if %ERRORLEVEL% neq 0 goto onError
Rem ******************************************************************************************
echo "***** Init finished. (%~nx0)"
exit 0
:onError
echo "***** Init 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