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