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" />
8 <condition property="phpcs" value="${basedir}/vendor/bin/phpcs.bat" else="${basedir}/vendor/bin/phpcs">
9 <os family="windows" />
12 <condition property="parallel-lint" value="${basedir}/vendor/bin/parallel-lint.bat" else="${basedir}/vendor/bin/parallel-lint">
13 <os family="windows" />
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"/>
20 <!-- Use colors in output can be disabled when calling ant with -Duse-colors=false -->
21 <property name="use-colors" value="true" />
23 <condition property="colors-arg.color" value="--colors" else="">
24 <equals arg1="${use-colors}" arg2="true" />
27 <condition property="colors-arg.no-colors" value="" else="--no-colors">
28 <equals arg1="${use-colors}" arg2="true" />
32 <target name="prepare" description="Create build directory">
33 <mkdir dir="${basedir}/build/logs" />
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}' />
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}' />
52 <target name="phpcs" depends="prepare" description="Check PHP code style">
53 <delete file="${basedir}/build/logs/checkstyle.xml" quiet="true" />
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"' />
64 <target name="phpunit" depends="prepare" description="PHP unit">
65 <delete file="${basedir}/build/logs/phpunit.xml" quiet="true" />
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}' />
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" />
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}' />
91 <target name="build" depends="phplint,var-dump-check,phpcs,phpunit" />