build.xml 8.45 KB
Newer Older
1 2 3 4 5 6
<?xml version="1.0"?>

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

7 8 9
<project name="Doctrine2" default="build" basedir=".">
    <taskdef classname="phing.tasks.ext.d51PearPkg2Task" name="d51pearpkg2" />

10 11
    <property file="build.properties" />
    
12 13 14
    <!-- 
        Fileset for artifacts shared across all distributed packages.
    -->
15 16 17 18 19
    <fileset id="shared-artifacts" dir=".">
        <include name="LICENSE"/>
        <include name="COPYRIGHT"/>
        <include name="CHANGELOG"/>
    </fileset>
20 21 22 23 24 25 26 27 28

    <!--
        Fileset for command line scripts
    -->
    <fileset id="bin-scripts" dir="./bin">
        <include name="doctrine"/>
        <include name="doctrine.php"/>
    </fileset>

29 30 31
    <!-- 
        Fileset for the sources of the Doctrine Common package.
    -->
32 33
    <fileset id="common-sources" dir="./lib">
        <include name="Doctrine/Common/**"/>
34
    </fileset>
35

36 37 38
    <!-- 
        Fileset for the sources of the Doctrine DBAL package.
    -->
39 40
    <fileset id="dbal-sources" dir="./lib">
        <include name="Doctrine/DBAL/**"/>
41 42
    </fileset>
    
43 44 45
    <!-- 
        Fileset for the sources of the Doctrine ORM package.
    -->
46 47
    <fileset id="orm-sources" dir="./lib">
        <include name="Doctrine/ORM/**"/>
48
    </fileset>
49 50 51 52 53 54 55 56 57 58 59
    
    <!-- 
        Fileset for the Doctrine ORM tools + sandbox.
    -->
    <fileset id="orm-tools" dir=".">
        <include name="tools/sandbox/Entities"/>
        <include name="tools/sandbox/xml"/>
        <include name="tools/sandbox/yaml"/>
        <include name="tools/sandbox/cli-config.php"/>
        <include name="tools/sandbox/config.php"/>
        <include name="tools/sandbox/doctrine"/>
60
        <include name="tools/sandbox/doctrine.php"/>
61 62
        <include name="tools/sandbox/index.php"/>
    </fileset>
63 64 65 66

    <target name="clean">
        <delete dir="${build.dir}" includeemptydirs="true" />
        <delete dir="${dist.dir}" includeemptydirs="true" />
67
        <delete dir="${report.dir}" includeemptydirs="true" />
68 69 70
    </target>

    <target name="prepare" depends="clean">
71
        <echo msg="Creating build directory: ${build.dir}" />
72
        <mkdir dir="${build.dir}" />
73
        <echo msg="Creating distribution directory: ${dist.dir}" />
74
        <mkdir dir="${dist.dir}" />
75 76
        <echo msg="Creating report directory: ${report.dir}" />
        <mkdir dir="${report.dir}" />
77 78
        <mkdir dir="${build.dir}/logs"/>
        <mkdir dir="${report.dir}/tests"/>
79 80 81
    </target>

    <target name="build-common">
82
        <copy todir="${build.dir}/common">
83
            <fileset refid="shared-artifacts"/>
84 85
        </copy>
        <copy todir="${build.dir}/common/DoctrineCommon-${version}">
86 87 88 89 90
            <fileset refid="common-sources"/>
        </copy>
    </target>
    
    <target name="build-dbal">
91
        <copy todir="${build.dir}/dbal">
92
            <fileset refid="shared-artifacts"/>
93 94
        </copy>
        <copy todir="${build.dir}/dbal/DoctrineDBAL-${version}">
95 96 97 98 99
            <fileset refid="common-sources"/>
            <fileset refid="dbal-sources"/>
        </copy>
    </target>
    
100 101 102
    <!-- 
        Builds all packages, preparing them for distribution.
    -->
103
    <target name="build-orm" depends="test, build-common, build-dbal">
104
        <copy todir="${build.dir}/orm">
105
            <fileset refid="shared-artifacts"/>
106 107 108
            <fileset refid="orm-tools"/>
        </copy>
        <copy todir="${build.dir}/orm/DoctrineORM-${version}">
109 110 111
            <fileset refid="common-sources"/>
            <fileset refid="dbal-sources"/>
            <fileset refid="orm-sources"/>
112 113 114
        </copy>
        <copy todir="${build.dir}/orm/DoctrineORM-${version}/bin">
            <fileset refid="bin-scripts"/>
115 116 117
        </copy>
    </target>
    
118
    <target name="build" depends="test, build-orm"/>
119 120 121 122
    
    <!-- 
        Runs the full test suite.
    -->
123
    <target name="test" depends="prepare">
romanb's avatar
romanb committed
124 125 126 127 128 129 130 131
        <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>
132
        <phpunitreport infile="${build.dir}/logs/testsuites.xml" format="frames" todir="${report.dir}/tests" />
133 134 135
        <tstamp/>
        <svnlastrevision svnpath="${svn.path}" workingcopy="." propertyname="svn.lastrevision"/>
        <copy file="${build.dir}/logs/testsuites.xml" tofile="${log.archive.dir}/${svn.lastrevision}/log.xml" overwrite="true"/>
136 137
    </target>

138 139 140
    <!-- 
        Builds distributable PEAR packages.
    -->
141 142 143 144
    <target name="build-packages" depends="build-orm">
        <d51pearpkg2 baseinstalldir="/" dir="${build.dir}/common/DoctrineCommon-${version}">
           <name>DoctrineCommon</name>
           <summary>Common Doctrine code</summary>
145
           <channel>pear.phpdoctrine.org</channel>
146
           <description>The Doctrine Common package contains shared code between the other packages.</description>
147 148 149 150 151 152 153 154 155 156 157 158 159
           <lead user="jwage" name="Jonathan H. Wage" email="jonwage@gmail.com" />
           <lead user="guilhermeblanco" name="Guilherme Blanco" email="guilhermeblanco@gmail.com" />
           <lead user="romanb" name="Roman Borschel" email="roman@code-factory.org" />
           <license>LGPL</license>
           <version release="${version}" api="${version}" />
           <stability release="${stability}" api="${stability}" />
           <notes>-</notes>
           <dependencies>
               <php minimum_version="5.3.0" />
               <pear minimum_version="1.6.0" recommended_version="1.6.1" />
           </dependencies>
        </d51pearpkg2>
        <tar destfile="${dist.dir}/DoctrineCommon-${version_name}.tgz" basedir="${build.dir}/common" compression="gzip" />
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177

        <d51pearpkg2 baseinstalldir="/" dir="${build.dir}/dbal/DoctrineDBAL-${version}">
           <name>DoctrineDBAL</name>
           <summary>Doctrine Database Abstraction Layer</summary>
           <channel>pear.phpdoctrine.org</channel>
           <description>The Doctrine DBAL package is the database abstraction layer used to power the ORM package.</description>
           <lead user="jwage" name="Jonathan H. Wage" email="jonwage@gmail.com" />
           <lead user="guilhermeblanco" name="Guilherme Blanco" email="guilhermeblanco@gmail.com" />
           <lead user="romanb" name="Roman Borschel" email="roman@code-factory.org" />
           <license>LGPL</license>
           <version release="${version}" api="${version}" />
           <stability release="${stability}" api="${stability}" />
           <notes>-</notes>
           <dependencies>
               <php minimum_version="5.3.0" />
               <pear minimum_version="1.6.0" recommended_version="1.6.1" />
           </dependencies>
        </d51pearpkg2>
178
        <tar destfile="${dist.dir}/DoctrineDBAL-${version_name}.tgz" basedir="${build.dir}/dbal" compression="gzip" />
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204

        <d51pearpkg2 baseinstalldir="/" dir="${build.dir}/orm/DoctrineORM-${version}">
           <name>DoctrineORM</name>
           <summary>Doctrine Object Relationl Mapper</summary>
           <channel>pear.phpdoctrine.org</channel>
           <description>The Doctrine ORM package is the primary package containing the object relational mapper.</description>
           <lead user="jwage" name="Jonathan H. Wage" email="jonwage@gmail.com" />
           <lead user="guilhermeblanco" name="Guilherme Blanco" email="guilhermeblanco@gmail.com" />
           <lead user="romanb" name="Roman Borschel" email="roman@code-factory.org" />
           <license>LGPL</license>
           <version release="${version}" api="${version}" />
           <stability release="${stability}" api="${stability}" />
           <notes>-</notes>
           <dependencies>
               <php minimum_version="5.3.0" />
               <pear minimum_version="1.6.0" recommended_version="1.6.1" />
           </dependencies>
           <dirroles key="bin">script</dirroles>
           <replacement path="bin/doctrine" type="pear-config" from="@php_bin@" to="php_bin" />
           <replacement path="bin/doctrine.php" type="pear-config" from="@php_bin@" to="php_bin" />
           <replacement path="bin/doctrine.php" type="pear-config" from="@bin_dir@" to="bin_dir" />
           <release>
                <install as="doctrine" name="bin/doctrine" />
                <install as="doctrine.php" name="bin/doctrine.php" />
           </release>
        </d51pearpkg2>
205
        <tar destfile="${dist.dir}/DoctrineORM-${version_name}.tgz" basedir="${build.dir}/orm" compression="gzip" />
206
    </target>
207
</project>