Skip to content

Instantly share code, notes, and snippets.

@albankora
Created December 30, 2015 10:06
Show Gist options
  • Save albankora/b40e34bde9590d54d2ce to your computer and use it in GitHub Desktop.
Save albankora/b40e34bde9590d54d2ce to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<project name="{Project Name}" default="dev" basedir=".">
<property name="basedir" value="${project.basedir}" />
<property name="vendorBinDir" value="${basedir}/vendor/bin" />
<property name="source" value="${basedir}/app" />
<property name="exclude" value="${source}/cache,${source}/config,${source}/language,${source}/third_party,${source}/views,${source}/libraries" />
<target name="dev" depends="clean,lint,pdepend,phpmd,phpcpd,phploc,phpcs,phpunit,phpcb" />
<target name="full" depends="clean,lint,phpdoc,pdepend,phpmd,phpcpd,phploc,phpcs,phpunit,phpcb" />
<target name="clean" description="Clean up and create artifact directories">
<delete dir="${basedir}/build/doc" />
<delete dir="${basedir}/build/pdepend" />
<delete dir="${basedir}/build/code-browser" />
<delete dir="${basedir}/build/coverage" />
<delete dir="${basedir}/build/logs" />
<mkdir dir="${basedir}/build/doc" />
<mkdir dir="${basedir}/build/pdepend" />
<mkdir dir="${basedir}/build/code-browser" />
<mkdir dir="${basedir}/build/coverage" />
<mkdir dir="${basedir}/build/logs" />
</target>
<target name="lint" description="Perform syntax check of sourcecode files">
<apply executable="php" failonerror="true">
<arg value="-l" />
<fileset dir="${source}">
<include name="**/*.php" />
</fileset>
</apply>
</target>
<target name="phpdoc" description="API Documentation">
<exec command="${vendorBinDir}/phpdoc -d ${source} -t ${basedir}/build/doc/ -v --template responsive-twig" />
</target>
<target name="pdepend" description="Calculate software metrics using PHP_Depend">
<exec executable="${vendorBinDir}/pdepend" logoutput="true">
<arg value="--ignore=${exclude}" />
<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="${source}" />
</exec>
</target>
<target name="phpmd" description="Perform project mess detection using PHPMD creating a log file">
<exec executable="${vendorBinDir}/phpmd" logoutput="true">
<arg path="${source}"/>
<arg value="xml"/>
<arg value="${basedir}/phpmd.xml"/>
<arg value="--reportfile"/>
<arg value="${basedir}/build/logs/pmd.xml"/>
<arg value="--exclude" />
<arg value="${exclude}" />
</exec>
</target>
<target name="phpcpd" description="Find duplicate code using PHPCPD">
<exec executable="${vendorBinDir}/phpcpd" logoutput="true">
<arg value="--log-pmd" />
<arg value="${basedir}/build/logs/pmd-cpd.xml" />
<arg value="--exclude"/>
<arg value="cache,config,language,third_party,libraries" />
<arg path="${source}" />
</exec>
</target>
<target name="phploc" description="Measure project size using PHPLOC">
<exec executable="${vendorBinDir}/phploc" logoutput="true">
<arg value="--exclude" />
<arg path="${exclude}" />
<arg value="--log-csv" />
<arg value="${basedir}/build/logs/phploc.csv" />
<arg path="${source}" />
</exec>
</target>
<target name="phpcs" description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
<exec executable="${vendorBinDir}/phpcs" logoutput="true">
<arg value="--report=checkstyle" />
<arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
<arg value="--standard=PSR2" />
<arg value="--ignore=${source}/cache,${source}/config,${source}/language,${source}/third_party,${source}/views" />
<arg value="--extensions=php" />
<arg path="${source}" />
</exec>
</target>
<target name="phpunit" description="Run unit tests using PHPUnit and generates junit.xml and clover.xml">
<exec logoutput="true" command="${vendorBinDir}/phpunit --configuration=phpunit.xml" />
</target>
<target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
<exec executable="${vendorBinDir}/phpcb" logoutput="true">
<arg value="--log" />
<arg path="${basedir}/build/logs" />
<arg value="--ignore=${source}/cache" />
<arg value="--ignore=${source}/config" />
<arg value="--ignore=${source}/language" />
<arg value="--ignore=${source}/third_party" />
<arg value="--ignore=${source}/views" />
<arg value="--ignore=${source}/libraries" />
<arg value="--source" />
<arg path="${source}" />
<arg value="--output" />
<arg path="${basedir}/build/code-browser" />
</exec>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment