Yaffs site version 1.1
[yaffs-website] / vendor / phpunit / phpunit / build.xml
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"/>
5
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"/>
13         <delete>
14             <fileset dir="${basedir}/build">
15                 <include name="**/phpunit*.phar"/>
16                 <include name="**/phpunit*.phar.asc"/>
17             </fileset>
18         </delete>
19
20         <property name="clean.done" value="true"/>
21     </target>
22
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"/>
27     </target>
28
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"/>
35         </exec>
36
37         <property name="validate-composer-json.done" value="true"/>
38     </target>
39
40     <target name="-dependencies-installed">
41         <available file="${basedir}/composer.lock" property="dependencies-installed"/>
42     </target>
43
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">
46             <arg value="update"/>
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"/>
53         </exec>
54     </target>
55
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">
58             <arg value="-l"/>
59
60             <fileset dir="${basedir}/src">
61                 <include name="**/*.php"/>
62                 <modified/>
63             </fileset>
64
65             <fileset dir="${basedir}/tests">
66                 <include name="**/*.php"/>
67                 <modified/>
68             </fileset>
69         </apply>
70
71         <property name="php-syntax-check.done" value="true"/>
72     </target>
73
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"/>
78         </exec>
79
80         <property name="validate-phpunit-xsd.done" value="true"/>
81     </target>
82
83     <target name="test" depends="validate,install-dependencies" description="Run tests">
84         <exec executable="${basedir}/phpunit" taskname="phpunit"/>
85     </target>
86
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"/>
94         </exec>
95
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"/>
102         </exec>
103     </target>
104
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"/>
108         </antcall>
109     </target>
110
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"/>
114         </antcall>
115     </target>
116
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"/>
120
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"/>
126         </exec>
127
128         <move file="${basedir}/composer.json.bak" tofile="${basedir}/composer.json"/>
129
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"/>
132
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="**/*"/>
138             </fileset>
139         </copy>
140
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"/>
146             </fileset>
147         </copy>
148
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"/>
154             </fileset>
155         </copy>
156
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"/>
161             </fileset>
162         </copy>
163
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"/>
169             </fileset>
170         </copy>
171
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="**/*"/>
177             </fileset>
178         </copy>
179
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"/>
185             </fileset>
186         </copy>
187
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"/>
192             </fileset>
193         </copy>
194
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"/>
200             </fileset>
201         </copy>
202
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"/>
208             </fileset>
209         </copy>
210
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"/>
216             </fileset>
217         </copy>
218
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"/>
224             </fileset>
225         </copy>
226
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"/>
232             </fileset>
233         </copy>
234
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"/>
240             </fileset>
241         </copy>
242
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/**"/>
249             </fileset>
250         </copy>
251
252         <copy todir="${basedir}/build/phar/dbunit">
253             <fileset dir="${basedir}/vendor/phpunit/dbunit/PHPUnit">
254                 <include name="**/*.php"/>
255                 <exclude name="**/Autoload.*"/>
256             </fileset>
257         </copy>
258
259         <copy todir="${basedir}/build/phar/php-invoker">
260             <fileset dir="${basedir}/vendor/phpunit/php-invoker/src">
261                 <include name="**/*.php"/>
262             </fileset>
263         </copy>
264
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.*"/>
269             </fileset>
270         </copy>
271
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"/>
277             </fileset>
278         </copy>
279
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"/>
285             </fileset>
286         </copy>
287     </target>
288
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*"/>
294             </fileset>
295         </copy>
296
297         <exec executable="${basedir}/build/phar-version.php" outputproperty="_version">
298             <arg value="${version}"/>
299             <arg value="${type}"/>
300         </exec>
301
302         <exec executable="${basedir}/build/tools/phpab" taskname="phpab">
303             <arg value="--all"/>
304             <arg value="--static"/>
305             <arg value="--once"/>
306             <arg value="--phar"/>
307             <arg value="--hash"/>
308             <arg value="SHA-1"/>
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"/>
314         </exec>
315
316         <exec executable="${basedir}/build/tools/phpab" taskname="phpab">
317             <arg value="--all"/>
318             <arg value="--static"/>
319             <arg value="--phar"/>
320             <arg value="--hash"/>
321             <arg value="SHA-1"/>
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"/>
327         </exec>
328
329         <chmod file="${basedir}/build/phpunit-${_version}.phar" perm="ugo+rx"/>
330     </target>
331
332     <target name="-phar-determine-version">
333         <exec executable="${basedir}/build/version.php" outputproperty="version" />
334     </target>
335
336     <target name="generate-project-documentation" depends="-phploc,-phpcs,-phpmd,-phpunit">
337         <exec executable="${basedir}/build/tools/phpdox" dir="${basedir}/build" taskname="phpdox"/>
338     </target>
339
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"/>
347         </exec>
348     </target>
349
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"/>
357         </exec>
358     </target>
359
360     <target name="-phpmd" depends="prepare">
361         <exec executable="${basedir}/build/tools/phpmd" taskname="phpmd">
362             <arg path="${basedir}/src"/>
363             <arg value="xml"/>
364             <arg path="${basedir}/build/phpmd.xml"/>
365             <arg value="--reportfile"/>
366             <arg path="${basedir}/build/logfiles/pmd.xml"/>
367         </exec>
368     </target>
369
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"/>
376         </exec>
377     </target>
378 </project>
379