Location: PHPKode > projects > phpDox > phpdox-0.5/build.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by PHP Project Wizard (PPW) 1.0.4 on Fri Mar 11 16:37:31 CET 2011 -->

<project name="phpDox" default="build" basedir=".">
 <property name="source" value="src"/>

 <target name="clean" description="Clean up and create artifact directories">
  <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"/>

  <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"/>
 </target>

 <target name="phpab">
  <exec executable="phpab">
   <arg line='-o src/autoload.php src' />
  </exec>
 </target>

 <target name="phpunit" description="Run unit tests using PHPUnit and generates junit.xml and clover.xml">
  <exec executable="phpunit" failonerror="true"/>
 </target>

 <target name="parallelTasks" description="Run the pdepend, phpmd, phpcpd, phpcs, phpdoc and phploc tasks in parallel using a maximum of 2 threads.">
  <parallel threadCount="2">
   <sequential>
    <antcall target="pdepend"/>
    <antcall target="phpmd"/>
   </sequential>
   <antcall target="phpcpd"/>
   <antcall target="phpcs"/>
   <antcall target="phploc"/>
  </parallel>
 </target>

 <target name="pdepend" description="Generate jdepend.xml and software metrics charts using PHP_Depend">
  <exec executable="pdepend">
   <arg line="--jdepend-xml=${basedir}/build/logs/jdepend.xml
              --jdepend-chart=${basedir}/build/pdepend/dependencies.svg
              --overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg
              ${source}" />
  </exec>
 </target>

 <target name="phpmd" description="Generate pmd.xml using PHPMD">
  <exec executable="phpmd">
   <arg line="${source}
              xml
              codesize,design,naming,unusedcode
              --reportfile ${basedir}/build/logs/pmd.xml" />
  </exec>
 </target>

 <target name="phpcpd" description="Generate pmd-cpd.xml using PHPCPD">
  <exec executable="phpcpd">
   <arg line="--log-pmd ${basedir}/build/logs/pmd-cpd.xml ${source}" />
  </exec>
 </target>

 <target name="phploc" description="Generate phploc.csv">
  <exec executable="phploc">
   <arg line="--log-csv ${basedir}/build/logs/phploc.csv ${source}" />
  </exec>
 </target>

 <target name="phpcs" description="Generate checkstyle.xml using PHP_CodeSniffer">
  <exec executable="phpcs" output="/dev/null">
   <arg line="--report=checkstyle
              --report-file=${basedir}/build/logs/checkstyle.xml
              --standard=phpcs.xml
              ${source}" />
  </exec>
 </target>

 <target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
  <exec executable="phpcb">
   <arg line="--log    ${basedir}/build/logs
              --source ${source}
              --output ${basedir}/build/code-browser" />
  </exec>
 </target>

    <target name="phar" description="Create PHAR archive of phpDox and its dependencies">

        <delete dir="${basedir}/build/phar/_tmp"/>
        <mkdir dir="${basedir}/build/phar/_tmp"/>

        <delete>
            <fileset dir="${basedir}/build/phar">
                <include name="**/*.phar" />
            </fileset>
        </delete>

        <exec executable="bash" outputproperty="version">
            <arg value="-c" />
            <arg value="${basedir}/phpdox.php --version | awk 'BEGIN { ORS = &quot;&quot;; } {print $2}'" />
        </exec>

        <untar dest="${basedir}/build/phar/_tmp" compression="gzip">
            <fileset dir="${basedir}/build/phar/dependencies">
                <include name="**/*.tgz"/>
            </fileset>
        </untar>

        <copy todir="${basedir}/build/phar/_tmp/phpdox">
            <fileset dir="${basedir}/src"/>
        </copy>
        <copy todir="${basedir}/build/phar/_tmp/templates">
            <fileset dir="${basedir}/templates" />
        </copy>
        <copy todir="${basedir}/build/phar/_tmp/dependencies">
            <fileset dir="${basedir}/dependencies" />
        </copy>

        <delete>
            <fileset dir="${basedir}/build/phar/_tmp">
                <include name="**/autoload.php" />
                <include name="**/Autoload.php" />
                <include name="**/Autoload.php.in" />
                <include name="**/package.sig" />
                <include name="**/package.xml" />
                <include name="**/docs/**" />
                <include name="**/design/**" />
            </fileset>
        </delete>

        <exec executable="phpab" failonerror="true">
            <arg value="--var" />
            <arg value="VERSION=${version}" />
            <arg value="--all" />
            <arg value="--phar" />
            <arg value="--gzip" />
            <arg value="--output" />
            <arg path="${basedir}/build/phar/phpdox-${version}.phar" />
            <arg value="--template" />
            <arg path="${basedir}/build/phar/autoload.php.in" />
            <arg path="${basedir}/build/phar/_tmp" />
        </exec>

        <chmod file="${basedir}/build/phar/phpdox-${version}.phar" perm="ugo+rx"/>
        <delete dir="${basedir}/build/phar/_tmp" />
    </target>

 <target name="build" depends="clean,parallelTasks,phpunit,phpcb"/>
</project>
Return current item: phpDox