Add build rules for pdepend and phpmd.

This commit is contained in:
Rouven Weßling 2012-08-30 01:24:40 +02:00
parent 4c30e6a0c0
commit dbf5b3c80e
2 changed files with 49 additions and 1 deletions

View File

@ -2,19 +2,32 @@
<project name="joomla" default="build" basedir=".">
<property name="source" value="." />
<property name="joomlasource" value="administrator,cli,components,includes,installation,libraries/cms,modules,plugins,templates" />
<target name="clean" description="Clean up and create artifact directories">
<delete dir="${basedir}/build/coverage" />
<delete dir="${basedir}/build/logs" />
<delete dir="${basedir}/build/jdepend" />
<mkdir dir="${basedir}/build/coverage" />
<mkdir dir="${basedir}/build/logs" />
<mkdir dir="${basedir}/build/jdepend" />
</target>
<target name="phpunit" description="Run unit tests using PHPUnit and generates junit.xml and clover.xml">
<exec executable="phpunit" />
</target>
<target name="parallelTasks" description="Run the pdepend, phpmd and phpcs tasks in parallel using a maximum of 2 threads.">
<parallel threadCount="2">
<sequential>
<antcall target="pdepend" />
<antcall target="phpmd" />
</sequential>
<antcall target="phpcs" />
</parallel>
</target>
<target name="phpcs" description="Generate checkstyle.xml using PHP_CodeSniffer">
<exec executable="phpcs">
<arg value="--report=checkstyle" />
@ -25,5 +38,25 @@
</exec>
</target>
<target name="build" depends="clean,phpunit,phpcs" />
<target name="pdepend" description="Generate jdepend.xml and software metrics charts using PHP_Depend">
<exec executable="pdepend">
<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=build,tests" />
<arg path="${source}" />
</exec>
</target>
<target name="phpmd" description="Generate pmd.xml using PHPMD">
<exec executable="phpmd">
<arg path="${joomlasource}" />
<arg value="xml" />
<arg value="${basedir}/build/phpmd.xml" />
<arg value="--reportfile" />
<arg value="${basedir}/build/logs/pmd.xml" />
</exec>
</target>
<target name="build" depends="clean,phpunit,parallelTasks" />
</project>

15
build/phpmd.xml Normal file
View File

@ -0,0 +1,15 @@
<?xml version="1.0"?>
<ruleset name="Custom rule set for the Joomla CMS."
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0
http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="
http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>
Custom rule set for the Joomla CMS.
</description>
<!-- Import the entire unused code rule set -->
<rule ref="rulesets/unusedcode.xml" />
</ruleset>