Location: PHPKode > scripts > Phinx > phinx-0.2.x-dev/build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="phinx" basedir="." default="build">
    <!-- Load properties -->
    <property file="build.properties" />
    
    <target name="build" depends="prepare,clone,targz,phar,phargz,pharbz2,clean" />

    <target name="build-parallel" depends="prepare,lint,tools-parallel,phpunit,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>
    
    <!-- =================================================================== -->
    <!-- Cleanup files -->
    <!-- =================================================================== -->

    <target name="clean" description="Cleanup build artifacts">
        <delete dir="${buildpath}" includeemptydirs="true" failonerror="true" />
        <delete file="${packagepath}/${phing.project.name}.phar" />
        <delete file="${packagepath}/${phing.project.name}.gzip.phar" />
        <delete file="${packagepath}/${phing.project.name}.bzip2.phar" />
        <delete file="${packagepath}/${phing.project.name}.tar.gz" />
    </target>

    <!-- =================================================================== -->
    <!-- Prepare for Build -->
    <!-- =================================================================== -->

    <target name="prepare" depends="clean" description="Prepare for build">
        <!-- Create new build directory -->
        <mkdir dir="${buildpath}" />
    </target>
    
    <target name="clone" depends="prepare">
        <!-- Copy all files needed files -->
        <copy todir="${buildpath}" >
            <fileset dir=".">
                <exclude name="**/.git" />
                <exclude name="**/.git/**" />
                <exclude name="README.md" />
                <exclude name=".gitignore" />
                <exclude name="package.xml" />
                <exclude name="${buildpath}" />
                <exclude name="${buildpath}/**" />
                <exclude name="${packagepath}" />
                <exclude name="${packagepath}/**" />
                <exclude name="**/tests" />
                <exclude name="**/tests/**" />
                <include name="**/*" />
            </fileset>
        </copy>
    </target>
    
    <!-- =================================================================== -->
    <!-- Package files                                                       -->
    <!-- =================================================================== -->
    <target name="package" depends="prepare,clone">
        <mkdir dir="${packagepath}" />
    </target>
    
    <target name="targz" depends="prepare,clone,package">
        <tar destfile="${packagepath}/${phing.project.name}.tar.gz" compression="gzip">
            <fileset dir="${buildpath}">
                <include name="*" />
            </fileset>
        </tar>
    </target>
    
    <target name="phar" depends="prepare,clone,package">
        <pharpackage destfile="${packagepath}/${phing.project.name}.phar" 
                     basedir="${buildpath}" 
                     stub="${buildpath}/bin/phinx.stub.php">
            <fileset dir="${buildpath}" />
            <metadata>
                <element name="version" value="${version}" />
                <element name="authors">
                    <element name="Rob Morgan">
                        <element name="e-mail" value="hide@address.com" />
                    </element>
                </element>
            </metadata>
        </pharpackage>
    </target>
    
    <target name="phargz" depends="prepare,clone,package">
        <pharpackage destfile="${packagepath}/${phing.project.name}.gzip.phar" 
                     basedir="${buildpath}"
                     stub="${buildpath}/bin/phinx.stub.php"
                     compression="gzip">
            <fileset dir="${buildpath}" />
            <metadata>
                <element name="version" value="${version}" />
                <element name="authors">
                    <element name="Rob Morgan">
                        <element name="e-mail" value="hide@address.com" />
                    </element>
                </element>
            </metadata>
        </pharpackage>
    </target>
    
    <target name="pharbz2" depends="prepare,clone,package">
        <pharpackage destfile="${packagepath}/${phing.project.name}.bzip2.phar" 
                     basedir="${buildpath}" 
                     stub="${buildpath}/bin/phinx.stub.php"
                     compression="bzip2">
            <fileset dir="${buildpath}" />
            <metadata>
                <element name="version" value="${version}" />
                <element name="authors">
                    <element name="Rob Morgan">
                        <element name="e-mail" value="hide@address.com" />
                    </element>
                </element>
            </metadata>
        </pharpackage>
    </target>

    <target name="phpab" description="Generate autoloader scripts">
        <exec executable="phpab">
            <arg value="--output" />
            <arg path="src/Phinx/autoload.php" />
            <arg value="--compat" />
            <arg value="--template" />
            <arg path="src/Phinx/autoload.php.dist" />
            <arg value="--indent" />
            <arg value="          " />
            <arg path="Phinx" />
        </exec>
    </target>
	
    <target name="lint">
        <apply executable="php" failonerror="true">
            <arg value="-l" />

            <fileset dir="${basedir}/src">
                <include name="**/*.php" />
                <modified />
            </fileset>

            <fileset dir="${basedir}/tests">
                <include name="**/*.php" />
                <modified />
            </fileset>
        </apply>
    </target>

    <target name="phploc" description="Measure project size using PHPLOC">
        <exec executable="phploc">
            <arg value="--log-csv" />
            <arg value="${basedir}/build/logs/phploc.csv" />
            <arg path="${basedir}/src" />
        </exec>
    </target>

    <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" />
            <arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
            <arg path="${basedir}/src" />
        </exec>
    </target>

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

    <target name="phpmd-ci" description="Perform project mess detection using PHPMD">
        <exec executable="phpmd">
            <arg path="${basedir}/src" />
            <arg value="xml" />
            <arg value="${basedir}/build/phpmd.xml" />
            <arg value="--reportfile" />
            <arg value="${basedir}/build/logs/pmd.xml" />
        </exec>
    </target>

    <target name="phpcs" description="Find coding standard violations using PHP_CodeSniffer">
        <exec executable="phpcs">
            <arg value="--standard=Zend" />
            <arg value="--extensions=php" />
            <arg value="--ignore=Autoload.php" />
            <arg path="${basedir}/src" />
        </exec>
    </target>

    <target name="phpcs-ci" description="Find coding standard violations using PHP_CodeSniffer">
        <exec executable="phpcs" output="/dev/null">
            <arg value="--report=checkstyle" />
            <arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
            <arg value="--standard=Zend" />
            <arg value="--extensions=php" />
            <arg value="--ignore=Autoload.php" />
            <arg path="${basedir}/src" />
        </exec>
    </target>

    <target name="phpcpd" description="Find duplicate code using PHPCPD">
        <exec executable="phpcpd">
            <arg value="--log-pmd" />
            <arg value="${basedir}/build/logs/pmd-cpd.xml" />
            <arg path="${basedir}/src" />
        </exec>
    </target>

    <target name="phpunit" description="Run unit tests with PHPUnit">
        <exec executable="phpunit">
			<arg value="--configuration ${basedir}/tests/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>
    </target>
</project>
Return current item: Phinx