Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 273 lines (243 sloc) 13.653 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 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 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
<?xml version="1.0"?>

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

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

    <property file="build.properties" />

    <!--
Fileset for artifacts shared across all distributed packages.
-->
    <fileset id="shared-artifacts" dir=".">
        <include name="LICENSE"/>
    </fileset>

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

    <!--
Fileset for the sources of the Doctrine Common dependency.
-->
    <fileset id="common-sources" dir="./lib/vendor/doctrine-common/lib">
        <include name="Doctrine/Common/**"/>
    </fileset>

    <!--
Fileset for the sources of the Doctrine DBAL dependency.
-->
    <fileset id="dbal-sources" dir="./lib/vendor/doctrine-dbal/lib">
        <include name="Doctrine/DBAL/**"/>
    </fileset>

    <!--
Fileset for the sources of the Doctrine ORM.
-->
    <fileset id="orm-sources" dir="./lib">
        <include name="Doctrine/ORM/**"/>
    </fileset>

    <!--
Fileset for source of the Symfony YAML and Console components.
-->
    <fileset id="symfony-sources" dir="./lib/vendor">
        <include name="Symfony/Component/**"/>
    </fileset>

    <!--
Clean the directory for the next build.
-->
    <target name="clean">
        <available file="./build.properties" property="build_properties_exist" value="true"/>
        <fail unless="build_properties_exist" message="The build.properties file is missing." />

        <delete dir="${build.dir}" includeemptydirs="true" />
        <delete dir="${dist.dir}" includeemptydirs="true" />
        <delete dir="${report.dir}" includeemptydirs="true" />
    </target>

    <!--
Prepare the new build directories after cleaning
-->
    <target name="prepare" depends="clean">
        <echo msg="Creating build directory: ${build.dir}" />
        <mkdir dir="${build.dir}" />
        <echo msg="Creating distribution directory: ${dist.dir}" />
        <mkdir dir="${dist.dir}" />
        <echo msg="Creating report directory: ${report.dir}" />
        <mkdir dir="${report.dir}" />
        <mkdir dir="${build.dir}/logs"/>
        <mkdir dir="${report.dir}/tests"/>
    </target>

    <!--
Builds ORM package, preparing it for distribution.
-->
    <target name="build-orm" depends="prepare">
        <exec command="grep '${version}' ${project.basedir}/lib/Doctrine/ORM/Version.php" checkreturn="true"/>
        <copy todir="${build.dir}/doctrine-orm">
            <fileset refid="shared-artifacts"/>
        </copy>
        <copy todir="${build.dir}/doctrine-orm">
            <fileset refid="common-sources"/>
            <fileset refid="dbal-sources"/>
            <fileset refid="orm-sources"/>
        </copy>
        <copy todir="${build.dir}/doctrine-orm/Doctrine">
            <fileset refid="symfony-sources"/>
        </copy>
        <copy todir="${build.dir}/doctrine-orm/bin">
            <fileset refid="bin-scripts"/>
        </copy>
        <exec command="sed 's/${version}-DEV/${version}/' ${build.dir}/doctrine-orm/Doctrine/ORM/Version.php > ${build.dir}/doctrine-orm/Doctrine/ORM/Version2.php" passthru="true" />
        <exec command="mv ${build.dir}/doctrine-orm/Doctrine/ORM/Version2.php ${build.dir}/doctrine-orm/Doctrine/ORM/Version.php" passthru="true" />
<delete dir="${build.dir}/doctrine-orm/Doctrine/Symfony/Component/Yaml/.git" includeemptydirs="true"/>
        <delete dir="${build.dir}/doctrine-orm/Doctrine/Symfony/Component/Console/.git" includeemptydirs="true"/>

    </target>

    <target name="build" depends="test, build-orm"/>

    <!--
Runs the full test suite.
-->
    <target name="test" depends="prepare">
        <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>

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

        <nativephpunit testfile="./tests/Doctrine/Tests/ORM/Performance/AllTests.php" testdirectory="./tests" haltonfailure="false" haltonerror="false" />
        <tstamp/>
        <copy file="${build.dir}/logs/testsuites.xml" tofile="${log.archive.dir}/latest/log.xml" overwrite="true"/>

        <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}/latest/jdepend.xml" overwrite="true"/>
                <copy file="${build.dir}/logs/phpmd.xml" tofile="${log.archive.dir}/latest/phpmd.xml" overwrite="true"/>
            </then>
        </if>
    </target>

    <!--
Builds distributable PEAR packages.
-->
    <target name="build-packages" depends="build-orm">
        <d51pearpkg2 baseinstalldir="/" dir="${build.dir}/doctrine-orm">
           <name>DoctrineORM</name>
           <summary>Doctrine Object Relational Mapper</summary>
           <channel>pear.doctrine-project.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" />
           <lead user="beberlei" name="Benjamin Eberlei" email="kontakt@beberlei.de" />
           <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" />
               <package name="DoctrineCommon" channel="pear.doctrine-project.org" minimum_version="${dependencies.common}" />
               <package name="DoctrineDBAL" channel="pear.doctrine-project.org" minimum_version="${dependencies.dbal}" />
               <package name="DoctrineSymfonyConsole" channel="pear.doctrine-project.org" minimum_version="2.0.0" />
               <package name="DoctrineSymfonyYaml" channel="pear.doctrine-project.org" minimum_version="2.0.0" />
           </dependencies>
           <dirroles key="bin">script</dirroles>
           <ignore>Doctrine/Common/</ignore>
           <ignore>Doctrine/DBAL/</ignore>
           <release>
                <install as="doctrine" name="bin/doctrine" />
                <install as="doctrine.php" name="bin/doctrine.php" />
                <install as="doctrine.bat" name="bin/doctrine.bat" />
           </release>
           <replacement path="bin/doctrine.bat" type="pear-config" from="@php_bin@" to="php_bin" />
           <replacement path="bin/doctrine.bat" type="pear-config" from="@bin_dir@" to="bin_dir" />
        </d51pearpkg2>
        <exec command="pear package" dir="${build.dir}/doctrine-orm" passthru="true" />
        <exec command="mv DoctrineORM-${version}.tgz ../../dist" dir="${build.dir}/doctrine-orm" passthru="true" />
        <tar destfile="dist/DoctrineORM-${version}-full.tar.gz" compression="gzip" basedir="${build.dir}">
            <fileset dir="${build.dir}">
                <include name="**/**" />
                <exclude name="logs/" />
                <exclude name="doctrine-orm/package.xml" />
            </fileset>
        </tar>
    </target>

    <target name="git-tag">
        <exec command="grep '${version}-DEV' ${project.basedir}/lib/Doctrine/ORM/Version.php" checkreturn="true"/>
        <exec command="sed 's/${version}-DEV/${version}/' ${project.basedir}/lib/Doctrine/ORM/Version.php > ${project.basedir}/lib/Doctrine/ORM/Version2.php" passthru="true" />
        <exec command="mv ${project.basedir}/lib/Doctrine/ORM/Version2.php ${project.basedir}/lib/Doctrine/ORM/Version.php" passthru="true" />
        <exec command="git add ${project.basedir}/lib/Doctrine/ORM/Version.php" passthru="true" />
        <exec command="git commit -m 'Release ${version}'" />
        <exec command="git tag -m 'Tag ${version}' -a ${version}" passthru="true" />
    </target>

    <target name="pirum-release">
        <exec command="sudo pirum add ${project.pirum_dir} ${project.basedir}/dist/DoctrineORM-${version}.tgz" dir="." passthru="true" />
        <exec command="sudo pirum build ${project.pirum_dir}" passthru="true" />
    </target>

    <target name="distribute-download">
        <copy file="dist/DoctrineORM-${version}-full.tar.gz" todir="${project.download_dir}" />
    </target>

    <target name="update-dev-version">
        <exec command="grep '${version}' ${project.basedir}/lib/Doctrine/ORM/Version.php" checkreturn="true"/>
        <propertyprompt propertyName="next_version" defaultValue="${version}" promptText="Enter next version string (without -DEV)" />
        <exec command="sed 's/${version}/${next_version}-DEV/' ${project.basedir}/lib/Doctrine/ORM/Version.php > ${project.basedir}/lib/Doctrine/ORM/Version2.php" passthru="true" />
        <exec command="mv ${project.basedir}/lib/Doctrine/ORM/Version2.php ${project.basedir}/lib/Doctrine/ORM/Version.php" passthru="true" />
        <exec command="git add ${project.basedir}/lib/Doctrine/ORM/Version.php" passthru="true" />
        <exec command="git commit -m 'Bump Dev Version to ${next_version}-DEV'" passthru="true" />
    </target>

    <target name="release" depends="git-tag,build-packages,distribute-download,pirum-release,update-dev-version" />
    
    <!--
Builds distributable PEAR packages for the Symfony Dependencies
-->
    <target name="release-symfony-dependencies" depends="build-orm">
        <d51pearpkg2 baseinstalldir="/" dir="${build.dir}/doctrine-orm">
           <name>DoctrineSymfonyConsole</name>
           <summary>Symfony Console Component</summary>
           <channel>pear.doctrine-project.org</channel>
           <description>A command line interface tool from the Symfony project. Packaged for shipping with Doctrine projects using ORM version numbers.</description>
           <lead user="fabpot" name="Fabien Potencier" email="fabien.potencier@symfony-project.com" />
           <license>NewBSD License</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>
           <ignore>Doctrine/Common/</ignore>
           <ignore>Doctrine/DBAL/</ignore>
           <ignore>Doctrine/ORM/</ignore>
           <ignore>Symfony/Component/Yaml/</ignore>
        </d51pearpkg2>
        <exec command="pear package" dir="${build.dir}/doctrine-orm" passthru="true" />
        <exec command="mv DoctrineSymfonyConsole-${version}.tgz ../../dist" dir="${build.dir}/doctrine-orm" passthru="true" />
        
        <d51pearpkg2 baseinstalldir="/" dir="${build.dir}/doctrine-orm">
           <name>DoctrineSymfonyYaml</name>
           <summary>Symfony Yaml Component</summary>
           <channel>pear.doctrine-project.org</channel>
           <description>A YAML Parser from the Symfony project. Packaged for shipping with Doctrine projects using ORM version numbers.</description>
           <lead user="fabpot" name="Fabien Potencier" email="fabien.potencier@symfony-project.com" />
           <license>NewBSD License</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>
           <ignore>Doctrine/Common/</ignore>
           <ignore>Doctrine/DBAL/</ignore>
           <ignore>Doctrine/ORM/</ignore>
           <ignore>Symfony/Component/Console/</ignore>
        </d51pearpkg2>
        <exec command="pear package" dir="${build.dir}/doctrine-orm" passthru="true" />
        <exec command="mv DoctrineSymfonyYaml-${version}.tgz ../../dist" dir="${build.dir}/doctrine-orm" passthru="true" />
        
        <exec command="sudo pirum add ${project.pirum_dir} ${project.basedir}/dist/DoctrineSymfonyConsole-${version}.tgz" dir="." passthru="true" />
        <exec command="sudo pirum add ${project.pirum_dir} ${project.basedir}/dist/DoctrineSymfonyYaml-${version}.tgz" dir="." passthru="true" />
        <exec command="sudo pirum build ${project.pirum_dir}" passthru="true" />
    </target>
</project>
Something went wrong with that request. Please try again.