Skip to content

Commit 8ebc871

Browse files
committed
Merged pull request mongodb#764
2 parents 30fa13e + a7576aa commit 8ebc871

File tree

9 files changed

+310
-13
lines changed

9 files changed

+310
-13
lines changed

.appveyor.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
image: Visual Studio 2015
2+
version: '{branch}.{build}'
3+
4+
cache:
5+
- c:\build-cache -> .appveyor.yml, .appveyor\*.cmd
6+
7+
environment:
8+
PHP_BUILD_CACHE_BASE_DIR: c:\build-cache
9+
PHP_BUILD_OBJ_DIR: c:\obj
10+
PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk
11+
PHP_BUILD_SDK_BRANCH: php-sdk-2.1.1
12+
SDK_REMOTE: https://github.com/OSTC/php-sdk-binary-tools.git
13+
SDK_BRANCH: php-sdk-2.1.1
14+
15+
matrix:
16+
- PHP_REL: 7.2
17+
ARCHITECTURE: x64
18+
ZTS_STATE: enable
19+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
20+
PHP_BUILD_CRT: vc15
21+
- PHP_REL: 7.2
22+
ARCHITECTURE: x64
23+
ZTS_STATE: disable
24+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
25+
PHP_BUILD_CRT: vc15
26+
- PHP_REL: 7.2
27+
ARCHITECTURE: x86
28+
ZTS_STATE: enable
29+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
30+
PHP_BUILD_CRT: vc15
31+
- PHP_REL: 7.2
32+
ARCHITECTURE: x86
33+
ZTS_STATE: disable
34+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
35+
PHP_BUILD_CRT: vc15
36+
- PHP_REL: 7.1
37+
ARCHITECTURE: x64
38+
ZTS_STATE: enable
39+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
40+
PHP_BUILD_CRT: vc14
41+
- PHP_REL: 7.1
42+
ARCHITECTURE: x86
43+
ZTS_STATE: disable
44+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
45+
PHP_BUILD_CRT: vc14
46+
- PHP_REL: 7.0
47+
ARCHITECTURE: x64
48+
ZTS_STATE: disable
49+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
50+
PHP_BUILD_CRT: vc14
51+
- PHP_REL: 7.0
52+
ARCHITECTURE: x86
53+
ZTS_STATE: enable
54+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
55+
PHP_BUILD_CRT: vc14
56+
57+
install:
58+
- .appveyor\install.cmd
59+
60+
build_script:
61+
- .appveyor\build.cmd

.appveyor/build.cmd

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@echo off
2+
3+
setlocal enableextensions enabledelayedexpansion
4+
set SDK_RUNNER=%PHP_BUILD_CACHE_SDK_DIR%\phpsdk-%PHP_BUILD_CRT%-%ARCHITECTURE%.bat
5+
if not exist "!SDK_RUNNER!" (
6+
echo "!SDK_RUNNER!" doesn't exist
7+
exit /b 3
8+
)
9+
10+
cmd /c !SDK_RUNNER! -t %APPVEYOR_BUILD_FOLDER%\.appveyor\build_task.cmd
11+
12+
if %errorlevel% neq 0 exit /b 3
13+
endlocal
14+
15+
exit /b 0

.appveyor/build_task.cmd

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
@echo off
2+
setlocal enableextensions enabledelayedexpansion
3+
4+
cd /D %APPVEYOR_BUILD_FOLDER%
5+
if %errorlevel% neq 0 exit /b 3
6+
7+
set STABILITY=staging
8+
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%PHP_REL%-%PHP_SDK_VC%-%PHP_SDK_ARCH%
9+
rem SDK is cached, deps info is cached as well
10+
echo Updating dependencies in %DEPS_DIR%
11+
cmd /c phpsdk_deps --update --no-backup --branch %PHP_REL% --stability %STABILITY% --deps %DEPS_DIR%
12+
if %errorlevel% neq 0 exit /b 3
13+
14+
rem Something went wrong, most likely when concurrent builds were to fetch deps
15+
rem updates. It might be, that some locking mechanism is needed.
16+
if not exist "%DEPS_DIR%" (
17+
cmd /c phpsdk_deps --update --force --no-backup --branch %PHP_REL% --stability %STABILITY% --deps %DEPS_DIR%
18+
)
19+
if %errorlevel% neq 0 exit /b 3
20+
21+
if "%ZTS_STATE%"=="enable" set ZTS_SHORT=ts
22+
if "%ZTS_STATE%"=="disable" set ZTS_SHORT=nts
23+
if "%ZTS_STATE%"=="enable" set ZTS_IN_FILENAME=
24+
if "%ZTS_STATE%"=="disable" set ZTS_IN_FILENAME=-nts
25+
if "%PHP_SDK_ARCH%"=="x86" set ARCH_IN_FILENAME=
26+
if "%PHP_SDK_ARCH%"=="x64" set ARCH_IN_FILENAME=-x86_64
27+
28+
cd /d C:\projects\php-src
29+
30+
cmd /c buildconf.bat --force
31+
32+
if %errorlevel% neq 0 exit /b 3
33+
34+
cmd /c configure.bat --disable-all --with-mp=auto --enable-cli --%ZTS_STATE%-zts --enable-json --with-openssl --enable-mongodb=shared --enable-object-out-dir=%PHP_BUILD_OBJ_DIR% --with-config-file-scan-dir=%APPVEYOR_BUILD_FOLDER%\build\modules.d --with-prefix=%APPVEYOR_BUILD_FOLDER%\build --with-php-build=%DEPS_DIR%
35+
36+
if %errorlevel% neq 0 exit /b 3
37+
38+
nmake /NOLOGO
39+
if %errorlevel% neq 0 exit /b 3
40+
41+
nmake install
42+
43+
if %errorlevel% neq 0 exit /b 3
44+
45+
mkdir c:\tests_tmp
46+
set TEST_PHP_EXECUTABLE=%APPVEYOR_BUILD_FOLDER%\build\php.exe
47+
set TEST_PHP_JUNIT=c:\tests_tmp\tests-junit.xml
48+
if "%OPCACHE%" equ "1" set TEST_PHP_ARGS=!TEST_PHP_ARGS! -d extension=%APPVEYOR_BUILD_FOLDER%\build\ext\php_opcache.so -d opcache.enable=1 -d opcache.enable_cli=1
49+
set TEST_PHP_ARGS=-n -d -foo=1 -d extension=%APPVEYOR_BUILD_FOLDER%\build\ext\php_mongodb.dll -dxdebug.remote_enable=1
50+
set SKIP_SLOW_TESTS=1
51+
set SKIP_DBGP_TESTS=1
52+
set SKIP_IPV6_TESTS=1
53+
set REPORT_EXIT_STATUS=1
54+
echo !TEST_PHP_EXECUTABLE! !TEST_PHP_ARGS! -v
55+
echo !TEST_PHP_EXECUTABLE! -n run-tests.php -q -x --show-diff --show-slow 1000 --set-timeout 120 -g FAIL,XFAIL,BORK,WARN,LEAK,SKIP --temp-source c:\tests_tmp --temp-target c:\tests_tmp %APPVEYOR_BUILD_FOLDER%\tests
56+
!TEST_PHP_EXECUTABLE! !TEST_PHP_ARGS! -v
57+
!TEST_PHP_EXECUTABLE! -n run-tests.php -q -x --show-diff %APPVEYOR_BUILD_FOLDER%\tests
58+
59+
set EXIT_CODE=%errorlevel%
60+
powershell -Command "$wc = New-Object 'System.Net.WebClient'; $wc.UploadFile('https://ci.appveyor.com/api/testresults/junit/%APPVEYOR_JOB_ID%', 'c:\tests_tmp\tests-junit.xml')"
61+
62+
rem We have run the tests, but we're *not* making that fail the build — yet
63+
rem if %EXIT_CODE% neq 0 exit /b 3
64+
65+
cd /d %APPVEYOR_BUILD_FOLDER%
66+
67+
if not exist "%APPVEYOR_BUILD_FOLDER%\build\ext\php_mongodb.dll" exit /b 3
68+
69+
xcopy %APPVEYOR_BUILD_FOLDER%\LICENSE %APPVEYOR_BUILD_FOLDER%\php_mongodb-%PHP_REL%-!ZTS_SHORT!-%PHP_BUILD_CRT%-%PHP_SDK_ARCH%\ /y /f
70+
echo F|xcopy %APPVEYOR_BUILD_FOLDER%\build\ext\php_mongodb.dll %APPVEYOR_BUILD_FOLDER%\php_mongodb-%PHP_REL%-!ZTS_SHORT!-%PHP_BUILD_CRT%-%PHP_SDK_ARCH%\php_mongodb-%APPVEYOR_REPO_TAG_NAME%-%PHP_REL%-%PHP_BUILD_CRT%!ZTS_IN_FILENAME!!ARCH_IN_FILENAME!.dll /y /f
71+
7z a php_mongodb-%APPVEYOR_REPO_TAG_NAME%-%PHP_REL%-%PHP_BUILD_CRT%!ZTS_IN_FILENAME!!ARCH_IN_FILENAME!.zip %APPVEYOR_BUILD_FOLDER%\php_mongodb-%PHP_REL%-!ZTS_SHORT!-%PHP_BUILD_CRT%-%PHP_SDK_ARCH%\*
72+
appveyor PushArtifact php_mongodb-%APPVEYOR_REPO_TAG_NAME%-%PHP_REL%-%PHP_BUILD_CRT%!ZTS_IN_FILENAME!!ARCH_IN_FILENAME!.zip -FileName php_mongodb-%APPVEYOR_REPO_TAG_NAME%-%PHP_REL%-%PHP_BUILD_CRT%!ZTS_IN_FILENAME!!ARCH_IN_FILENAME!.zip
73+
endlocal

.appveyor/install.cmd

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
@echo off
2+
setlocal enableextensions enabledelayedexpansion
3+
cinst wget
4+
5+
if not exist "%PHP_BUILD_CACHE_BASE_DIR%" (
6+
echo Creating %PHP_BUILD_CACHE_BASE_DIR%
7+
mkdir "%PHP_BUILD_CACHE_BASE_DIR%"
8+
)
9+
10+
if not exist "%PHP_BUILD_OBJ_DIR%" (
11+
echo Creating %PHP_BUILD_OBJ_DIR%
12+
mkdir "%PHP_BUILD_OBJ_DIR%"
13+
)
14+
15+
if not exist "%PHP_BUILD_CACHE_SDK_DIR%" (
16+
echo Cloning remote SDK repository
17+
git clone -q --depth=1 --branch %SDK_BRANCH% %SDK_REMOTE% "%PHP_BUILD_CACHE_SDK_DIR%"
18+
) else (
19+
echo Fetching remote SDK repository
20+
git --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" fetch --prune origin 2>&1
21+
echo Checkout SDK repository branch
22+
git --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" checkout --force %SDK_BRANCH%
23+
)
24+
25+
if "%PHP_REL%"=="master" (
26+
echo Cloning PHP master repository
27+
git clone -q --depth=1 --branch=%PHP_REL% https://github.com/php/php-src C:\projects\php-src
28+
) else (
29+
echo Cloning PHP %PHP_REL% repository
30+
git clone -q --depth=1 --branch=PHP-%PHP_REL% https://github.com/php/php-src C:\projects\php-src
31+
)
32+
33+
echo "Runnning sub-module fetch"
34+
git submodule update --init --recursive
35+
36+
xcopy %APPVEYOR_BUILD_FOLDER% C:\projects\php-src\ext\mongodb\ /s /e /y /q
37+
38+
xcopy %APPVEYOR_BUILD_FOLDER%\LICENSE %APPVEYOR_BUILD_FOLDER%\artifacts\ /y /f /q
39+
40+
if "%APPVEYOR%" equ "True" rmdir /s /q C:\cygwin >NUL 2>NUL
41+
if %errorlevel% neq 0 exit /b 3
42+
if "%APPVEYOR%" equ "True" rmdir /s /q C:\cygwin64 >NUL 2>NUL
43+
if %errorlevel% neq 0 exit /b 3
44+
if "%APPVEYOR%" equ "True" rmdir /s /q C:\mingw >NUL 2>NUL
45+
if %errorlevel% neq 0 exit /b 3
46+
if "%APPVEYOR%" equ "True" rmdir /s /q C:\mingw-w64 >NUL 2>NUL
47+
if %errorlevel% neq 0 exit /b 3
48+
49+
if "%APPVEYOR_REPO_TAG_NAME%"=="" (
50+
set APPVEYOR_REPO_TAG_NAME=%APPVEYOR_REPO_BRANCH%-%APPVEYOR_REPO_COMMIT:~0,8%
51+
for /f "delims=" %%l in (phongo_version.h) do (
52+
if not "%%l"=="" (
53+
set line=%%l
54+
if "!line:~8,20!"=="PHP_MONGODB_VERSION " (
55+
set APPVEYOR_REPO_TAG_NAME=!line:~29,-1!-%APPVEYOR_REPO_BRANCH%-%APPVEYOR_REPO_COMMIT:~0,8%
56+
)
57+
)
58+
)
59+
echo Final repo tag name: !APPVEYOR_REPO_TAG_NAME!
60+
61+
appveyor SetVariable -Name APPVEYOR_REPO_TAG_NAME -Value !APPVEYOR_REPO_TAG_NAME!
62+
)
63+
endlocal

CONTRIBUTING.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,31 +150,36 @@ changes in this maintenance branch. This is important because we will later
150150
merge the ensuing release commits up to master with `--strategy=ours`, which
151151
will ignore changes from the merged commits.
152152

153-
Update the version and stability constants in `php_phongo.h`. This should entail
154-
removing the version's "-dev" suffix and changing the stability to "stable":
153+
Update the version and stability constants in `phongo_version.h`. This should
154+
entail removing the version's "-dev" suffix, changing the stability to
155+
"stable", and increasing the last digit for `PHP_MONGO_VERSION_DESC`:
155156

156157
```
157158
#define PHP_MONGODB_VERSION "1.1.8-dev"
158159
#define PHP_MONGODB_STABILITY "devel"
160+
#define PHP_MONGODB_VERSION_DESC 1,1,8,0
159161
```
160162

161163
The above would be changed to:
162164

163165
```
164166
#define PHP_MONGODB_VERSION "1.1.8"
165167
#define PHP_MONGODB_STABILITY "stable"
168+
#define PHP_MONGODB_VERSION_DESC 1,1,8,1
166169
```
167170

168171
The Makefile targets for creating the PECL package depend on these constants, so
169-
you must rebuild the extension after updating `php_phongo.h`.
172+
you must rebuild the extension after updating `phongo_version.h`.
170173

171174
> **Note:** If this is an alpha or beta release, the version string should
172175
> include the X.Y.Z version followed by the stability and an increment. For
173176
> instance, the first beta release in the 1.4.0 series would be "1.4.0beta1".
174177
> Alpha and beta releases use "alpha" and "beta" stability strings,
175178
> respectively. Release candidates (e.g. "1.4.0RC1") also use "beta" stability.
176179
> See [Documenting release stability and API stability](https://pear.php.net/manual/en/guide.developers.package2.stability.php)
177-
> for more information.
180+
> for more information. For each change to the suffixes of
181+
> `PHP_MONGODB_VERSION`, increment the last digit of
182+
> `PHP_MONGODB_VERSION_DESC`.
178183
179184
### Publish PECL package
180185

@@ -195,10 +200,10 @@ one chance to confirm the package information after uploading.
195200

196201
### Commit version update and release notes
197202

198-
Commit the modified `php_phongo.h` file as "Package X.Y.Z"
203+
Commit the modified `phongo_version.h` file as "Package X.Y.Z"
199204

200205
```
201-
$ git add php_phongo.h
206+
$ git add phongo_version.h
202207
$ git commit -m "Package X.Y.Z"
203208
```
204209

@@ -212,25 +217,27 @@ $ git tag -a -m "Release X.Y.Z" X.Y.Z
212217

213218
### Update version info back to dev
214219

215-
After tagging, the version and stability constants in `php_phongo.h` should be
220+
After tagging, the version and stability constants in `phongo_version.h` should be
216221
updated back to development status.
217222

218223
```
219224
#define PHP_MONGODB_VERSION "1.1.8"
220225
#define PHP_MONGODB_STABILITY "stable"
226+
#define PHP_MONGODB_VERSION_DESC 1,1,8,1
221227
```
222228

223229
The above would be changed to:
224230

225231
```
226232
#define PHP_MONGODB_VERSION "1.1.9-dev"
227233
#define PHP_MONGODB_STABILITY "devel"
234+
#define PHP_MONGODB_VERSION_DESC 1,1,9,0
228235
```
229236

230237
Commit this change:
231238

232239
```
233-
$ git commit -m "Back to -dev" php_phongo.h
240+
$ git commit -m "Back to -dev" phongo_version.h
234241
```
235242

236243
> **Note:** If this is an alpha, beta, or RC release, the version string should

CREDITS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
MongoDB Driver for PHP
2-
Hannes Magnusson, Jeremy Mikola, Derick Rethans
2+
Hannes Magnusson, Jeremy Mikola, Derick Rethans, Katherine Walker

phongo_version.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright 2014-2018 MongoDB, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifndef PHONGO_VERSION_H
18+
#define PHONGO_VERSION_H
19+
20+
#define PHP_MONGODB_VERSION "1.5.0-dev"
21+
#define PHP_MONGODB_STABILITY "devel"
22+
#define PHP_MONGODB_VERSION_DESC 1,5,0,0
23+
24+
#endif /* PHONGO_VERSION_H */

php_phongo.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,13 @@
2121
#include "bson.h"
2222
#include "mongoc.h"
2323

24+
#include "phongo_version.h"
2425
#include "phongo_compat.h"
2526
#include "php_phongo_classes.h"
2627

2728
#define phpext_mongodb_ptr &mongodb_module_entry
2829
extern zend_module_entry mongodb_module_entry;
2930

30-
/* FIXME: Its annoying to bump version. Move into phongo_version.h.in */
31-
#define PHP_MONGODB_VERSION "1.5.0-dev"
32-
#define PHP_MONGODB_STABILITY "devel"
33-
3431
/* Structure for persisted libmongoc clients. The PID is included to ensure that
3532
* processes do not destroy clients created by other processes (relevant for
3633
* forking). We avoid using pid_t for Windows compatibility. */

0 commit comments

Comments
 (0)