1 <?xml version="1.0" encoding="UTF-8"?>
3 <project name="PHPUnit_MockObject" default="build">
4 <property name="php" value="php"/>
5 <property name="phpunit" value="phpunit"/>
8 depends="prepare,lint,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpunit,phpcb"/>
10 <target name="build-parallel"
11 depends="prepare,lint,tools-parallel,phpunit,phpcb"/>
13 <target name="tools-parallel"
14 description="Run tools in parallel">
15 <parallel threadCount="2">
17 <antcall target="pdepend"/>
18 <antcall target="phpmd-ci"/>
20 <antcall target="phpcpd"/>
21 <antcall target="phpcs-ci"/>
22 <antcall target="phploc"/>
26 <target name="clean" description="Cleanup build artifacts">
27 <delete dir="${basedir}/build/api"/>
28 <delete dir="${basedir}/build/code-browser"/>
29 <delete dir="${basedir}/build/coverage"/>
30 <delete dir="${basedir}/build/logs"/>
31 <delete dir="${basedir}/build/pdepend"/>
34 <target name="prepare" depends="clean,phpab"
35 description="Prepare for build">
36 <mkdir dir="${basedir}/build/api"/>
37 <mkdir dir="${basedir}/build/code-browser"/>
38 <mkdir dir="${basedir}/build/coverage"/>
39 <mkdir dir="${basedir}/build/logs"/>
40 <mkdir dir="${basedir}/build/pdepend"/>
43 <target name="phpab" description="Generate autoloader scripts">
44 <exec executable="phpab">
45 <arg value="--output" />
46 <arg path="PHPUnit/Framework/MockObject/Autoload.php" />
47 <arg value="--template" />
48 <arg path="PHPUnit/Framework/MockObject/Autoload.php.in" />
49 <arg value="--indent" />
51 <arg path="PHPUnit" />
56 <apply executable="${php}" failonerror="true">
59 <fileset dir="${basedir}/PHPUnit">
60 <include name="**/*.php" />
64 <fileset dir="${basedir}/Tests">
65 <include name="**/*.php" />
71 <target name="phploc" description="Measure project size using PHPLOC">
72 <exec executable="phploc">
73 <arg value="--log-csv" />
74 <arg value="${basedir}/build/logs/phploc.csv" />
75 <arg path="${basedir}/PHPUnit" />
79 <target name="pdepend"
80 description="Calculate software metrics using PHP_Depend">
81 <exec executable="pdepend">
82 <arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
83 <arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
84 <arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
85 <arg path="${basedir}/PHPUnit" />
90 description="Perform project mess detection using PHPMD">
91 <exec executable="phpmd">
92 <arg path="${basedir}/PHPUnit" />
94 <arg value="${basedir}/build/phpmd.xml" />
98 <target name="phpmd-ci"
99 description="Perform project mess detection using PHPMD">
100 <exec executable="phpmd">
101 <arg path="${basedir}/PHPUnit" />
103 <arg value="${basedir}/build/phpmd.xml" />
104 <arg value="--reportfile" />
105 <arg value="${basedir}/build/logs/pmd.xml" />
110 description="Find coding standard violations using PHP_CodeSniffer">
111 <exec executable="phpcs">
112 <arg value="--standard=${basedir}/build/PHPCS" />
113 <arg value="--extensions=php" />
114 <arg value="--ignore=Autoload.php" />
115 <arg path="${basedir}/PHPUnit" />
116 <arg path="${basedir}/Tests" />
120 <target name="phpcs-ci"
121 description="Find coding standard violations using PHP_CodeSniffer">
122 <exec executable="phpcs" output="/dev/null">
123 <arg value="--report=checkstyle" />
124 <arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
125 <arg value="--standard=${basedir}/build/PHPCS" />
126 <arg value="--extensions=php" />
127 <arg value="--ignore=Autoload.php" />
128 <arg path="${basedir}/PHPUnit" />
129 <arg path="${basedir}/Tests" />
133 <target name="phpcpd" description="Find duplicate code using PHPCPD">
134 <exec executable="phpcpd">
135 <arg value="--log-pmd" />
136 <arg value="${basedir}/build/logs/pmd-cpd.xml" />
137 <arg path="${basedir}/PHPUnit" />
141 <target name="phpunit" description="Run unit tests with PHPUnit">
142 <condition property="phpunit_cmd" value="${php} ${phpunit}" else="${phpunit}">
144 <equals arg1="${phpunit}" arg2="phpunit" />
148 <exec executable="${phpunit_cmd}" failonerror="true"/>
152 description="Aggregate tool output with PHP_CodeBrowser">
153 <exec executable="phpcb">
154 <arg value="--log" />
155 <arg path="${basedir}/build/logs" />
156 <arg value="--source" />
157 <arg path="${basedir}/PHPUnit" />
158 <arg value="--output" />
159 <arg path="${basedir}/build/code-browser" />