Permalink
Browse files

Depdendency management and build updates.

  • Loading branch information...
1 parent 35f66ab commit 366c129e750db2a07d89ab06abc266ee5c4d4611 @romanb romanb committed May 22, 2010
Showing with 82 additions and 62 deletions.
  1. +9 −0 build-dependencies.properties
  2. +62 −0 build-dependencies.xml
  3. +11 −62 build.xml
@@ -0,0 +1,9 @@
+dependencies=common,dbal
+
+common.version=2.0.0-BETA1
+common.srcdir=lib/Doctrine/Common
+common.targetdir=lib/Doctrine/Common/testcopy
+
+dbal.version=2.0.0-BETA1
+dbal.srcdir=lib/Doctrine/DBAL
+dbal.targetdir=lib/Doctrine/DBAL/testcopy
View
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+
+<project name="Doctrine Dependency Management" default="resolve-dependencies" basedir=".">
+
+ <property file="build-dependencies.properties" />
+ <property name="download.dir" value="download"/>
+
+ <target name="resolve-dependencies" description="Resolves the project dependencies.">
+ <echo message="Resolving dependencies"/>
+ <foreach list="${dependencies}" param="dependency" target="resolve-dependency" />
+ </target>
+
+ <target name="resolve-dependency">
+ <fail unless="${dependency}.version" message="${dependency}.version not set."/>
+ <fail unless="${dependency}.srcdir" message="${dependency}.srcdir not set."/>
+ <fail unless="${dependency}.targetdir" message="${dependency}.targetdir not set."/>
+
+ <property name="dependency.version" value="${${dependency}.version}"/>
+ <property name="dependency.srcdir" value="${${dependency}.srcdir}"/>
+ <property name="dependency.targetdir" value="${${dependency}.targetdir}"/>
+
+ <echo message="${dependency.targetdir}"/>
+
+ <!--
+ Check out dependency. If ${dependency.targetdir} does not exist or versions dont match.
+ When done, place version info file into ${dependency.targetdir}.
+ -->
+ <available file="${dependency.targetdir}" type="dir" property="target.dir.exists" />
+ <if>
+ <istrue value="${target.dir.exists}"/>
+ <then>
+ <property file="${dependency.targetdir}/current-version.properties" />
+ </then>
+ </if>
+ <if>
+ <or>
+ <isfalse value="${target.dir.exists}" />
+ <not><equals arg1="${dependency.version}" arg2="${current.version}"/></not>
+ </or>
+ <then>
+ <echo message="Fetching dependency '${dependency}' at version '${dependency.version}'." />
+ <delete dir="${download.dir}/${dependency}" includeemptydirs="true" />
+ <mkdir dir="${download.dir}/${dependency}" />
+ <exec command="git clone git://github.com/doctrine/${dependency}.git ${download.dir}/${dependency}" />
+ <exec command="git checkout ${dependency.version}" dir="${download.dir}/${dependency}" />
+ <delete dir="${dependency.targetdir}" includeemptydirs="true" />
+ <copy todir="${dependency.targetdir}">
+ <fileset dir="${download.dir}/${dependency}/${dependency.srcdir}">
+ <include name="**" />
+ </fileset>
+ </copy>
+ <delete file="${dependency.targetdir}/current-version.properties" />
+ <touch file="${dependency.targetdir}/current-version.properties"/>
+ <append destFile="${dependency.targetdir}/current-version.properties" text="current.version=${dependency.version}"/>
+ <delete dir="${download.dir}/${dependency}" includeemptydirs="true" />
+ </then>
+ <else>
+ <echo message="Dependency ${dependency} is available in the correct version: ${dependency.version}." />
+ </else>
+ </if>
+ </target>
+</project>
View
@@ -5,8 +5,10 @@
-->
<project name="Doctrine2" default="build" basedir=".">
- <taskdef classname="phing.tasks.ext.d51PearPkg2Task" name="d51pearpkg2" />
+ <import file="build-dependencies.xml"/>
+
<taskdef classname="NativePhpunitTask" classpath="./tools/" name="nativephpunit" />
+ <taskdef classname="phing.tasks.ext.d51PearPkg2Task" name="d51pearpkg2" />
<property file="build.properties" />
@@ -28,21 +30,21 @@
</fileset>
<!--
- Fileset for the sources of the Doctrine Common package.
+ Fileset for the sources of the Doctrine Common dependency.
-->
<fileset id="common-sources" dir="./lib">
<include name="Doctrine/Common/**"/>
</fileset>
<!--
- Fileset for the sources of the Doctrine DBAL package.
+ Fileset for the sources of the Doctrine DBAL dependency.
-->
<fileset id="dbal-sources" dir="./lib">
<include name="Doctrine/DBAL/**"/>
</fileset>
<!--
- Fileset for the sources of the Doctrine ORM package.
+ Fileset for the sources of the Doctrine ORM.
-->
<fileset id="orm-sources" dir="./lib">
<include name="Doctrine/ORM/**"/>
@@ -72,6 +74,7 @@
</target>
<target name="prepare" depends="clean">
+ <phingcall target="resolve-dependencies"/>
<echo msg="Creating build directory: ${build.dir}" />
<mkdir dir="${build.dir}" />
<echo msg="Creating distribution directory: ${dist.dir}" />
@@ -81,30 +84,11 @@
<mkdir dir="${build.dir}/logs"/>
<mkdir dir="${report.dir}/tests"/>
</target>
-
- <target name="build-common">
- <copy todir="${build.dir}/common">
- <fileset refid="shared-artifacts"/>
- </copy>
- <copy todir="${build.dir}/common/DoctrineCommon-${version}">
- <fileset refid="common-sources"/>
- </copy>
- </target>
-
- <target name="build-dbal">
- <copy todir="${build.dir}/dbal">
- <fileset refid="shared-artifacts"/>
- </copy>
- <copy todir="${build.dir}/dbal/DoctrineDBAL-${version}">
- <fileset refid="common-sources"/>
- <fileset refid="dbal-sources"/>
- </copy>
- </target>
<!--
Builds all packages, preparing them for distribution.
-->
- <target name="build-orm" depends="test, build-common, build-dbal">
+ <target name="build-orm" depends="test">
<copy todir="${build.dir}/orm">
<fileset refid="shared-artifacts"/>
<fileset refid="orm-tools"/>
@@ -125,6 +109,7 @@
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" />
@@ -133,7 +118,7 @@
<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}"
@@ -160,43 +145,6 @@
Builds distributable PEAR packages.
-->
<target name="build-packages" depends="build-orm">
- <d51pearpkg2 baseinstalldir="/" dir="${build.dir}/common/DoctrineCommon-${version}">
- <name>DoctrineCommon</name>
- <summary>Common Doctrine code</summary>
- <channel>pear.doctrine-project.org</channel>
- <description>The Doctrine Common package contains shared code between the other packages.</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>
- <tar destfile="${dist.dir}/DoctrineCommon-${version_name}.tgz" basedir="${build.dir}/common" compression="gzip" />
-
- <d51pearpkg2 baseinstalldir="/" dir="${build.dir}/dbal/DoctrineDBAL-${version}">
- <name>DoctrineDBAL</name>
- <summary>Doctrine Database Abstraction Layer</summary>
- <channel>pear.doctrine-project.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>
- <tar destfile="${dist.dir}/DoctrineDBAL-${version_name}.tgz" basedir="${build.dir}/dbal" compression="gzip" />
<d51pearpkg2 baseinstalldir="/" dir="${build.dir}/orm/DoctrineORM-${version}">
<name>DoctrineORM</name>
@@ -225,4 +173,5 @@
</d51pearpkg2>
<tar destfile="${dist.dir}/DoctrineORM-${version_name}.tgz" basedir="${build.dir}/orm" compression="gzip" />
</target>
+
</project>

0 comments on commit 366c129

Please sign in to comment.