Skip to content
This repository has been archived by the owner on Jan 24, 2018. It is now read-only.

Commit

Permalink
Simplify build script
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Nov 13, 2013
1 parent f9ab15f commit 443b1aa
Showing 1 changed file with 14 additions and 65 deletions.
79 changes: 14 additions & 65 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,44 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>

<project name="Money" default="build">
<property name="php" value="php"/>
<property name="phpunit" value="phpunit"/>

<target name="build"
depends="prepare,lint,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpunit,phpcb,phpdox"/>

<target name="build-parallel"
depends="prepare,lint,tools-parallel,phpcb"/>

<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"/>
</parallel>
</target>
<target name="build" depends="prepare,lint,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpdox,phpunit"/>

<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/logs"/>
<delete dir="${basedir}/build/pdepend"/>
<delete dir="${basedir}/build/phpdox"/>
<delete>
<fileset dir="${basedir}/build" includes="**/*.tgz"/>
</delete>
</target>

<target name="prepare" depends="clean,generate-code"
description="Prepare for build">
<target name="prepare" depends="clean,generate-code" description="Prepare for build">
<mkdir dir="${basedir}/build/api"/>
<mkdir dir="${basedir}/build/code-browser"/>
<mkdir dir="${basedir}/build/coverage"/>
<mkdir dir="${basedir}/build/logs"/>
<mkdir dir="${basedir}/build/pdepend"/>
Expand All @@ -55,7 +28,7 @@
</target>

<target name="lint">
<apply executable="${php}" failonerror="true">
<apply executable="php" failonerror="true">
<arg value="-l" />

<fileset dir="${basedir}/src">
Expand All @@ -78,8 +51,7 @@
</exec>
</target>

<target name="pdepend"
description="Calculate software metrics using PHP_Depend">
<target name="pdepend" description="Calculate software metrics using PHP_Depend">
<exec executable="pdepend">
<arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
<arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
Expand All @@ -88,17 +60,15 @@
</exec>
</target>

<target name="phpmd"
description="Perform project mess detection using PHPMD">
<target name="phpmd" description="Perform project mess detection using PHPMD and print result in text format">
<exec executable="phpmd">
<arg path="${basedir}/src" />
<arg value="text" />
<arg path="${basedir}/build/phpmd.xml" />
</exec>
</target>

<target name="phpmd-ci"
description="Perform project mess detection using PHPMD">
<target name="phpmd-ci" description="Perform project mess detection using PHPMD and log result in XML format">
<exec executable="phpmd">
<arg path="${basedir}/src" />
<arg value="xml" />
Expand All @@ -108,24 +78,22 @@
</exec>
</target>

<target name="phpcs"
description="Find coding standard violations using PHP_CodeSniffer">
<target name="phpcs" description="Find coding standard violations using PHP_CodeSniffer and print result in text format">
<exec executable="phpcs">
<arg value="--standard=PSR2" />
<arg value="--extensions=php" />
<arg value="--ignore=Autoload.php" />
<arg value="--ignore=autoload.php" />
<arg path="${basedir}/src" />
</exec>
</target>

<target name="phpcs-ci"
description="Find coding standard violations using PHP_CodeSniffer">
<target name="phpcs-ci" description="Find coding standard violations using PHP_CodeSniffer and log result in XML format">
<exec executable="phpcs" output="/dev/null">
<arg value="--report=checkstyle" />
<arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
<arg value="--standard=PSR2" />
<arg value="--extensions=php" />
<arg value="--ignore=Autoload.php" />
<arg value="--ignore=autoload.php" />
<arg path="${basedir}/src" />
</exec>
</target>
Expand All @@ -139,32 +107,13 @@
</target>

<target name="phpunit" description="Run unit tests with PHPUnit">
<condition property="phpunit_cmd" value="${php} ${phpunit}" else="${phpunit}">
<not>
<equals arg1="${phpunit}" arg2="phpunit" />
</not>
</condition>

<exec executable="${phpunit_cmd}" failonerror="true">
<arg value="--configuration" />
<arg path="${basedir}/build/phpunit.xml" />
</exec>
</target>

<target name="phpcb"
description="Aggregate tool output with PHP_CodeBrowser">
<exec executable="phpcb">
<arg value="--log" />
<arg path="${basedir}/build/logs" />
<arg value="--source" />
<arg path="${basedir}/src" />
<arg value="--output" />
<arg path="${basedir}/build/code-browser" />
<exec executable="phpunit" failonerror="true">
<arg value="--configuration"/>
<arg path="${basedir}/build/phpunit.xml"/>
</exec>
</target>

<target name="phpdox"
description="Generate API documentation using phpDox">
<target name="phpdox" description="Generate API documentation using phpDox">
<exec executable="phpdox" dir="${basedir}/build"/>
</target>
</project>

0 comments on commit 443b1aa

Please sign in to comment.