xref: /PHP-7.1/appveyor/build.bat (revision 03f3b847)
1@echo off
2
3set SDK_REMOTE=https://github.com/OSTC/php-sdk-binary-tools.git
4set SDK_BRANCH=%PHP_BUILD_SDK_BRANCH%
5set SDK_RUNNER=%PHP_BUILD_CACHE_SDK_DIR%\phpsdk-vc14-%PLATFORM%.bat
6
7if not exist "%PHP_BUILD_CACHE_BASE_DIR%" (
8	echo Creating %PHP_BUILD_CACHE_BASE_DIR%
9	mkdir "%PHP_BUILD_CACHE_BASE_DIR%"
10)
11
12if not exist "%PHP_BUILD_OBJ_DIR%" (
13	echo Creating %PHP_BUILD_OBJ_DIR%
14	mkdir "%PHP_BUILD_OBJ_DIR%"
15)
16
17if not exist "%SDK_RUNNER%" (
18	if exist "%PHP_BUILD_CACHE_SDK_DIR%" rmdir /s /q "%PHP_BUILD_CACHE_SDK_DIR%"
19)
20
21if not exist "%PHP_BUILD_CACHE_SDK_DIR%" (
22	echo Cloning remote SDK repository
23	git clone --branch %SDK_BRANCH% %SDK_REMOTE% "%PHP_BUILD_CACHE_SDK_DIR%" 2>&1
24)
25
26for /f "tokens=*" %%a in ('type %PHP_BUILD_CACHE_SDK_DIR%\VERSION') do set GOT_SDK_VER=%%a
27echo Got SDK version %GOT_SDK_VER%
28if NOT "%GOT_SDK_VER%" == "%PHP_BUILD_SDK_BRANCH:~8%" (
29	echo Switching to the configured SDK version %SDK_BRANCH:~8%
30	echo Fetching remote SDK repository
31	git --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" fetch --prune origin 2>&1
32	echo Checkout SDK repository branch
33	git --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" checkout --force %SDK_BRANCH%
34)
35
36if not exist "%SDK_RUNNER%" (
37	echo "%SDK_RUNNER%" doesn't exist
38	exit /b 3
39)
40
41cmd /c %SDK_RUNNER% -t %APPVEYOR_BUILD_FOLDER%\appveyor\build_task.bat
42if %errorlevel% neq 0 exit /b 3
43
44exit /b 0
45