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

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

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

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

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

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

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

    <target name="clean">
66 67 68
        <available file="./build.properties" property="build_properties_exist" value="true"/>
        <fail unless="build_properties_exist" message="The build.properties file is missing." />

69 70
        <delete dir="${build.dir}" includeemptydirs="true" />
        <delete dir="${dist.dir}" includeemptydirs="true" />
71
        <delete dir="${report.dir}" includeemptydirs="true" />
72 73 74
    </target>

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

    <target name="build-common">
86
        <copy todir="${build.dir}/common">
87
            <fileset refid="shared-artifacts"/>
88 89
        </copy>
        <copy todir="${build.dir}/common/DoctrineCommon-${version}">
90 91 92 93 94
            <fileset refid="common-sources"/>
        </copy>
    </target>
    
    <target name="build-dbal">
95
        <copy todir="${build.dir}/dbal">
96
            <fileset refid="shared-artifacts"/>
97 98
        </copy>
        <copy todir="${build.dir}/dbal/DoctrineDBAL-${version}">
99 100 101 102 103
            <fileset refid="common-sources"/>
            <fileset refid="dbal-sources"/>
        </copy>
    </target>
    
104 105 106
    <!-- 
        Builds all packages, preparing them for distribution.
    -->
107
    <target name="build-orm" depends="test, build-common, build-dbal">
108
        <copy todir="${build.dir}/orm">
109
            <fileset refid="shared-artifacts"/>
110 111 112
            <fileset refid="orm-tools"/>
        </copy>
        <copy todir="${build.dir}/orm/DoctrineORM-${version}">
113 114 115
            <fileset refid="common-sources"/>
            <fileset refid="dbal-sources"/>
            <fileset refid="orm-sources"/>
116 117 118
        </copy>
        <copy todir="${build.dir}/orm/DoctrineORM-${version}/bin">
            <fileset refid="bin-scripts"/>
119 120 121
        </copy>
    </target>
    
122
    <target name="build" depends="test, build-orm"/>
123 124 125 126
    
    <!-- 
        Runs the full test suite.
    -->
127
    <target name="test" depends="prepare">
128 129 130 131 132 133 134 135 136
        <if><equals arg1="${test.phpunit_generate_coverage}" arg2="1" />
            <then>
                <property name="test.phpunit_coverage_file" value="${build.dir}/logs/clover.xml" />
            </then>
            <else>
                <property name="test.phpunit_coverage_file" value="false" />
            </else>
        </if>

137 138
        <nativephpunit
            testfile="./tests/Doctrine/Tests/AllTests.php" junitlogfile="${build.dir}/logs/testsuites.xml"
139
            testdirectory="./tests"  coverageclover="${test.phpunit_coverage_file}" configuration="${test.phpunit_configuration_file}"
140
        />
141
        <phpunitreport infile="${build.dir}/logs/testsuites.xml" format="frames" todir="${report.dir}/tests" />
142 143

        <nativephpunit testfile="./tests/Doctrine/Tests/ORM/Performance/AllTests.php" testdirectory="./tests" haltonfailure="false" haltonerror="false" />
144 145 146
        <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"/>
147 148 149 150 151 152 153 154 155 156

        <if><equals arg1="${test.pmd_reports}" arg2="1" />
            <then>
                <exec command="${test.pdepend_exec} --jdepend-xml=${build.dir}/logs/jdepend.xml ./lib/Doctrine" />
                <exec command="${test.phpmd_exec} ./lib/Doctrine xml codesize --reportfile ${build.dir}/logs/phpmd.xml" />

                <copy file="${build.dir}/logs/jdepend.xml" tofile="${log.archive.dir}/${svn.lastrevision}/jdepend.xml" overwrite="true"/>
                <copy file="${build.dir}/logs/phpmd.xml" tofile="${log.archive.dir}/${svn.lastrevision}/phpmd.xml" overwrite="true"/>
            </then>
        </if>
157 158
    </target>

159 160 161
    <!-- 
        Builds distributable PEAR packages.
    -->
162 163 164 165
    <target name="build-packages" depends="build-orm">
        <d51pearpkg2 baseinstalldir="/" dir="${build.dir}/common/DoctrineCommon-${version}">
           <name>DoctrineCommon</name>
           <summary>Common Doctrine code</summary>
166
           <channel>pear.phpdoctrine.org</channel>
167
           <description>The Doctrine Common package contains shared code between the other packages.</description>
168 169 170 171 172 173 174 175 176 177 178 179 180
           <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" />
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198

        <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>
199
        <tar destfile="${dist.dir}/DoctrineDBAL-${version_name}.tgz" basedir="${build.dir}/dbal" compression="gzip" />
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225

        <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>
226
        <tar destfile="${dist.dir}/DoctrineORM-${version_name}.tgz" basedir="${build.dir}/orm" compression="gzip" />
227
    </target>
228
</project>