<!-- Adjust the threadCount attribute's value to the number of CPUs -->
<targetname="static-analysis-parallel"
description="Performs static analysis (executing the tools in parallel)">
<parallelthreadCount="2">
<sequential>
<antcalltarget="pdepend"/>
</sequential>
<antcalltarget="lint"/>
<antcalltarget="phpcpd-ci"/>
<antcalltarget="phpcs-ci"/>
<antcalltarget="phploc-ci"/>
</parallel>
</target>
<targetname="clean"
unless="clean.done"
description="Cleanup build artifacts">
<deletedir="${basedir}/build/api"/>
<deletedir="${basedir}/build/coverage"/>
<deletedir="${basedir}/build/logs"/>
<deletedir="${basedir}/build/pdepend"/>
<deletedir="${basedir}/build/phpdox"/>
<propertyname="clean.done"value="true"/>
</target>
<targetname="prepare"
unless="prepare.done"
depends="clean"
description="Prepare for build">
<mkdirdir="${basedir}/build/api"/>
<mkdirdir="${basedir}/build/coverage"/>
<mkdirdir="${basedir}/build/logs"/>
<mkdirdir="${basedir}/build/pdepend"/>
<mkdirdir="${basedir}/build/phpdox"/>
<propertyname="prepare.done"value="true"/>
</target>
<targetname="lint"
unless="lint.done"
description="Perform syntax check of sourcecode files">
<applyexecutable="php"taskname="lint">
<argvalue="-l"/>
<filesetdir="${basedir}/src">
<includename="**/*.php"/>
<modified/>
</fileset>
<filesetdir="${basedir}/tests">
<includename="**/*.php"/>
<modified/>
</fileset>
</apply>
<propertyname="lint.done"value="true"/>
</target>
<targetname="phploc"
unless="phploc.done"
description="Measure project size using PHPLOC and print human readable output. Intended for usage on the command line.">
<execexecutable="${phploc}"taskname="phploc">
<argvalue="--count-tests"/>
<argpath="${basedir}/src"/>
<argpath="${basedir}/tests"/>
</exec>
<propertyname="phploc.done"value="true"/>
</target>
<targetname="phploc-ci"
unless="phploc.done"
depends="prepare"
description="Measure project size using PHPLOC and log result in CSV and XML format. Intended for usage within a continuous integration environment.">
<execexecutable="${phploc}"taskname="phploc">
<argvalue="--count-tests"/>
<argvalue="--log-csv"/>
<argpath="${basedir}/build/logs/phploc.csv"/>
<argvalue="--log-xml"/>
<argpath="${basedir}/build/logs/phploc.xml"/>
<argpath="${basedir}/src"/>
<argpath="${basedir}/tests"/>
</exec>
<propertyname="phploc.done"value="true"/>
</target>
<targetname="pdepend"
unless="pdepend.done"
depends="prepare"
description="Calculate software metrics using PHP_Depend and log result in XML format. Intended for usage within a continuous integration environment.">
description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
<execexecutable="${phpcs}"taskname="phpcs">
<argvalue="--standard=PSR2"/>
<argvalue="--extensions=php"/>
<argvalue="--ignore=autoload.php"/>
<argpath="${basedir}/src"/>
<argpath="${basedir}/tests"/>
</exec>
<propertyname="phpcs.done"value="true"/>
</target>
<targetname="phpcs-ci"
unless="phpcs.done"
depends="prepare"
description="Find coding standard violations using PHP_CodeSniffer and log result in XML format. Intended for usage within a continuous integration environment.">