<?xml version="1.0" encoding="UTF-8"?>
<project name="PlemiSymfonyTemplate" default="build">
<target name="build" depends="prepare,lint,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpDocumentor,atoum"/>
<target name="build-parallel" depends="prepare,lint,tools-parallel,atoum"/>
<target name="tools-parallel" description="Run tools in parallel">
<parallel threadCount="2">
<sequential>
<antcall target="pdepend"/>
<antcall target="phpmd-ci"/>
</sequential>
<antcall target="phpcpd"/>
<antcall target="phpcs-ci"/>
<antcall target="phploc"/>
<antcall target="phpDocumentor"/>
</parallel>
</target>
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/build/api"/>
<delete dir="${basedir}/build/code-browser"/>
<delete dir="${basedir}/build/coverage"/>
<delete dir="${basedir}/build/doc"/>
<delete dir="${basedir}/build/logs"/>
<delete dir="${basedir}/build/pdepend"/>
<delete dir="${basedir}/vendor"/>
<delete file="${basedir}/composer.phar"/>
<delete file="${basedir}/composer.lock"/>
</target>
<target name="prepare" depends="clean,composer" description="Prepare for build">
<mkdir dir="${basedir}/build/api"/>
<mkdir dir="${basedir}/build/code-browser"/>
<mkdir dir="${basedir}/build/coverage"/>
<mkdir dir="${basedir}/build/doc"/>
<mkdir dir="${basedir}/build/logs"/>
<mkdir dir="${basedir}/build/pdepend"/>
</target>
<target name="composer" description="Installing dependencies">
<exec executable="wget" failonerror="true">
<arg value="-nc" />
<arg value="http://getcomposer.org/composer.phar" />
</exec>
<exec executable="php" failonerror="true">
<arg value="composer.phar" />
<arg value="install" />
<arg value="--install-suggests" />
</exec>
</target>
<target name="lint">
<apply executable="php" failonerror="true">
<arg value="-l" />
<fileset dir="${basedir}">
<exclude name="**/vendor/**" />
<include name="**/*.php" />
</fileset>
<fileset dir="${basedir}/web">
<exclude name="**/bundles/**" />
<include name="**/*.php" />
<modified />
</fileset>
</apply>
</target>
<target name="phploc" description="Measure project size using PHPLOC">
<exec executable="phploc">
<arg value="--exclude" />
<arg value="vendor" />
<arg value="--log-csv" />
<arg value="${basedir}/build/logs/phploc.csv" />
<arg path="${basedir}" />
</exec>
</target>
<target name="pdepend" description="Calculate software metrics using PHP_Depend">
<exec executable="pdepend">
<arg value="--phpunit-xml=${basedir}/build/logs/pdepend.xml" />
<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 value="--ignore=vendor" />
<arg path="${basedir}" />
</exec>
</target>
<target name="phpmd" description="Perform project mess detection using PHPMD">
<exec executable="phpmd">
<arg path="${basedir}" />
<arg value="text" />
<arg value="${basedir}/build/phpmd.xml" />
<arg value="--exclude" />
<arg value="vendor" />
</exec>
</target>
<target name="phpmd-ci" description="Perform project mess detection using PHPMD">
<exec executable="phpmd">
<arg path="${basedir}" />
<arg value="xml" />
<arg value="codesize,unusedcode,design" />
<arg value="--reportfile" />
<arg value="${basedir}/build/logs/pmd.xml" />
<arg value="--exclude" />
<arg value="app,vendor,web" />
</exec>
</target>
<target name="phpcs" description="Find coding standard violations using PHP_CodeSniffer">
<exec executable="phpcs">
<arg value="--ignore=vendor/**" />
<arg path="${basedir}" />
</exec>
</target>
<target name="phpcs-ci" description="Find coding standard violations using PHP_CodeSniffer">
<exec executable="phpcs" output="/dev/null">
<arg value="--ignore=vendor/**,Tests/**,app/**,web/**" />
<arg value="--report=checkstyle" />
<arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
<arg path="${basedir}" />
</exec>
</target>
<target name="phpcpd" description="Find duplicate code using PHPCPD">
<exec executable="phpcpd">
<arg value="--exclude" />
<arg value="vendor" />
<arg value="--log-pmd" />
<arg value="${basedir}/build/logs/pmd-cpd.xml" />
<arg path="${basedir}" />
</exec>
</target>
<target name="atoum" description="Run unit tests with Atoum">
<exec executable="bin/atoum" failonerror="false">
<arg line="--configuration-files .atoum.php.ci" />
<arg line="--bootstrap-file app/bootstrap.php.cache" />
<arg line="--glob ${basedir}/src/Plemi/*Bundle/Tests/Units" />
</exec>
</target>
<target name="phpDocumentor" description="Generate code documentation with phpDocumentor">
<exec executable="phpdoc">
<arg value="--directory" />
<arg value="${basedir}/src" />
<arg value="--target" />
<arg value="${basedir}/build/doc" />
<arg value="--title" />
<arg value="Plemi Documentation" />
<arg value="--ignore" />
<arg value="app/*,build/*,vendor/*,Tests/*,web/*" />
<arg value="--extensions" />
<arg value="php" />
</exec>
</target>
</project>