RSS Git Download  Clone
Raw Blame History
<?xml version="1.0" encoding="UTF-8"?>
<project name="gitlist" default="build">
    <property name="vendordir" value="${basedir}/vendor/bin" />
    <target name="build" depends="prepare,lint,phpunit" />
    <target name="build-package" depends="prepare-package,package" />

    <target name="clean" description="Clean build artifacts">
        <delete dir="${basedir}/build"/>
    </target>

    <target name="get-composer" description="Get Composer">
        <exec executable="/bin/bash">
            <arg value="-c" />
            <arg value="curl -s https://getcomposer.org/installer | php" />
        </exec>
    </target>

    <target name="prepare" depends="clean,get-composer" description="Prepare for build">
        <mkdir dir="${basedir}/build/logs"/>
        <mkdir dir="${basedir}/build/pdepend"/>
        <copy file="config.ini-example" tofile="config.ini"/>
        <exec executable="${basedir}/composer.phar" failonerror="true">
            <arg value="install" />
        </exec>
    </target>

    <target name="prepare-package" description="Prepare for build">
        <delete dir="${basedir}/vendor"/>
        <exec executable="${basedir}/composer.phar" failonerror="true">
            <arg value="install" />
            <arg value="--no-dev" />
            <arg value="--optimize-autoloader" />
        </exec>
    </target>

    <target name="lint" description="Perform syntax check of sourcecode files">
        <apply executable="php" failonerror="true">
        <arg value="-l" />

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

    <target name="phpunit" description="Run unit tests with PHPUnit">
        <exec executable="${vendordir}/phpunit" failonerror="true"/>
    </target>

    <target name="package" description="Package the application for distribution">
        <copy todir="${basedir}/build/gitlist/">
            <fileset dir="${basedir}" excludes="cache/**, build/**, tests/**, pkg_builder/**, phpunit.xml.dist, cache.properties, .gitignore, .travis.yml, build.xml, composer.json, composer.lock, composer.phar, config.ini" />
        </copy>

        <tar destfile="${basedir}/build/gitlist-master.tar.gz"
            basedir="${basedir}/build/"
            compression="gzip"
            longfile="gnu"
            excludes="gitlist-master.tar.gz, **/phpunit.xml.dist, **/composer.lock, **/composer.json, **/.travis.yml, **/test/**, **/tests/**, **/logs/**, **/pdepend/**"
        />
    </target>
</project>