<!-- 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="build/api"/>
<deletedir="build/coverage"/>
<deletedir="build/logs"/>
<deletedir="build/pdepend"/>
<propertyname="clean.done"value="true"/>
</target>
<targetname="prepare"
unless="prepare.done"
depends="clean"
description="Prepare for build">
<mkdirdir="build/api"/>
<mkdirdir="build/coverage"/>
<mkdirdir="build/logs"/>
<mkdirdir="build/pdepend"/>
<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="application">
<includename="**/*.php"/>
<excludename="logs/*.php"/>
<excludename="config/**/*.php"/>
<excludename="errors/*.php"/>
<excludename="third_party/**/*.php"/>
<excludename="views/**/*.php"/>
<modified/>
</fileset>
<filesetdir="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="application/controllers"/>
<argpath="application/models"/>
<argpath="application/libraries"/>
<argpath="application/core"/>
<argpath="application/hooks"/>
<argpath="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="build/logs/phploc.csv"/>
<argvalue="--log-xml"/>
<argpath="build/logs/phploc.xml"/>
<argpath="application/controllers"/>
<argpath="application/models"/>
<argpath="application/libraries"/>
<argpath="application/core"/>
<argpath="application/hooks"/>
<argpath="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="application/controllers"/>
<argpath="application/models"/>
<argpath="application/libraries"/>
<argpath="application/core"/>
<argpath="application/hooks"/>
<argpath="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.">