<?xml version="1.0"?>

<project name="Hello World Example" default="build" basedir="." 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"/>
			<batchtest>
				<fileset dir="src">
					<include name="*Test.php"/>
				</fileset>
			</batchtest>
		</phpunit>
		<phpunitreport infile="reports/testsuites.xml" format="frames" todir="reports/tests" styledir="../../etc"/>
		<coverage-report outfile="reports/coverage.xml">
			<report todir="reports/coverage" styledir="../../etc"/>
		</coverage-report>
	</target>
	
	<target name="test">
		<phpunit2 haltonerror="true" haltonfailure="true">
			<batchtest>
				<fileset dir="src">
					<include name="*Test.php"/>
				</fileset>
			</batchtest>
		</phpunit2>
	</target>
	
	<target name="docs">
		<phpdoc title="Phing Example" destdir="docs"
			sourcepath="src" output="HTML:Smarty:PHP"
			linksource="true"/>
	</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>
