phpUnderControl 0.5.0 released
After quite some time of silence around phpUnderControl I have bundled the 0.5.0 release today. Beside minor changes, bugfixes and enhancements this release contains one new major feature, the PHP_CodeBrowser.
The PHP_CodeBrowser is a separate application that collects various XML log files with different project metrics/violations and presents them in a browseable source view with syntax highligting. This tool is a contribution by the Mayflower GmbH, where it was developed and now shared with the Open Source Community. At this point I would like to thank Mayflower as a whole and in particular at Elger and Thorsten, which were responsible for all technical aspects of this contribution.
To use the PHP_CodeBrowser you must add an additional execute publisher to your CruiseControl config.xml file that generates the PHP_CodeBrowser html report and an additional artifacts publisher to move the generated PHP_CodeBrowser report into the projects artifacts directory.
<?xml version="1.0" encoding="UTF-8" ?>
<cruisecontrol>
<!-- ... -->
<project name="PHP_Depend" buildafterfailed="false">
<!-- ... -->
<publishers>
<!-- ... -->
<execute command="phpcb
--log projects/${project.name}/build/logs
--source projects/${project.name}/source/PHP
--output projects/${project.name}/build/php-code-browser"/>
<artifactspublisher
dir="projects/${project.name}/build/php-code-browser"
dest="artifacts/${project.name}"
subdirectory="php-code-browser"/>
<!-- ... -->
</publishers>
</project>
</cruisecontrol>
But why do we use a CruiseControl publishers instead of a regular ant (Your build tool here) target? The answer is really simple. The PHP_CodeBrowser must be the very last artifact generated for a project, which means it must also run after PHPUnit, to collect the test result logs. But in most setups PHPUnit is configured with failonerror="on"
to mark a build as failed, when an error occured during the test execution. But with this configuration a following PHP_CodeBrowser target would never be executed by ant, because the build failed already. This cannot happen with a CruiseControl publisher which is always executed in a separated process.
If you create a new project with phpUnderControl's project
command, phpUnderControl will automatically search for an installed PHP_CodeBrowser and add the required publishers to your config.xml
file when it is present.
mapi@arwen ~ $ phpuc project \
--project-name PHP_Depend \
--source-dir PHP \
--test-case PHP_Depend_AllTests \
--test-dir tests \
--test-file PHP/Depend/AllTests.php \
--version-control svn \
--version-control-url http://svn.pdepend.org/branches/0.9.0 \
/opt/cruisecontrol/cruisecontrol-bin-2.8.2
To get the latest version of phpUnderControl, you can use the PEAR-Channel-Server:
mapi@arwen ~ $ pear channel-discover pear.phpunit.de
mapi@arwen ~ $ pear install phpunit/phpUnderControl-beta
or you can check it out from the subversion repository:
mapi@arwen ~ $ svn co svn://phpunit.de/phpunit/phpUnderControl/trunk