forked from telegramdesktop/tdesktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Build.bat
195 lines (164 loc) · 5.85 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
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
@echo OFF
setlocal
FOR /F "tokens=1,2* delims= " %%i in (Version) do set "%%i=%%j"
set "VersionForPacker=%AppVersion%"
if %BetaVersion% neq 0 (
set "AppVersion=%BetaVersion%"
set "AppVersionStrFull=%AppVersionStr%_%BetaVersion%"
set "DevParam=-beta %BetaVersion%"
set "BetaKeyFile=tbeta_%BetaVersion%_key"
) else (
if %DevChannel% neq 0 (
set "DevParam=-dev"
set "AppVersionStrFull=%AppVersionStr%.dev"
) else (
set "DevParam="
set "AppVersionStrFull=%AppVersionStr%"
)
)
echo.
echo Building version %AppVersionStrFull% for Windows..
echo.
set "UpdateFile=tupdate%AppVersion%"
set "SetupFile=tsetup.%AppVersionStrFull%.exe"
set "PortableFile=tportable.%AppVersionStrFull%.zip"
set "HomePath=..\..\Telegram"
set "ReleasePath=..\Win32\Deploy"
set "DeployPath=%ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStrFull%"
set "SignPath=..\..\TelegramPrivate\Sign.bat"
set "BinaryName=Telegram"
set "DropboxSymbolsPath=Z:\Dropbox\Telegram\symbols"
if %BetaVersion% neq 0 (
if exist %DeployPath%\ (
echo Deploy folder for version %AppVersionStr% already exists!
exit /b 1
)
if exist %ReleasePath%\%BetaKeyFile% (
echo Beta version key file for version %AppVersion% already exists!
exit /b 1
)
) else (
if exist %ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStr%.dev\ (
echo Deploy folder for version %AppVersionStr%.dev already exists!
exit /b 1
)
if exist %ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStr%\ (
echo Deploy folder for version %AppVersionStr% already exists!
exit /b 1
)
if exist %ReleasePath%\tupdate%AppVersion% (
echo Update file for version %AppVersion% already exists!
exit /b 1
)
)
cd Resources\
if "%1" == "fast" (
echo Skipping touching of telegram.qrc..
) else (
copy telegram.qrc /B+,,/Y
)
cd ..\
if %errorlevel% neq 0 goto error
cd ..\
MSBuild Telegram.sln /property:Configuration=Deploy
cd Telegram\
if %errorlevel% neq 0 goto error
echo .
echo Version %AppVersionStrFull% build successfull. Preparing..
echo .
echo Dumping debug symbols..
call ..\..\Libraries\breakpad\src\tools\windows\binaries\dump_syms.exe %ReleasePath%\%BinaryName%.pdb > %ReleasePath%\%BinaryName%.sym
echo Done!
set "PATH=%PATH%;C:\Program Files\7-Zip;C:\Program Files (x86)\Inno Setup 5"
call %SignPath% %ReleasePath%\%BinaryName%.exe
if %errorlevel% neq 0 goto error
call %SignPath% %ReleasePath%\Updater.exe
if %errorlevel% neq 0 goto error
if %BetaVersion% equ 0 (
cd %ReleasePath%
iscc /dMyAppVersion=%AppVersionStrSmall% /dMyAppVersionZero=%AppVersionStr% /dMyAppVersionFull=%AppVersionStrFull% %HomePath%\Setup.iss
cd %HomePath%
if %errorlevel% neq 0 goto error
call %SignPath% %ReleasePath%\tsetup.%AppVersionStrFull%.exe
if %errorlevel% neq 0 goto error
)
cd %ReleasePath%
call Packer.exe -version %VersionForPacker% -path %BinaryName%.exe -path Updater.exe %DevParam%
cd %HomePath%
if %errorlevel% neq 0 goto error
if %BetaVersion% neq 0 (
if not exist %ReleasePath%\%BetaKeyFile% (
echo Beta version key file not found!
exit /b 1
)
FOR /F "tokens=1* delims= " %%i in (%ReleasePath%\%BetaKeyFile%) do set "BetaSignature=%%i"
)
if %errorlevel% neq 0 goto error
if %BetaVersion% neq 0 (
set "UpdateFile=%UpdateFile%_%BetaSignature%"
set "PortableFile=tbeta%BetaVersion%_%BetaSignature%.zip"
)
for /f ^"usebackq^ eol^=^
^ delims^=^" %%a in (%ReleasePath%\%BinaryName%.sym) do (
set "SymbolsHashLine=%%a"
goto symbolslinedone
)
:symbolslinedone
FOR /F "tokens=1,2,3,4* delims= " %%i in ("%SymbolsHashLine%") do set "SymbolsHash=%%l"
echo Copying %BinaryName%.sym to %DropboxSymbolsPath%\%BinaryName%.pdb\%SymbolsHash%
if not exist %DropboxSymbolsPath%\%BinaryName%.pdb mkdir %DropboxSymbolsPath%\%BinaryName%.pdb
if not exist %DropboxSymbolsPath%\%BinaryName%.pdb\%SymbolsHash% mkdir %DropboxSymbolsPath%\%BinaryName%.pdb\%SymbolsHash%
xcopy %ReleasePath%\%BinaryName%.sym %DropboxSymbolsPath%\%BinaryName%.pdb\%SymbolsHash%\
echo Done!
if not exist %ReleasePath%\deploy mkdir %ReleasePath%\deploy
if not exist %ReleasePath%\deploy\%AppVersionStrMajor% mkdir %ReleasePath%\deploy\%AppVersionStrMajor%
mkdir %DeployPath%
mkdir %DeployPath%\Telegram
if %errorlevel% neq 0 goto error
move %ReleasePath%\Telegram.exe %DeployPath%\Telegram\
move %ReleasePath%\Updater.exe %DeployPath%\
move %ReleasePath%\Telegram.pdb %DeployPath%\
move %ReleasePath%\Updater.pdb %DeployPath%\
if %BetaVersion% equ 0 (
move %ReleasePath%\%SetupFile% %DeployPath%\
) else (
move %ReleasePath%\%BetaKeyFile% %DeployPath%\
)
move %ReleasePath%\%UpdateFile% %DeployPath%\
if %errorlevel% neq 0 goto error
cd %DeployPath%\
7z a -mx9 %PortableFile% Telegram\
cd ..\..\..\%HomePath%\
if %errorlevel% neq 0 goto error
echo .
echo Version %AppVersionStrFull% is ready for deploy!
echo .
set "FinalReleasePath=Z:\TBuild\tother\tsetup"
set "FinalDeployPath=%FinalReleasePath%\%AppVersionStrMajor%\%AppVersionStrFull%"
if not exist %DeployPath%\%UpdateFile% goto error
if not exist %DeployPath%\%PortableFile% goto error
if %BetaVersion% equ 0 (
if not exist %DeployPath%\%SetupFile% goto error
)
if not exist %DeployPath%\%BinaryName%.pdb goto error
if not exist %DeployPath%\Updater.exe goto error
if not exist %DeployPath%\Updater.pdb goto error
if not exist %FinalReleasePath%\%AppVersionStrMajor% mkdir %FinalReleasePath%\%AppVersionStrMajor%
if not exist %FinalDeployPath% mkdir %FinalDeployPath%
xcopy %DeployPath%\%UpdateFile% %FinalDeployPath%\
xcopy %DeployPath%\%PortableFile% %FinalDeployPath%\
if %BetaVersion% equ 0 (
xcopy %DeployPath%\%SetupFile% %FinalDeployPath%\
) else (
xcopy %DeployPath%\%BetaKeyFile% %FinalDeployPath%\ /Y
)
xcopy %DeployPath%\%BinaryName%.pdb %FinalDeployPath%\
xcopy %DeployPath%\Updater.exe %FinalDeployPath%\
xcopy %DeployPath%\Updater.pdb %FinalDeployPath%\
echo Version %AppVersionStrFull% is ready!
goto eof
:error
echo ERROR occured!
if %errorlevel% neq 0 exit /b %errorlevel%
exit /b 1
:eof