From ef535ca02616d73992b3920d1d44df3b6c0d32cd Mon Sep 17 00:00:00 2001 From: Christoph <auchri@users.noreply.github.com> Date: Sat, 18 Feb 2017 20:23:50 +0100 Subject: [PATCH] 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> --- .appveyor/install.bat | 77 +++++++++++++++++++++++++++++++++++++++ .gitattributes | 1 + .travis/build.sh | 2 +- README.md | 1 + Telegram/gyp/Telegram.gyp | 2 +- Telegram/gyp/refresh.bat | 10 ++++- appveyor.yml | 29 +++++++++++++++ doc/building-msvc.md | 5 ++- 8 files changed, 122 insertions(+), 5 deletions(-) create mode 100644 .appveyor/install.bat create mode 100644 appveyor.yml diff --git a/.appveyor/install.bat b/.appveyor/install.bat new file mode 100644 index 000000000..b5babe60d --- /dev/null +++ b/.appveyor/install.bat @@ -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 diff --git a/.gitattributes b/.gitattributes index 9ce0f35fa..d68bdaecf 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,3 +3,4 @@ # Ensure diffs have LF endings *.diff text eol=lf +*.bat text eol=crlf diff --git a/.travis/build.sh b/.travis/build.sh index 4e0806042..baa43cb27 100755 --- a/.travis/build.sh +++ b/.travis/build.sh @@ -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 \ diff --git a/README.md b/README.md index cc31cbb00..70c8813b6 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ This is the complete source code and the build instructions for the alpha versio [](https://github.com/telegramdesktop/tdesktop/releases) [](https://travis-ci.org/telegramdesktop/tdesktop) +[](https://ci.appveyor.com/project/telegramdesktop/tdesktop) The source code is published under GPLv3 with OpenSSL exception, the license is available [here][license]. diff --git a/Telegram/gyp/Telegram.gyp b/Telegram/gyp/Telegram.gyp index 45ab8cd27..eb4e9c112 100644 --- a/Telegram/gyp/Telegram.gyp +++ b/Telegram/gyp/Telegram.gyp @@ -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': [ diff --git a/Telegram/gyp/refresh.bat b/Telegram/gyp/refresh.bat index 4b6ca6a9f..a7cb0a14d 100644 --- a/Telegram/gyp/refresh.bat +++ b/Telegram/gyp/refresh.bat @@ -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 ../.. diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 000000000..f9d105328 --- /dev/null +++ b/appveyor.yml @@ -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 diff --git a/doc/building-msvc.md b/doc/building-msvc.md index 848e5a826..248efeb7d 100644 --- a/doc/building-msvc.md +++ b/doc/building-msvc.md @@ -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