Skip to content

Commit ef535ca

Browse files
authored
Implement AppVeyor (#3025)
Also implement build defines for Windows Set TELEGRAM_BUILD_DEFINES before calling gyp/refresh.bat Fix #3000 Signed-off-by: Christoph <[email protected]>
1 parent 8430897 commit ef535ca

File tree

8 files changed

+122
-5
lines changed

8 files changed

+122
-5
lines changed

.appveyor/install.bat

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
@echo off
2+
3+
SET BUILD_DIR=C:\TBuild
4+
set LIB_DIR=%BUILD_DIR%\Libraries
5+
set SRC_DIR=%BUILD_DIR%\tdesktop
6+
SET QT_VERSION=5_6_2
7+
8+
cd %BUILD_DIR%
9+
10+
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
11+
12+
call:configureBuild
13+
call:getDependencies
14+
call:setupGYP
15+
cd %SRC_DIR%
16+
17+
echo Finished!
18+
19+
GOTO:EOF
20+
21+
:: FUNCTIONS
22+
:logInfo
23+
echo [INFO] %~1
24+
GOTO:EOF
25+
26+
:getDependencies
27+
call:logInfo "Clone dependencies repository"
28+
git clone -q --branch=master https://github.com/telegramdesktop/dependencies_windows.git %LIB_DIR%
29+
cd %LIB_DIR%
30+
31+
call prepare.bat
32+
GOTO:EOF
33+
34+
:setupGYP
35+
call:logInfo "Setup GYP/Ninja and generate VS solution"
36+
cd %LIB_DIR%
37+
git clone https://chromium.googlesource.com/external/gyp
38+
SET PATH=%PATH%;C:\TBuild\Libraries\gyp;C:\TBuild\Libraries\ninja;
39+
cd %SRC_DIR%\Telegram
40+
call gyp\refresh.bat
41+
GOTO:EOF
42+
43+
:configureBuild
44+
call:logInfo "Configuring build"
45+
call:logInfo "Build version: %BUILD_VERSION%"
46+
set TELEGRAM_BUILD_DEFINES=
47+
48+
echo %BUILD_VERSION% | findstr /C:"disable_autoupdate">nul && (
49+
set TELEGRAM_BUILD_DEFINES=%TELEGRAM_BUILD_DEFINES%,TDESKTOP_DISABLE_AUTOUPDATE
50+
)
51+
52+
echo %BUILD_VERSION% | findstr /C:"disable_register_custom_scheme">nul && (
53+
set TELEGRAM_BUILD_DEFINES=%TELEGRAM_BUILD_DEFINES%,TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
54+
)
55+
56+
echo %BUILD_VERSION% | findstr /C:"disable_crash_reports">nul && (
57+
set TELEGRAM_BUILD_DEFINES=%TELEGRAM_BUILD_DEFINES%,TDESKTOP_DISABLE_CRASH_REPORTS
58+
)
59+
60+
echo %BUILD_VERSION% | findstr /C:"disable_network_proxy">nul && (
61+
set TELEGRAM_BUILD_DEFINES=%TELEGRAM_BUILD_DEFINES%,TDESKTOP_DISABLE_NETWORK_PROXY
62+
)
63+
64+
echo %BUILD_VERSION% | findstr /C:"disable_desktop_file_generation">nul && (
65+
set TELEGRAM_BUILD_DEFINES=%TELEGRAM_BUILD_DEFINES%,TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION
66+
)
67+
68+
echo %BUILD_VERSION% | findstr /C:"disable_unity_integration">nul && (
69+
set TELEGRAM_BUILD_DEFINES=%TELEGRAM_BUILD_DEFINES%,TDESKTOP_DISABLE_UNITY_INTEGRATION
70+
)
71+
72+
if not "%TELEGRAM_BUILD_DEFINES%" == "" (
73+
set "TELEGRAM_BUILD_DEFINES=%TELEGRAM_BUILD_DEFINES:~1%"
74+
)
75+
76+
call:logInfo "Build Defines: %TELEGRAM_BUILD_DEFINES%"
77+
GOTO:EOF

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33

44
# Ensure diffs have LF endings
55
*.diff text eol=lf
6+
*.bat text eol=crlf

.travis/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ buildTelegram() {
593593

594594
cd "$UPSTREAM/Telegram/gyp"
595595
"$GYP_PATH/gyp" \
596-
-Dtravis_defines=${GYP_DEFINES:1} \
596+
-Dbuild_defines=${GYP_DEFINES:1} \
597597
-Dlinux_path_xkbcommon=$XKB_PATH \
598598
-Dlinux_path_va=$VA_PATH \
599599
-Dlinux_path_vdpau=$VDPAU_PATH \

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ This is the complete source code and the build instructions for the alpha versio
44

55
[![Version](https://badge.fury.io/gh/telegramdesktop%2Ftdesktop.svg)](https://github.com/telegramdesktop/tdesktop/releases)
66
[![Build Status](https://travis-ci.org/telegramdesktop/tdesktop.svg?branch=master)](https://travis-ci.org/telegramdesktop/tdesktop)
7+
[![Build status](https://ci.appveyor.com/api/projects/status/uiw2y768iy4i5bu8/branch/master?svg=true)](https://ci.appveyor.com/project/telegramdesktop/tdesktop)
78

89
The source code is published under GPLv3 with OpenSSL exception, the license is available [here][license].
910

Telegram/gyp/Telegram.gyp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080

8181
'defines': [
8282
'AL_LIBTYPE_STATIC',
83-
'<!@(python -c "for s in \'<(travis_defines)\'.split(\',\'): print(s)")',
83+
'<!@(python -c "for s in \'<(build_defines)\'.split(\',\'): print(s)")',
8484
],
8585

8686
'include_dirs': [

Telegram/gyp/refresh.bat

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@ if exist "%FullScriptPath%..\..\..\Libraries\openssl\tmp32\lib.pdb" (
1313
)
1414
)
1515

16+
if "%TELEGRAM_BUILD_DEFINES%" == "" (
17+
set "TELEGRAM_BUILD_DEFINES= "
18+
)
19+
20+
set "BUILD_DEFINES=-Dbuild_defines=%TELEGRAM_BUILD_DEFINES%"
21+
1622
cd "%FullScriptPath%"
17-
call gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=ninja
23+
call gyp --depth=. --generator-output=../.. -Goutput_dir=out %BUILD_DEFINES% Telegram.gyp --format=ninja
1824
if %errorlevel% neq 0 goto error
19-
call gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=msvs-ninja
25+
call gyp --depth=. --generator-output=../.. -Goutput_dir=out %BUILD_DEFINES% Telegram.gyp --format=msvs-ninja
2026
if %errorlevel% neq 0 goto error
2127
cd ../..
2228

appveyor.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
image: Visual Studio 2015
2+
clone_folder: C:\TBuild\tdesktop
3+
test: off
4+
deploy: off
5+
6+
environment:
7+
matrix:
8+
- BUILD_VERSION:
9+
- BUILD_VERSION: disable_autoupdate
10+
- BUILD_VERSION: disable_register_custom_scheme
11+
- BUILD_VERSION: disable_crash_reports
12+
- BUILD_VERSION: disable_network_proxy
13+
- BUILD_VERSION: disable_desktop_file_generation
14+
- BUILD_VERSION: disable_unity_integration
15+
16+
matrix:
17+
fast_finish: true
18+
19+
install:
20+
- .\.appveyor\install.bat
21+
22+
build:
23+
project: Telegram.sln
24+
25+
artifacts:
26+
- path: out\Debug\Telegram.exe
27+
name: Telegram_debug.exe
28+
- path: out\Debug\Telegram.exe.pdb
29+
name: Telegram_debug.exe.pdb

doc/building-msvc.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,10 @@ run `git reset --hard HEAD` and execute `gclient` again
274274
git clone https://chromium.googlesource.com/external/gyp
275275
SET PATH=%PATH%;D:\TBuild\Libraries\gyp;D:\TBuild\Libraries\ninja;
276276
cd ..\tdesktop\Telegram
277-
gyp\refresh.bat
277+
278+
If you want to pass a build define (like `TDESKTOP_DISABLE_AUTOUPDATE` or `TDESKTOP_DISABLE_NETWORK_PROXY`), call `set TELEGRAM_BUILD_DEFINES=TDESKTOP_DISABLE_AUTOUPDATE,TDESKTOP_DISABLE_NETWORK_PROXY,...` (comma seperated string)
279+
280+
After, call `gyp\refresh.bat`
278281

279282
#### Configure VS
280283

0 commit comments

Comments
 (0)