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