<?xml version="1.0"?>

<project name="Hello World Example" default="build" description="This is an example buildfile for Phing.">
	<target name="prepare">
		<mkdir dir="reports/coverage"/>
		<mkdir dir="reports/tests"/>
		<mkdir dir="docs"/>
	</target>
	
	<target name="reports">
		<coverage-setup database="reports/coverage.db">
			<fileset dir="src">
				<include name="*.php"/>
				<exclude name="*Test.php"/>
			</fileset>
		</coverage-setup>
		<phpunit codecoverage="true">
			<formatter type="xml" todir="reports"/>
			<formatter type="clover" todir="."/>
			<batchtest>
				<fileset dir="src">
					<include name="*Test.php"/>
				</fileset>
			</batchtest>
		</phpunit>
		<phpunitreport infile="reports/testsuites.xml" format="frames" todir="reports/tests"
			styledir="../../etc" usesorttable="true"/>
		<coverage-report outfile="reports/coverage.xml">
			<report todir="reports/coverage" styledir="../../etc" title="Demo Project"
				usesorttable="true"/>
		</coverage-report>
	</target>
	
	<target name="test">
		<phpunit haltonerror="true" haltonfailure="true">
			<formatter type="plain" usefile="false"/>
			<batchtest>
				<fileset dir="src">
					<include name="*Test.php"/>
				</fileset>
			</batchtest>
		</phpunit>
	</target>
	
	<target name="docs">
		<docblox title="Phing Example" destdir="docs"
			quiet="true">
			<fileset dir="src">
				<include name="*.php"/>
			</fileset>
		</docblox>
	</target>
	
	<target name="build" depends="test,prepare,reports,docs">
		<zip destfile="helloworld.zip" basedir="src"/>
		<tar destfile="helloworld.tar" basedir="src"/>
	</target>

	<target name="clean">
		<delete dir="reports"/>
		<delete dir="docs"/>
		<delete file="helloworld.zip"/>
		<delete file="helloworld.tar"/>
	</target>
</project>
