1 <?xml version="1.0" encoding="UTF-8"?>
2 <project name="phpunit" default="setup">
3 <target name="setup" depends="clean,install-dependencies"/>
4 <target name="validate" depends="php-syntax-check,validate-composer-json,validate-phpunit-xsd"/>
6 <target name="clean" unless="clean.done" description="Cleanup build artifacts">
7 <delete dir="${basedir}/bin"/>
8 <delete dir="${basedir}/vendor"/>
9 <delete file="${basedir}/composer.lock"/>
10 <delete dir="${basedir}/build/documentation"/>
11 <delete dir="${basedir}/build/logfiles"/>
12 <delete dir="${basedir}/build/phar"/>
14 <fileset dir="${basedir}/build">
15 <include name="**/phpunit*.phar"/>
16 <include name="**/phpunit*.phar.asc"/>
20 <property name="clean.done" value="true"/>
23 <target name="prepare" unless="prepare.done" depends="clean" description="Prepare for build">
24 <mkdir dir="${basedir}/build/documentation"/>
25 <mkdir dir="${basedir}/build/logfiles"/>
26 <property name="prepare.done" value="true"/>
29 <target name="validate-composer-json" unless="validate-composer-json.done" description="Validate composer.json">
30 <exec executable="${basedir}/build/tools/composer" failonerror="true" taskname="composer">
31 <arg value="validate"/>
32 <arg value="--no-check-lock"/>
33 <arg value="--strict"/>
34 <arg value="${basedir}/composer.json"/>
37 <property name="validate-composer-json.done" value="true"/>
40 <target name="-dependencies-installed">
41 <available file="${basedir}/composer.lock" property="dependencies-installed"/>
44 <target name="install-dependencies" unless="dependencies-installed" depends="-dependencies-installed,validate-composer-json" description="Install dependencies with Composer">
45 <exec executable="${basedir}/build/tools/composer" taskname="composer">
47 <arg value="--no-interaction"/>
48 <arg value="--no-progress"/>
49 <arg value="--no-ansi"/>
50 <arg value="--no-suggest"/>
51 <arg value="--optimize-autoloader"/>
52 <arg value="--prefer-stable"/>
56 <target name="php-syntax-check" unless="php-syntax-check.done" description="Perform syntax check on PHP files">
57 <apply executable="php" failonerror="true" taskname="lint">
60 <fileset dir="${basedir}/src">
61 <include name="**/*.php"/>
65 <fileset dir="${basedir}/tests">
66 <include name="**/*.php"/>
71 <property name="php-syntax-check.done" value="true"/>
74 <target name="validate-phpunit-xsd" unless="validate-phpunit-xsd.done" description="Validate phpunit.xsd">
75 <exec executable="xmllint" failonerror="true" taskname="xmllint">
76 <arg value="--noout"/>
77 <arg path="${basedir}/phpunit.xsd"/>
80 <property name="validate-phpunit-xsd.done" value="true"/>
83 <target name="test" depends="validate,install-dependencies" description="Run tests">
84 <exec executable="${basedir}/phpunit" taskname="phpunit"/>
87 <target name="signed-phar" depends="phar" description="Create signed PHAR archive of PHPUnit and all its dependencies">
88 <exec executable="gpg" failonerror="true">
89 <arg value="--local-user"/>
90 <arg value="sb@sebastian-bergmann.de"/>
91 <arg value="--armor"/>
92 <arg value="--detach-sign"/>
93 <arg path="${basedir}/build/phpunit-library-${version}.phar"/>
96 <exec executable="gpg" failonerror="true">
97 <arg value="--local-user"/>
98 <arg value="sb@sebastian-bergmann.de"/>
99 <arg value="--armor"/>
100 <arg value="--detach-sign"/>
101 <arg path="${basedir}/build/phpunit-${version}.phar"/>
105 <target name="phar" depends="-phar-determine-version,-phar-prepare" description="Create PHAR archive of PHPUnit and all its dependencies">
106 <antcall target="-phar-build">
107 <param name="type" value="release"/>
111 <target name="phar-nightly" depends="-phar-prepare" description="Create PHAR archive of PHPUnit and all its dependencies (nightly)">
112 <antcall target="-phar-build">
113 <param name="type" value="nightly"/>
117 <target name="-phar-prepare" depends="clean,install-dependencies">
118 <mkdir dir="${basedir}/build/phar"/>
119 <copy file="${basedir}/composer.json" tofile="${basedir}/composer.json.bak"/>
121 <exec executable="${basedir}/build/tools/composer">
122 <arg value="require"/>
123 <arg value="phpunit/dbunit:~1.4"/>
124 <arg value="phpunit/phpunit-selenium:~1.4"/>
125 <arg value="phpunit/php-invoker:~1.1"/>
128 <move file="${basedir}/composer.json.bak" tofile="${basedir}/composer.json"/>
130 <exec executable="${basedir}/build/phar-manifest.php" output="${basedir}/build/phar/manifest.txt"/>
131 <copy todir="${basedir}/build/phar" file="${basedir}/build/ca.pem"/>
133 <copy file="${basedir}/vendor/phpunit/php-code-coverage/LICENSE"
134 tofile="${basedir}/build/phar/php-code-coverage/LICENSE"/>
135 <copy todir="${basedir}/build/phar/php-code-coverage">
136 <fileset dir="${basedir}/vendor/phpunit/php-code-coverage/src">
137 <include name="**/*"/>
141 <copy file="${basedir}/vendor/phpunit/php-file-iterator/LICENSE"
142 tofile="${basedir}/build/phar/php-file-iterator/LICENSE"/>
143 <copy todir="${basedir}/build/phar/php-file-iterator">
144 <fileset dir="${basedir}/vendor/phpunit/php-file-iterator/src">
145 <include name="**/*.php"/>
149 <copy file="${basedir}/vendor/phpunit/php-text-template/LICENSE"
150 tofile="${basedir}/build/phar/php-text-template/LICENSE"/>
151 <copy todir="${basedir}/build/phar/php-text-template">
152 <fileset dir="${basedir}/vendor/phpunit/php-text-template/src">
153 <include name="**/*.php"/>
157 <copy file="${basedir}/vendor/phpunit/php-timer/LICENSE" tofile="${basedir}/build/phar/php-timer/LICENSE"/>
158 <copy todir="${basedir}/build/phar/php-timer">
159 <fileset dir="${basedir}/vendor/phpunit/php-timer/src">
160 <include name="**/*.php"/>
164 <copy file="${basedir}/vendor/phpunit/php-token-stream/LICENSE"
165 tofile="${basedir}/build/phar/php-token-stream/LICENSE"/>
166 <copy todir="${basedir}/build/phar/php-token-stream">
167 <fileset dir="${basedir}/vendor/phpunit/php-token-stream/src">
168 <include name="**/*.php"/>
172 <copy file="${basedir}/vendor/phpunit/phpunit-mock-objects/LICENSE"
173 tofile="${basedir}/build/phar/phpunit-mock-objects/LICENSE"/>
174 <copy todir="${basedir}/build/phar/phpunit-mock-objects">
175 <fileset dir="${basedir}/vendor/phpunit/phpunit-mock-objects/src">
176 <include name="**/*"/>
180 <copy file="${basedir}/vendor/sebastian/comparator/LICENSE"
181 tofile="${basedir}/build/phar/sebastian-comparator/LICENSE"/>
182 <copy todir="${basedir}/build/phar/sebastian-comparator">
183 <fileset dir="${basedir}/vendor/sebastian/comparator/src">
184 <include name="**/*.php"/>
188 <copy file="${basedir}/vendor/sebastian/diff/LICENSE" tofile="${basedir}/build/phar/sebastian-diff/LICENSE"/>
189 <copy todir="${basedir}/build/phar/sebastian-diff">
190 <fileset dir="${basedir}/vendor/sebastian/diff/src">
191 <include name="**/*.php"/>
195 <copy file="${basedir}/vendor/sebastian/environment/LICENSE"
196 tofile="${basedir}/build/phar/sebastian-environment/LICENSE"/>
197 <copy todir="${basedir}/build/phar/sebastian-environment">
198 <fileset dir="${basedir}/vendor/sebastian/environment/src">
199 <include name="**/*.php"/>
203 <copy file="${basedir}/vendor/sebastian/exporter/LICENSE"
204 tofile="${basedir}/build/phar/sebastian-exporter/LICENSE"/>
205 <copy todir="${basedir}/build/phar/sebastian-exporter">
206 <fileset dir="${basedir}/vendor/sebastian/exporter/src">
207 <include name="**/*.php"/>
211 <copy file="${basedir}/vendor/sebastian/recursion-context/LICENSE"
212 tofile="${basedir}/build/phar/sebastian-recursion-context/LICENSE"/>
213 <copy todir="${basedir}/build/phar/sebastian-recursion-context">
214 <fileset dir="${basedir}/vendor/sebastian/recursion-context/src">
215 <include name="**/*.php"/>
219 <copy file="${basedir}/vendor/sebastian/global-state/LICENSE"
220 tofile="${basedir}/build/phar/sebastian-global-state/LICENSE"/>
221 <copy todir="${basedir}/build/phar/sebastian-global-state">
222 <fileset dir="${basedir}/vendor/sebastian/global-state/src">
223 <include name="**/*.php"/>
227 <copy file="${basedir}/vendor/sebastian/version/LICENSE"
228 tofile="${basedir}/build/phar/sebastian-version/LICENSE"/>
229 <copy todir="${basedir}/build/phar/sebastian-version">
230 <fileset dir="${basedir}/vendor/sebastian/version/src">
231 <include name="**/*.php"/>
235 <copy file="${basedir}/vendor/doctrine/instantiator/LICENSE"
236 tofile="${basedir}/build/phar/doctrine-instantiator/LICENSE"/>
237 <copy todir="${basedir}/build/phar/doctrine-instantiator">
238 <fileset dir="${basedir}/vendor/doctrine/instantiator/src">
239 <include name="**/*.php"/>
243 <copy file="${basedir}/vendor/symfony/yaml/Symfony/Component/Yaml/LICENSE"
244 tofile="${basedir}/build/phar/symfony/LICENSE"/>
245 <copy todir="${basedir}/build/phar/symfony">
246 <fileset dir="${basedir}/vendor/symfony">
247 <include name="**/*.php"/>
248 <exclude name="**/Tests/**"/>
252 <copy todir="${basedir}/build/phar/dbunit">
253 <fileset dir="${basedir}/vendor/phpunit/dbunit/PHPUnit">
254 <include name="**/*.php"/>
255 <exclude name="**/Autoload.*"/>
259 <copy todir="${basedir}/build/phar/php-invoker">
260 <fileset dir="${basedir}/vendor/phpunit/php-invoker/src">
261 <include name="**/*.php"/>
265 <copy todir="${basedir}/build/phar/phpunit-selenium">
266 <fileset dir="${basedir}/vendor/phpunit/phpunit-selenium/PHPUnit">
267 <include name="**/*.php"/>
268 <exclude name="**/Autoload.*"/>
272 <copy file="${basedir}/vendor/phpdocumentor/reflection-docblock/LICENSE"
273 tofile="${basedir}/build/phar/phpdocumentor-reflection-docblock/LICENSE"/>
274 <copy todir="${basedir}/build/phar/phpdocumentor-reflection-docblock">
275 <fileset dir="${basedir}/vendor/phpdocumentor/reflection-docblock/src">
276 <include name="**/*.php"/>
280 <copy file="${basedir}/vendor/phpspec/prophecy/LICENSE"
281 tofile="${basedir}/build/phar/phpspec-prophecy/LICENSE"/>
282 <copy todir="${basedir}/build/phar/phpspec-prophecy">
283 <fileset dir="${basedir}/vendor/phpspec/prophecy/src">
284 <include name="**/*.php"/>
289 <target name="-phar-build" depends="-phar-determine-version">
290 <copy todir="${basedir}/build/phar/phpunit">
291 <fileset dir="${basedir}/src">
292 <include name="**/*.php"/>
293 <include name="**/*.tpl*"/>
297 <exec executable="${basedir}/build/phar-version.php" outputproperty="_version">
298 <arg value="${version}"/>
299 <arg value="${type}"/>
302 <exec executable="${basedir}/build/tools/phpab" taskname="phpab">
304 <arg value="--static"/>
305 <arg value="--once"/>
306 <arg value="--phar"/>
307 <arg value="--hash"/>
309 <arg value="--output"/>
310 <arg path="${basedir}/build/phpunit-library-${_version}.phar"/>
311 <arg value="--template"/>
312 <arg path="${basedir}/build/library-phar-autoload.php.in"/>
313 <arg path="${basedir}/build/phar"/>
316 <exec executable="${basedir}/build/tools/phpab" taskname="phpab">
318 <arg value="--static"/>
319 <arg value="--phar"/>
320 <arg value="--hash"/>
322 <arg value="--output"/>
323 <arg path="${basedir}/build/phpunit-${_version}.phar"/>
324 <arg value="--template"/>
325 <arg path="${basedir}/build/binary-phar-autoload.php.in"/>
326 <arg path="${basedir}/build/phar"/>
329 <chmod file="${basedir}/build/phpunit-${_version}.phar" perm="ugo+rx"/>
332 <target name="-phar-determine-version">
333 <exec executable="${basedir}/build/version.php" outputproperty="version" />
336 <target name="generate-project-documentation" depends="-phploc,-phpcs,-phpmd,-phpunit">
337 <exec executable="${basedir}/build/tools/phpdox" dir="${basedir}/build" taskname="phpdox"/>
340 <target name="-phploc" depends="prepare">
341 <exec executable="${basedir}/build/tools/phploc" output="/dev/null" taskname="phploc">
342 <arg value="--count-tests"/>
343 <arg value="--log-xml"/>
344 <arg path="${basedir}/build/logfiles/phploc.xml"/>
345 <arg path="${basedir}/src"/>
346 <arg path="${basedir}/tests"/>
350 <target name="-phpcs" depends="prepare">
351 <exec executable="${basedir}/build/tools/phpcs" output="/dev/null" taskname="phpcs">
352 <arg value="--report=checkstyle"/>
353 <arg value="--report-file=${basedir}/build/logfiles/checkstyle.xml"/>
354 <arg value="--standard=PSR2"/>
355 <arg value="--extensions=php"/>
356 <arg path="${basedir}/src"/>
360 <target name="-phpmd" depends="prepare">
361 <exec executable="${basedir}/build/tools/phpmd" taskname="phpmd">
362 <arg path="${basedir}/src"/>
364 <arg path="${basedir}/build/phpmd.xml"/>
365 <arg value="--reportfile"/>
366 <arg path="${basedir}/build/logfiles/pmd.xml"/>
370 <target name="-phpunit" depends="setup">
371 <exec executable="${basedir}/phpunit" taskname="phpunit">
372 <arg value="--coverage-xml"/>
373 <arg path="${basedir}/build/logfiles/coverage"/>
374 <arg value="--log-junit"/>
375 <arg path="${basedir}/build/logfiles/junit.xml"/>