-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
87 lines (87 loc) · 3.55 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="PHP-Collection" default="build">
<target name="clean" description="Delete build artifacts">
<delete dir="${basedir}/bin"/>
<delete dir="${basedir}/build"/>
<delete dir="${basedir}/vendor"/>
<delete file="${basedir}/composer.lock"/>
</target>
<target name="composer-get" description="Downloads the newest Composer.">
<get src="https://getcomposer.org/composer.phar" dest="${basedir}/bin/composer.phar"/>
</target>
<target name="composer-install" description="Installs all dependencies with Composer.">
<exec executable="php" failonerror="true">
<arg line="${basedir}/bin/composer.phar"/>
<arg value="install"/>
<arg value="--no-interaction"/>
<arg value="--dev"/>
</exec>
</target>
<target name="prepare" description="Prepares the environment for build." depends="clean">
<mkdir dir="${basedir}/bin"/>
<mkdir dir="${basedir}/build"/>
<mkdir dir="${basedir}/build/pdepend"/>
<antcall target="composer-get"/>
<antcall target="composer-install"/>
</target>
<target name="phplint" description="Checks for PHP errors.">
<apply executable="php" failonerror="true">
<arg value="-l"/>
<fileset dir="${basedir}/src">
<include name="**/*.php"/>
<modified/>
</fileset>
<fileset dir="${basedir}/tests">
<include name="**/*.php"/>
<modified/>
</fileset>
</apply>
</target>
<target name="phploc" description="Calculates code size.">
<exec executable="bin/phploc">
<arg value="--count-tests"/>
<arg value="--log-xml"/>
<arg value="${basedir}/build/logs/phploc.xml"/>
<arg path="${basedir}/src"/>
<arg path="${basedir}/tests"/>
</exec>
</target>
<target name="pdepend"
description="Calculate software metrics.">
<exec executable="bin/pdepend">
<arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml"/>
<arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg"/>
<arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg"/>
<arg path="${basedir}/src"/>
</exec>
</target>
<target name="phpmd"
description="Calculates mess detection.">
<exec executable="bin/phpmd">
<arg path="${basedir}/src"/>
<arg value="xml"/>
<arg value="${basedir}/phpmd.xml.dist"/>
<arg value="--reportfile"/>
<arg value="${basedir}/build/logs/pmd.xml"/>
</exec>
</target>
<target name="phpcs" description="Checks for coding violations.">
<exec executable="bin/phpcs">
<arg value="--standard=PSR2"/>
<arg value="--extensions=php"/>
<arg path="${basedir}/src"/>
<arg path="${basedir}/tests"/>
</exec>
</target>
<target name="phpcpd" description="Copy paste detector.">
<exec executable="phpcpd">
<arg value="--log-pmd"/>
<arg value="${basedir}/build/logs/pmd-cpd.xml"/>
<arg path="${basedir}/src"/>
</exec>
</target>
<target name="phpunit" description="Runs the unit tests.">
<exec executable="bin/phpunit" failonerror="true"/>
</target>
<target name="build" depends="clean, prepare, phplint, phpunit, phploc, pdepend, phpmd, phpcs, phpcpd"/>
</project>