Implement AppVeyor (#3025)

Also implement build defines for Windows
Set TELEGRAM_BUILD_DEFINES before calling gyp/refresh.bat

Fix #3000

Signed-off-by: Christoph <auer.chrisi@gmx.net>
This commit is contained in:
Christoph 2017-02-18 20:23:50 +01:00 committed by GitHub
parent 843089733b
commit ef535ca026
8 changed files with 122 additions and 5 deletions

77
.appveyor/install.bat Normal file
View File

@ -0,0 +1,77 @@
@echo off
SET BUILD_DIR=C:\TBuild
set LIB_DIR=%BUILD_DIR%\Libraries
set SRC_DIR=%BUILD_DIR%\tdesktop
SET QT_VERSION=5_6_2
cd %BUILD_DIR%
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
call:configureBuild
call:getDependencies
call:setupGYP
cd %SRC_DIR%
echo Finished!
GOTO:EOF
:: FUNCTIONS
:logInfo
echo [INFO] %~1
GOTO:EOF
:getDependencies
call:logInfo "Clone dependencies repository"
git clone -q --branch=master https://github.com/telegramdesktop/dependencies_windows.git %LIB_DIR%
cd %LIB_DIR%
call prepare.bat
GOTO:EOF
:setupGYP
call:logInfo "Setup GYP/Ninja and generate VS solution"
cd %LIB_DIR%
git clone https://chromium.googlesource.com/external/gyp
SET PATH=%PATH%;C:\TBuild\Libraries\gyp;C:\TBuild\Libraries\ninja;
cd %SRC_DIR%\Telegram
call gyp\refresh.bat
GOTO:EOF
:configureBuild
call:logInfo "Configuring build"
call:logInfo "Build version: %BUILD_VERSION%"
set TELEGRAM_BUILD_DEFINES=
echo %BUILD_VERSION% | findstr /C:"disable_autoupdate">nul && (
set TELEGRAM_BUILD_DEFINES=%TELEGRAM_BUILD_DEFINES%,TDESKTOP_DISABLE_AUTOUPDATE
)
echo %BUILD_VERSION% | findstr /C:"disable_register_custom_scheme">nul && (
set TELEGRAM_BUILD_DEFINES=%TELEGRAM_BUILD_DEFINES%,TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
)
echo %BUILD_VERSION% | findstr /C:"disable_crash_reports">nul && (
set TELEGRAM_BUILD_DEFINES=%TELEGRAM_BUILD_DEFINES%,TDESKTOP_DISABLE_CRASH_REPORTS
)
echo %BUILD_VERSION% | findstr /C:"disable_network_proxy">nul && (
set TELEGRAM_BUILD_DEFINES=%TELEGRAM_BUILD_DEFINES%,TDESKTOP_DISABLE_NETWORK_PROXY
)
echo %BUILD_VERSION% | findstr /C:"disable_desktop_file_generation">nul && (
set TELEGRAM_BUILD_DEFINES=%TELEGRAM_BUILD_DEFINES%,TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION
)
echo %BUILD_VERSION% | findstr /C:"disable_unity_integration">nul && (
set TELEGRAM_BUILD_DEFINES=%TELEGRAM_BUILD_DEFINES%,TDESKTOP_DISABLE_UNITY_INTEGRATION
)
if not "%TELEGRAM_BUILD_DEFINES%" == "" (
set "TELEGRAM_BUILD_DEFINES=%TELEGRAM_BUILD_DEFINES:~1%"
)
call:logInfo "Build Defines: %TELEGRAM_BUILD_DEFINES%"
GOTO:EOF

1
.gitattributes vendored
View File

@ -3,3 +3,4 @@
# Ensure diffs have LF endings
*.diff text eol=lf
*.bat text eol=crlf

View File

@ -593,7 +593,7 @@ buildTelegram() {
cd "$UPSTREAM/Telegram/gyp"
"$GYP_PATH/gyp" \
-Dtravis_defines=${GYP_DEFINES:1} \
-Dbuild_defines=${GYP_DEFINES:1} \
-Dlinux_path_xkbcommon=$XKB_PATH \
-Dlinux_path_va=$VA_PATH \
-Dlinux_path_vdpau=$VDPAU_PATH \

View File

@ -4,6 +4,7 @@ This is the complete source code and the build instructions for the alpha versio
[![Version](https://badge.fury.io/gh/telegramdesktop%2Ftdesktop.svg)](https://github.com/telegramdesktop/tdesktop/releases)
[![Build Status](https://travis-ci.org/telegramdesktop/tdesktop.svg?branch=master)](https://travis-ci.org/telegramdesktop/tdesktop)
[![Build status](https://ci.appveyor.com/api/projects/status/uiw2y768iy4i5bu8/branch/master?svg=true)](https://ci.appveyor.com/project/telegramdesktop/tdesktop)
The source code is published under GPLv3 with OpenSSL exception, the license is available [here][license].

View File

@ -80,7 +80,7 @@
'defines': [
'AL_LIBTYPE_STATIC',
'<!@(python -c "for s in \'<(travis_defines)\'.split(\',\'): print(s)")',
'<!@(python -c "for s in \'<(build_defines)\'.split(\',\'): print(s)")',
],
'include_dirs': [

View File

@ -13,10 +13,16 @@ if exist "%FullScriptPath%..\..\..\Libraries\openssl\tmp32\lib.pdb" (
)
)
if "%TELEGRAM_BUILD_DEFINES%" == "" (
set "TELEGRAM_BUILD_DEFINES= "
)
set "BUILD_DEFINES=-Dbuild_defines=%TELEGRAM_BUILD_DEFINES%"
cd "%FullScriptPath%"
call gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=ninja
call gyp --depth=. --generator-output=../.. -Goutput_dir=out %BUILD_DEFINES% Telegram.gyp --format=ninja
if %errorlevel% neq 0 goto error
call gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=msvs-ninja
call gyp --depth=. --generator-output=../.. -Goutput_dir=out %BUILD_DEFINES% Telegram.gyp --format=msvs-ninja
if %errorlevel% neq 0 goto error
cd ../..

29
appveyor.yml Normal file
View File

@ -0,0 +1,29 @@
image: Visual Studio 2015
clone_folder: C:\TBuild\tdesktop
test: off
deploy: off
environment:
matrix:
- BUILD_VERSION:
- BUILD_VERSION: disable_autoupdate
- BUILD_VERSION: disable_register_custom_scheme
- BUILD_VERSION: disable_crash_reports
- BUILD_VERSION: disable_network_proxy
- BUILD_VERSION: disable_desktop_file_generation
- BUILD_VERSION: disable_unity_integration
matrix:
fast_finish: true
install:
- .\.appveyor\install.bat
build:
project: Telegram.sln
artifacts:
- path: out\Debug\Telegram.exe
name: Telegram_debug.exe
- path: out\Debug\Telegram.exe.pdb
name: Telegram_debug.exe.pdb

View File

@ -274,7 +274,10 @@ run `git reset --hard HEAD` and execute `gclient` again
git clone https://chromium.googlesource.com/external/gyp
SET PATH=%PATH%;D:\TBuild\Libraries\gyp;D:\TBuild\Libraries\ninja;
cd ..\tdesktop\Telegram
gyp\refresh.bat
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)
After, call `gyp\refresh.bat`
#### Configure VS