forked from telegramdesktop/tdesktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuildWin.bat
123 lines (93 loc) · 3.92 KB
/
BuildWin.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
@echo OFF
FOR /F "tokens=1,2* delims= " %%i in (Version) do set "%%i=%%j"
if %DevChannel% neq 0 goto preparedev
set "DevParam="
set "AppVersionStrFull=%AppVersionStr%"
goto devprepared
:preparedev
set "DevParam=-dev"
set "AppVersionStrFull=%AppVersionStr%.dev"
:devprepared
echo.
echo Building version %AppVersionStrFull% for Windows..
echo.
if exist ..\Win32\Deploy\deploy\%AppVersionStrMajor%\%AppVersionStr%\ goto error_exist1
if exist ..\Win32\Deploy\deploy\%AppVersionStrMajor%\%AppVersionStr%.dev\ goto error_exist2
if exist ..\Win32\Deploy\tupdate%AppVersion% goto error_exist3
cd SourceFiles\
copy telegram.qrc /B+,,/Y
cd ..\
if %errorlevel% neq 0 goto error
cd ..\
MSBuild Telegram.sln /property:Configuration=Deploy
if %errorlevel% neq 0 goto error0
echo .
echo Version %AppVersionStrFull% build successfull! Preparing..
echo .
set "PATH=%PATH%;C:\Program Files\7-Zip;C:\Program Files (x86)\Inno Setup 5"
cd Win32\Deploy\
call ..\..\..\TelegramPrivate\Sign.bat Telegram.exe
if %errorlevel% neq 0 goto error1
call ..\..\..\TelegramPrivate\Sign.bat Updater.exe
if %errorlevel% neq 0 goto error1
iscc /dMyAppVersion=%AppVersionStrSmall% /dMyAppVersionZero=%AppVersionStr% /dMyAppVersionFull=%AppVersionStrFull% ..\..\Telegram\Setup.iss
if %errorlevel% neq 0 goto error1
call ..\..\..\TelegramPrivate\Sign.bat tsetup.%AppVersionStrFull%.exe
if %errorlevel% neq 0 goto error1
call Packer.exe -version %AppVersion% -path Telegram.exe -path Updater.exe %DevParam%
if %errorlevel% neq 0 goto error1
if not exist deploy mkdir deploy
if not exist deploy\%AppVersionStrMajor% mkdir deploy\%AppVersionStrMajor%
mkdir deploy\%AppVersionStrMajor%\%AppVersionStrFull%
mkdir deploy\%AppVersionStrMajor%\%AppVersionStrFull%\Telegram
if %errorlevel% neq 0 goto error1
move Telegram.exe deploy\%AppVersionStrMajor%\%AppVersionStrFull%\Telegram\
move Updater.exe deploy\%AppVersionStrMajor%\%AppVersionStrFull%\
move Telegram.pdb deploy\%AppVersionStrMajor%\%AppVersionStrFull%\
move Updater.pdb deploy\%AppVersionStrMajor%\%AppVersionStrFull%\
move tsetup.%AppVersionStrFull%.exe deploy\%AppVersionStrMajor%\%AppVersionStrFull%\
move tupdate%AppVersion% deploy\%AppVersionStrMajor%\%AppVersionStrFull%\
if %errorlevel% neq 0 goto error1
cd deploy\%AppVersionStrMajor%\%AppVersionStrFull%\
7z a -mx9 tportable.%AppVersionStrFull%.zip Telegram\
if %errorlevel% neq 0 goto error2
echo .
echo Version %AppVersionStrFull% is ready for deploy!
echo .
if not exist tupdate%AppVersion% goto error2
if not exist tportable.%AppVersionStrFull%.zip goto error2
if not exist tsetup.%AppVersionStrFull%.exe goto error2
if not exist Telegram.pdb goto error2
if not exist Updater.exe goto error2
if not exist Updater.pdb goto error2
if not exist Z:\TBuild\tother\tsetup\%AppVersionStrMajor% mkdir Z:\TBuild\tother\tsetup\%AppVersionStrMajor%
if not exist Z:\TBuild\tother\tsetup\%AppVersionStrMajor%\%AppVersionStrFull% mkdir Z:\TBuild\tother\tsetup\%AppVersionStrMajor%\%AppVersionStrFull%
xcopy tupdate%AppVersion% Z:\TBuild\tother\tsetup\%AppVersionStrMajor%\%AppVersionStrFull%\
xcopy tportable.%AppVersionStrFull%.zip Z:\TBuild\tother\tsetup\%AppVersionStrMajor%\%AppVersionStrFull%\
xcopy tsetup.%AppVersionStrFull%.exe Z:\TBuild\tother\tsetup\%AppVersionStrMajor%\%AppVersionStrFull%\
xcopy Telegram.pdb Z:\TBuild\tother\tsetup\%AppVersionStrMajor%\%AppVersionStrFull%\
xcopy Updater.exe Z:\TBuild\tother\tsetup\%AppVersionStrMajor%\%AppVersionStrFull%\
xcopy Updater.pdb Z:\TBuild\tother\tsetup\%AppVersionStrMajor%\%AppVersionStrFull%\
echo Version %AppVersionStrFull% is ready!
cd ..\..\..\..\..\Telegram\
goto eof
:error2
cd ..\..\..\
:error1
cd ..\..\
:error0
cd Telegram\
goto error
:error_exist1
echo Deploy folder for version %AppVersionStr% already exists!
exit /b 1
:error_exist2
echo Deploy folder for version %AppVersionStr%.dev already exists!
exit /b 1
:error_exist3
echo Update file for version %AppVersion% already exists!
exit /b 1
:error
echo ERROR occured!
exit /b %errorlevel%
:eof