<project name="App" default="all" basedir=".">
    <property file="./php.properties"/>
    <property file="./build.properties"/>
    <target name="prepare" depends="clean">
        <mkdir dir="${dir.output}"/>
        <mkdir dir="${dir.tmp}"/>
    </target>

    <target name="clean">
        <delete dir="${dir.output}"/>
    </target>
    
    <target name="phpunit">
        <exec command="${phing} _phpunit" passthru="true"/>
    </target>
    <target name="_phpunit">
        <mkdir dir="${phpunit.output.xml.dir}"/>
        <mkdir dir="${phpunit.output.html.dir}"/>
        <exec
            command="${phpunit.exec} ${phpunit.args}"
            dir="${project.basedir}/tests"
            passthru="true"
        />
        <xslt
            file="${phpunit.output.xml.file}"
            tofile="${junit.output.xml.file}"
            style="${junit.style}"
        />
    </target>
    <target name="phploc">
        <exec command="${phing} _phploc" passthru="true"/>
    </target>
    <target name="_phploc">
        <mkdir dir="${phploc.output.html.dir}"/>
        <exec
            command="${phploc.exec} ${phploc.args} > ${phploc.output.html.file}"
            dir="${project.basedir}"
            passthru="true"
        />
    </target>
  
    <target name="phpcpd">
        <exec command="${phing} _phpcpd" passthru="true"/>
    </target>
    <target name="_phpcpd">
        <mkdir dir="${phpcpd.output.xml.dir}"/>
        <mkdir dir="${phpcpd.output.html.dir}"/>
        <exec
            command="${phpcpd.exec} ${phpcpd.args}"
            dir="${project.basedir}"
            passthru="true"
        />
        <xslt
            file="${phpcpd.output.xml.file}"
            tofile="${phpcpd.output.html.file}"
            style="${phpcpd.style}"
        />
    </target>
    
    <target name="phpmd">
        <exec command="${phing} _phpmd" passthru="true"/>
    </target>
    <target name="_phpmd">
        <mkdir dir="${phpmd.output.xml.dir}"/>
        <mkdir dir="${phpmd.output.html.dir}"/>
        <exec
            command="${phpmd.exec} ${phpmd.args}"
            dir="${project.basedir}"
            passthru="true"
        />
        <xslt
            file="${phpmd.output.xml.file}"
            tofile="${phpmd.output.html.file}"
            style="${phpmd.style}"
        />
    </target>

    <target name="phpdepend">
        <exec command="${phing} _phpdepend" passthru="true"/>
    </target>
    <target name="_phpdepend">
        <mkdir dir="${phpdepend.output.xml.dir}"/>
        <mkdir dir="${phpdepend.output.html.dir}"/>
        <exec
            command="${phpdepend.exec} ${phpdepend.args}"
            dir="${project.basedir}"
            passthru="true"
        />
        <xslt
            file="${phpdepend.output.xml.file}"
            tofile="${phpdepend.output.html.file}"
            style="${phpdepend.style}"
        />
    </target>
    <target name="phpcs">
        <exec command="${phing} _phpcs" passthru="true"/>
    </target>
    <target name="_phpcs">
        <mkdir dir="${phpcs.output.xml.dir}"/>
        <mkdir dir="${phpcs.output.html.dir}"/>
            
        <exec
            command="${phpcs.exec} ${phpcs.args}"
            dir="${project.basedir}"
            passthru="true"
        />
        <xslt
            file="${phpcs.output.xml.file}"
            tofile="${phpcs.output.html.file}"
            style="${phpcs.style}"
        />
    </target>
   
   
    <target name="clean-dependencies">
        <delete dir="${dir.vendor}"/>
    </target>
 
    <target name="all" depends="clean, prepare, test, report"/>
    <target name="build" depends="prepare"/>
    <target name="test" depends="prepare, phpunit"/>
    <target name="report" depends="build, phploc, phpdepend, phpcs, phpmd, phpcpd"/>
</project>
