Permalink
Fetching contributors…
Cannot retrieve contributors at this time
168 lines (145 sloc) 6.84 KB
<?xml version="1.0"?>
<!--
Doctrine 2 build file.
-->
<project name="DoctrineMigrations" default="build" basedir=".">
<property file="build.properties" />
<!--
Fileset for artifacts shared across all distributed packages.
-->
<fileset id="shared-artifacts" dir=".">
<include name="LICENSE"/>
</fileset>
<!--
Fileset for the sources of the Doctrine Common dependency.
-->
<fileset id="common-sources" dir="vendor/doctrine/common/lib">
<include name="Doctrine/Common/**"/>
</fileset>
<!--
Fileset for the sources of the Doctrine Migrations.
-->
<fileset id="migrations-sources" dir="./lib">
<include name="Doctrine/DBAL/Migrations/**"/>
</fileset>
<!--
Fileset for the sources of the Doctrine DBAL package.
-->
<fileset id="dbal-sources" dir="vendor/doctrine/dbal/lib">
<include name="Doctrine/DBAL/**"/>
</fileset>
<!--
Fileset for source of the Symfony Console components.
-->
<fileset id="symfony-console-sources" dir="vendor/symfony/console">
<include name="Symfony/Component/**"/>
</fileset>
<!--
Fileset for source of the Symfony YAML components.
-->
<fileset id="symfony-yaml-sources" dir="vendor/symfony/yaml">
<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 Migrations package, preparing it for distribution.
-->
<target name="build-migrations" depends="test">
<copy todir="${build.dir}/migrations">
<fileset refid="shared-artifacts"/>
<fileset refid="common-sources"/>
<fileset refid="dbal-sources" />
<fileset refid="migrations-sources"/>
<fileset refid="symfony-console-sources"/>
<fileset refid="symfony-yaml-sources"/>
</copy>
<exec command="sed 's/${version.stripped}-DEV/${version}/' ${build.dir}/migrations/Doctrine/DBAL/Migrations/MigrationsVersion.php > ${build.dir}/migrations/Doctrine/DBAL/Migrations/MigrationsVersion2.php" passthru="true" />
<move file="${build.dir}/migrations/Doctrine/DBAL/Migrations/MigrationsVersion2.php" tofile="${build.dir}/migrations/Doctrine/DBAL/Migrations/MigrationsVersion.php" overwrite="true"/>
<pharpackage destfile="${build.dir}/doctrine-migrations.phar" basedir="${build.dir}/migrations" stub="./phar-cli-stub.php" compression="gzip">
<fileset dir="${build.dir}/migrations">
<include name="**/**" />
</fileset>
<metadata>
<element name="version" value="${version}" />
<element name="authors">
<element name="Johnathan H. Wage">
<element name="e-mail" value="jonwage@gmail.com" />
</element>
</element>
</metadata>
</pharpackage>
</target>
<target name="build" depends="test, build-migrations"/>
<!--
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>
<exec command="phpunit --configuration ${test.phpunit_configuration_option} ${test.phpunit_coverage_option} --log-junit ${project.basedir}/${build.dir}/logs/testsuites.xml ./tests/Doctrine/DBAL/Migrations/Tests/" passthru="true" />
<phpunitreport infile="${build.dir}/logs/testsuites.xml" format="frames" todir="${report.dir}/tests" />
<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-migrations">
<taskdef classname="phing.tasks.ext.d51PearPkg2Task" name="d51pearpkg2" />
<d51pearpkg2 baseinstalldir="/" dir="${build.dir}/migrations">
<name>DoctrineMigrations</name>
<summary>Doctrine Database Migrations</summary>
<channel>pear.doctrine-project.org</channel>
<description>The Doctrine migrations offer additional functionality on top of the database abstraction layer (DBAL) for versioning your database schema and easily deploying changes to it. It is easy to use and a very powerful tool!</description>
<lead user="jwage" name="Jonathan H. Wage" email="jonwage@gmail.com" />
<license>LGPL</license>
<version release="${version.stripped}" api="${version.stripped}" />
<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>
<exec command="pear package" dir="${build.dir}/migrations" passthru="true" />
<move file="${build.dir}/migrations/DoctrineMigrations-${version.stripped}.tgz" todir="${dist.dir}" overwrite="true"/>
</target>
</project>