-
Notifications
You must be signed in to change notification settings - Fork 54
/
build_win.bat
217 lines (188 loc) · 6.38 KB
/
build_win.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: The main build script for CLIQZfox
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
ECHO [%TIME%] BUILD.CMD STARTS =========
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: BUILD PARAMETERS
::
:: All parameters are optional (with some default vaules)
:: CQZ_BUILD_ID - Timestamp in format YYYYMMDDHHMMSS. Internally used by Firefox
:: as MOZ_BUILD_DATE. In Cliqz browser on build process downloading
:: an extensions from predefined path, which based on this timestamp.
:: Default: will be taken last build id from repository.cliqz.com.
:: It must be not possible to upload files from developer machine to S3 bucket)
::
:: CQZ_WORKSPACE - path to source code.
:: Default: a folder from where this script will be running
::
:: CQZ_BUILD_64BIT_WINDOWS - flag to build 64-bit browser.
:: Default: not specified.
::
:: WIN_CERT - path to certificate for digital signing (path to cert)
:: Default: not specified, signing and futher steps will not procceed
:: WIN_CERT_PASS - password for udpate certificate
:: Default: not specified, signing and futher steps will not procceed
::
:: MAR_CERT - path to certificate for signing the update package (path to cert)
:: Default: not specified, signing and futher steps will not procceed
:: MAR_CERT_PASS - password for udpate certificate
:: Default: not specified, signing and futher steps will not procceed
::
:: CQZ_RELEASE_CHANNEL - which version to build
:: Default: beta
::
:: CQZ_BUILD_DE_LOCALIZATION - flag to build DE localization together with en-US
:: Default: not specified
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
IF "%CQZ_WORKSPACE%"=="" SET CQZ_WORKSPACE=%CD%
SET LANG=en-US
SET CQZ_CERT_DB_PATH=c:\certdb
SET BUILD_SHELL=c:\mozilla-build\start-shell.bat
:: Paths for build tools
SET TOOLTOOL_DIR=c:\build
SET MOZ_FETCHES_DIR=c:\build
SET CLZ_SIGNTOOL_PATH=%TOOLTOOL_DIR%\vs2017_15.9.10\SDK\bin\10.0.17763.0\x64\signtool.exe
:::::::::::::::::::::::::::::::::::
:: Information about build
:::::::::::::::::::::::::::::::::::
SET LOCALIZATION_INFO=Localization: en-US
IF "%CQZ_BUILD_DE_LOCALIZATION%"=="1" (
SET LOCALIZATION_INFO=%LOCALIZATION_INFO%, de
)
IF "%CQZ_BUILD_64BIT_WINDOWS%"=="1" (
SET PLATFORM_INFO=64 bit
) ELSE (
SET PLATFORM_INFO=32 bit
)
IF "%CQZ_RELEASE_CHANNEL%"=="" (
SET CHANNEL_INFO=beta
) ELSE (
SET CHANNEL_INFO=%CQZ_RELEASE_CHANNEL%
)
ECHO INFO: Build configuration - %CHANNEL_INFO% channel, %PLATFORM_INFO% (%LOCALIZATION_INFO%)
:::::::::::::::::::::::::::::::::::
:: CERTIFICATE DB SETUP
:::::::::::::::::::::::::::::::::::
ECHO INFO: Setting up cert db
RMDIR /S /Q %CQZ_CERT_DB_PATH%
MD %CQZ_CERT_DB_PATH%
CD /D C:\nss
certutil -N -d %CQZ_CERT_DB_PATH% -f emptypw.txt
@pk12util -i %MAR_CERT% -W %MAR_CERT_PASS% -d %CQZ_CERT_DB_PATH%
:::::::::::::::::::::::::::::::::::
:: Check and download build tools
:::::::::::::::::::::::::::::::::::
ECHO [%TIME%] INFO: Download build tools stage
ECHO cd $CQZ_WORKSPACE ^^^&^^^& ./download_windows_artifacts.sh | call %BUILD_SHELL%
IF ERRORLEVEL 1 (
ECHO [%TIME%] ERROR: Build failed! Exiting.
EXIT 1
)
:::::::::::::::::::::::::::::::::::
:: BUILD
:::::::::::::::::::::::::::::::::::
ECHO [%TIME%] INFO: Starting build
ECHO cd $CQZ_WORKSPACE ^^^&^^^& ./magic_build_and_package.sh --clobber --tests --symbols | call %BUILD_SHELL%
IF ERRORLEVEL 1 (
ECHO [%TIME%] ERROR: Build failed! Exiting.
EXIT 1
)
:::::::::::::::::::::::::::::::::::
:: SIGNING
:::::::::::::::::::::::::::::::::::
ECHO [%TIME%] INFO: Build successful. Signing...
CD /D %CQZ_WORKSPACE%
CALL sign_win.bat
IF ERRORLEVEL 1 (
ECHO [%TIME%] ERROR: Signing failed! Exiting.
EXIT 1
)
SET OLD_LANG=%LANG%
SET LANG=de
IF "%CQZ_BUILD_DE_LOCALIZATION%"=="1" (
CD /D %CQZ_WORKSPACE%
CALL sign_win.bat
IF ERRORLEVEL 1 (
ECHO [%TIME%] ERROR: Signing DE failed! Exiting.
EXIT 1
)
)
SET LANG=%OLD_LANG%
::::::::::::::::::::::::::::::::::::::::
:: SIGNING STUB INSTALLER, only 32-bit
::::::::::::::::::::::::::::::::::::::::
IF "%CQZ_BUILD_64BIT_WINDOWS%"=="1" GOTO inject_tag_area
ECHO [%TIME%] INFO: Build successful. Signing...
CD /D %CQZ_WORKSPACE%
set STUB_PREFIX=-stub
CALL sign_win.bat
IF ERRORLEVEL 1 (
ECHO [%TIME%] ERROR: Signing failed! Exiting.
EXIT 1
)
SET OLD_LANG=%LANG%
SET LANG=de
IF "%CQZ_BUILD_DE_LOCALIZATION%"=="1" (
CD /D %CQZ_WORKSPACE%
CALL sign_win.bat
IF ERRORLEVEL 1 (
ECHO [%TIME%] ERROR: Signing DE failed! Exiting.
EXIT 1
)
)
SET LANG=%OLD_LANG%
set STUB_PREFIX=
:::::::::::::::::::::::::::::::::::
:: INJECT TAG AREA
:::::::::::::::::::::::::::::::::::
:inject_tag_area
ECHO [%TIME%] INFO: Signing complete successful. Inject tagged area...
SET GOROOT=C:\Go
CD /D %CQZ_WORKSPACE%
CALL inject_tag_info.bat
IF ERRORLEVEL 1 (
ECHO [%TIME%] ERROR: Inject tag area failed! Exiting.
EXIT 1
)
SET OLD_LANG=%LANG%
SET LANG=de
IF "%CQZ_BUILD_DE_LOCALIZATION%"=="1" (
CD /D %CQZ_WORKSPACE%
CALL inject_tag_info.bat
IF ERRORLEVEL 1 (
ECHO [%TIME%] ERROR: Inject tag area into DE failed! Exiting.
EXIT 1
)
)
SET LANG=%OLD_LANG%
::::::::::::::::::::::::::::::::::::::::::::
:: Create and sign MSI installer (MSI0002)
::::::::::::::::::::::::::::::::::::::::::::
ECHO [%TIME%] INFO: Create and sign MSI package(s)
CD /D %CQZ_WORKSPACE%
CALL build_msi.bat
IF ERRORLEVEL 1 (
ECHO [%TIME%] ERROR: Create MSI failed! Exiting.
EXIT 1
)
SET OLD_LANG=%LANG%
SET LANG=de
IF "%CQZ_BUILD_DE_LOCALIZATION%"=="1" (
CD /D %CQZ_WORKSPACE%
CALL build_msi.bat
IF ERRORLEVEL 1 (
ECHO [%TIME%] ERROR: Create MSI failed! Exiting.
EXIT 1
)
)
SET LANG=%OLD_LANG%
:::::::::::::::::::::::::::::::::::
:: UPLOAD AND SUBMIT
:::::::::::::::::::::::::::::::::::
ECHO [%TIME%] INFO: Injected tag area successful. Uploading...
ECHO cd $CQZ_WORKSPACE ^^^&^^^& ./magic_upload_files.sh | call %BUILD_SHELL%
IF ERRORLEVEL 1 (
ECHO [%TIME%] ERROR: Upload failed! Exiting.
EXIT 1
)
ECHO [%TIME%] INFO: Upload successful. We are done here, thanks for watching.