Commit 8712c91f authored by Hermann Mayer's avatar Hermann Mayer
Browse files

Made Project Jenkins-ready.

parent 7241c649
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -12,6 +12,9 @@
/.project
/nbproject/

/build/
/src/cache.properties

/web/css/*
/web/js/*
/web/sitemap*

build-ant.xml

0 → 100644
+126 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<project name="jity/jity" default="build-parallel" basedir="./src/">

    <property name="output" location="${basedir}/../build/"/>

    <target name="build"
        depends="prepare,lint,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,apigen,phpcb,phpunit"/>

    <target name="build-parallel"
        depends="prepare,lint,tools-parallel,phpcb,phpunit"/>

    <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"/>
            <antcall target="apigen"/>
        </parallel>
    </target>

    <target name="clean" description="Cleanup build artifacts">
        <delete dir="${output}/api"/>
        <delete dir="${output}/code-browser"/>
        <delete dir="${output}/coverage"/>
        <delete dir="${output}/logs"/>
        <delete dir="${output}/pdepend"/>
    </target>

    <target name="prepare" depends="clean" description="Prepare for build">
        <mkdir dir="${output}/api"/>
        <mkdir dir="${output}/code-browser"/>
        <mkdir dir="${output}/coverage"/>
        <mkdir dir="${output}/logs"/>
        <mkdir dir="${output}/pdepend"/>
    </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" />
                <modified />
            </fileset>
        </apply>
    </target>

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

    <target name="pdepend" description="Calculate software metrics using PHP_Depend">
        <exec executable="pdepend">
            <arg value="--jdepend-xml=${output}/logs/jdepend.xml" />
            <arg value="--jdepend-chart=${output}/pdepend/dependencies.svg" />
            <arg value="--overview-pyramid=${output}/pdepend/overview-pyramid.svg" />
            <arg path="${basedir}" />
        </exec>
    </target>

    <target name="phpmd-ci" description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
        <exec executable="phpmd">
			<arg line="
				 ${basedir} xml codesize,unusedcode,naming,design --reportfile ${output}/logs/pmd.xml --exclude Tests/
			" />
        </exec>
    </target>

    <target name="phpcs-ci"
        description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
        <exec executable="phpcs">
			<arg line="--report=checkstyle
              			--report-file=${output}/logs/checkstyle.xml
                        --standard=Symfony2
                        --extensions=php
                        --ignore=Resources/*
              			${basedir}" />
        </exec>
    </target>

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

    <target name="apigen" description="Generate API documentation using apigen">
		<exec executable="apigen" failonerror="true">
            <arg line="-d ${output}/api/
                -s ${basedir}
                --progressbar no" />
		</exec>
    </target>

    <target name="phpunit" description="Run unit tests with PHPUnit">
		<exec executable="phpunit" failonerror="true">
			<arg line="--coverage-clover ${output}/coverage/clover.xml
                --coverage-html ${output}/coverage/
                --coverage-clover ${output}/logs/clover.xml
                --log-junit ${output}/logs/junit.xml
                ${basedir}"/>
		</exec>
    </target>

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

</project>