build.xml 4.09 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
<?xml version="1.0"?>

<!--
    Doctrine 2 build file.
-->

<project name="Doctrine2" default="dist-all" basedir=".">
    
    <property file="build.properties" />
    
11 12 13
    <!-- 
        Fileset for artifacts shared across all distributed packages.
    -->
14 15 16 17 18 19
    <fileset id="shared-artifacts" dir=".">
        <include name="LICENSE"/>
        <include name="COPYRIGHT"/>
        <include name="CHANGELOG"/>
    </fileset>
    
20 21 22
    <!-- 
        Fileset for the sources of the Doctrine Common package.
    -->
23 24 25 26
    <fileset id="common-sources" dir=".">
        <include name="lib/Doctrine/Common/**"/>
    </fileset>
    
27 28 29
    <!-- 
        Fileset for the sources of the Doctrine DBAL package.
    -->
30 31 32 33
    <fileset id="dbal-sources" dir=".">
        <include name="lib/Doctrine/DBAL/**"/>
    </fileset>
    
34 35 36
    <!-- 
        Fileset for the sources of the Doctrine ORM package.
    -->
37 38 39 40 41 42 43
    <fileset id="orm-sources" dir=".">
        <include name="lib/Doctrine/ORM/**"/>
    </fileset>

    <target name="clean">
        <delete dir="${build.dir}" includeemptydirs="true" />
        <delete dir="${dist.dir}" includeemptydirs="true" />
44
        <delete dir="${report.dir}" includeemptydirs="true" />
45 46 47
    </target>

    <target name="prepare" depends="clean">
48
        <echo msg="Creating build directory: ${build.dir}" />
49
        <mkdir dir="${build.dir}" />
50
        <echo msg="Creating distribution directory: ${dist.dir}" />
51
        <mkdir dir="${dist.dir}" />
52 53
        <echo msg="Creating report directory: ${report.dir}" />
        <mkdir dir="${report.dir}" />
54 55 56
    </target>

    <target name="build-common">
57
        <copy todir="${build.dir}/common">
58 59 60 61 62 63
            <fileset refid="shared-artifacts"/>
            <fileset refid="common-sources"/>
        </copy>
    </target>
    
    <target name="build-dbal">
64
        <copy todir="${build.dir}/dbal">
65 66 67 68 69 70
            <fileset refid="shared-artifacts"/>
            <fileset refid="common-sources"/>
            <fileset refid="dbal-sources"/>
        </copy>
    </target>
    
71 72 73
    <!-- 
        Builds all packages, preparing them for distribution.
    -->
74
    <target name="build-all" depends="prepare, build-common, build-dbal">
75
        <copy todir="${build.dir}/all">
76 77 78 79 80 81 82
            <fileset refid="shared-artifacts"/>
            <fileset refid="common-sources"/>
            <fileset refid="dbal-sources"/>
            <fileset refid="orm-sources"/>
        </copy>
    </target>
    
83
    <target name="prepare-test">
romanb's avatar
romanb committed
84
        <mkdir dir="${build.dir}/logs"/>
85 86 87 88 89 90 91
        <mkdir dir="${report.dir}/tests"/>
    </target>
    
    <!-- 
        Runs the full test suite.
    -->
    <target name="test" depends="prepare-test">
romanb's avatar
romanb committed
92 93 94 95 96 97 98 99 100 101 102
        <phpunit printsummary="true" haltonfailure="true">
            <formatter todir="${build.dir}/logs" type="xml"/>
            <batchtest classpath="tests">
                <fileset dir="tests">
                    <include name="**/*Test.php"/>
                </fileset>
            </batchtest>
        </phpunit>
        <!-- <phpunitreport infile="build/logs/testsuites.xml" format="frames" todir="reports/tests" />-->
    </target>
    
103 104 105
    <!-- 
        Distributes the Doctrine Common package.
    -->
106
    <target name="dist-common">
107
        <tar destfile="${dist.dir}/Doctrine2-common.tar.gz" compression="gzip">
romanb's avatar
romanb committed
108
            <fileset dir="${build.dir}/common">
109 110 111 112 113
                <include name="**" />
            </fileset>
        </tar>
    </target>
    
114 115 116
    <!-- 
        Distributes the Doctrine DBAL package.
    -->
117
    <target name="dist-dbal">
romanb's avatar
romanb committed
118 119
        <tar destfile="${dist.dir}/Doctrine2-dbal.tar.gz" compression="gzip">
            <fileset dir="${build.dir}/dbal">
120 121 122 123 124
                <include name="**" />
            </fileset>
        </tar>
    </target>

125 126 127 128
    <!--
        DEFAULT TARGET
        Tests, builds and distributes the full Doctrine package (Common+DBAL+ORM).
    -->
romanb's avatar
romanb committed
129 130 131
    <target name="dist-all" depends="test, build-all, dist-common, dist-dbal">
        <tar destfile="${dist.dir}/Doctrine2-all.tar.gz" compression="gzip">
            <fileset dir="${build.dir}/all">
132 133 134 135 136 137
                <include name="**" />
            </fileset>
        </tar>
    </target>
    
</project>