d656ea9d4b253689a4292c298ce2707bf7ae332f
[yaffs-website] / vendor / jakub-onderka / php-console-highlighter / build.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <project default="build">
3     <!-- Set executables according to OS -->
4     <condition property="phpunit" value="${basedir}/vendor/bin/phpunit.bat" else="${basedir}/vendor/bin/phpunit">
5         <os family="windows" />
6     </condition>
7
8     <condition property="phpcs" value="${basedir}/vendor/bin/phpcs.bat" else="${basedir}/vendor/bin/phpcs">
9         <os family="windows" />
10     </condition>
11
12     <condition property="parallel-lint" value="${basedir}/vendor/bin/parallel-lint.bat" else="${basedir}/vendor/bin/parallel-lint">
13         <os family="windows" />
14     </condition>
15
16     <condition property="var-dump-check" value="${basedir}/vendor/bin/var-dump-check.bat" else="${basedir}/vendor/bin/var-dump-check">
17         <os family="windows"/>
18     </condition>
19
20     <!-- Use colors in output can be disabled when calling ant with -Duse-colors=false -->
21     <property name="use-colors" value="true" />
22
23     <condition property="colors-arg.color" value="--colors" else="">
24         <equals arg1="${use-colors}" arg2="true" />
25     </condition>
26
27     <condition property="colors-arg.no-colors" value="" else="--no-colors">
28         <equals arg1="${use-colors}" arg2="true" />
29     </condition>
30
31     <!-- Targets -->
32     <target name="prepare" description="Create build directory">
33         <mkdir dir="${basedir}/build/logs" />
34     </target>
35
36     <target name="phplint" description="Check syntax errors in PHP files">
37         <exec executable="${parallel-lint}" failonerror="true">
38             <arg line='--exclude ${basedir}/vendor/' />
39             <arg line='${colors-arg.no-colors}' />
40             <arg line='${basedir}' />
41         </exec>
42     </target>
43
44     <target name="var-dump-check" description="Check PHP files for forgotten variable dumps">
45         <exec executable="${var-dump-check}" failonerror="true">
46             <arg line='--exclude ${basedir}/vendor/' />
47             <arg line='${colors-arg.no-colors}' />
48             <arg line='${basedir}' />
49         </exec>
50     </target>
51
52     <target name="phpcs" depends="prepare" description="Check PHP code style">
53         <delete file="${basedir}/build/logs/checkstyle.xml" quiet="true" />
54
55         <exec executable="${phpcs}">
56             <arg line='--extensions=php' />
57             <arg line='--standard="${basedir}/vendor/jakub-onderka/php-code-style/ruleset.xml"' />
58             <arg line='--report-checkstyle="${basedir}/build/logs/checkstyle.xml"' />
59             <arg line='--report-full' />
60             <arg line='"${basedir}/src"' />
61         </exec>
62     </target>
63
64     <target name="phpunit" depends="prepare" description="PHP unit">
65         <delete file="${basedir}/build/logs/phpunit.xml" quiet="true" />
66
67         <exec executable="${phpunit}">
68             <arg line='--configuration ${basedir}/phpunit.xml' />
69             <arg line='-d memory_limit=256M' />
70             <arg line='--log-junit "${basedir}/build/logs/phpunit.xml"' />
71             <arg line='${colors-arg.color}' />
72         </exec>
73     </target>
74
75     <target name="phpunit-coverage" depends="prepare" description="PHP unit with code coverage">
76         <delete file="${basedir}/build/logs/phpunit.xml" quiet="true" />
77         <delete file="${basedir}/build/logs/clover.xml" quiet="true" />
78         <delete dir="${basedir}/build/coverage" quiet="true" />
79         <mkdir dir="${basedir}/build/coverage" />
80
81         <exec executable="${phpunit}" failonerror="true">
82             <arg line='--configuration ${basedir}/phpunit.xml' />
83             <arg line='-d memory_limit=256M' />
84             <arg line='--log-junit "${basedir}/build/logs/phpunit.xml"' />
85             <arg line='--coverage-clover "${basedir}/build/logs/clover.xml"' />
86             <arg line='--coverage-html "${basedir}/build/coverage/"' />
87             <arg line='${colors-arg.color}' />
88         </exec>
89     </target>
90
91     <target name="build" depends="phplint,var-dump-check,phpcs,phpunit" />
92
93 </project>