Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

125 lines (105 sloc) 6.746 kb
<?xml version="1.0"?>
<!-- Currently a Phing Project, may move to Ant shortly -->
<project name="DoctrineBuildCommon" default="prepare">
<!-- Phing is really annoying in this regard -->
<taskdef name="replace" classname="ReplaceTask" classpath="lib/vendor/doctrine-build-common/"/>
<taskdef name="versionincrement" classname="VersionIncrementTask" classpath="lib/vendor/doctrine-build-common/"/>
<property name="build.dir" value="${project.basedir}/build" />
<property name="dist.dir" value="${project.basedir}/dist" />
Clean the directory for the next build.
<target name="clean">
<available file="${project.basedir}/" property="build_properties_exist" value="true"/>
<fail unless="build_properties_exist" message="The file is missing."/>
<delete dir="${build.dir}" includeemptydirs="true"/>
<delete dir="${dist.dir}" includeemptydirs="true"/>
Prepare the new build directories after cleaning
<target name="prepare" depends="clean">
<echo msg="Creating build directory: ${build.dir}"/>
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.dir}/logs"/>
<echo msg="Creating distribution directory: ${dist.dir}"/>
<mkdir dir="${dist.dir}"/>
<!-- Including version file and getting the current version from it into a variable -->
<exec executable="php" outputProperty="version">
<arg value="-r"/>
<arg value="include '${project.basedir}/${project.version_file}';echo ${project.version_class}::VERSION;"/>
<!-- Guessing the Stability for PEAR from the version -->
<condition property="pear.stability" value="beta">
<contains string="${version}" substring="beta" casesensitive="false"/>
<condition property="pear.stability" value="alpha">
<contains string="${version}" substring="alpha" casesensitive="false"/>
<condition property="pear.stability" value="devel">
<contains string="${version}" substring="dev" casesensitive="false"/>
<condition property="pear.stability" value="beta">
<contains string="${version}" substring="rc" casesensitive="false" />
<condition property="pear.stability" value="stable">
<not><isset property="pear.stability"/></not>
<exec command="php -r &quot;\$data = json_decode(file_get_contents('composer.json'), true); \$ret = (isset(\$data['version']) &amp;&amp; \$data['version'] != '${version}') ? 1 : 0;exit(\$ret);&quot;" checkreturn="true" passthru="true"/>
<!-- We need an extra PEAR version, as pear versions dont allow dashes and need to be DEVEL not DEV" -->
<exec command="php -r &quot;echo strtoupper(str_replace(array('-DEV', '-'), array('DEVEL', ''), '${version}'));&quot;" outputProperty="pear.version"/>
<echo msg="Preparing release of version ${version} (${pear.version}+${pear.stability})"/>
<!-- Generate the PEAR package from a directory and move the files to the dist folder -->
<target name="generate-package" depends="define-pear-package">
<exec command="pear package" dir="${build.dir}/${}-${version}" passthru="true"/>
<echo msg="Moving ${}-${pear.version}.tgz"/>
<exec command="mv ${}-${pear.version}.tgz ${dist.dir}/" dir="${build.dir}/${}-${version}" passthru="true" checkreturn="true"/>
<tar destfile="dist/${}-${version}-full.tar.gz" compression="gzip" basedir="${build.dir}">
<fileset dir="${build.dir}">
<include name="**/**"/>
<exclude name="logs/"/>
<!-- Release files to Pirum directory if configured -->
<target name="pirum-release" if="project.pirum_dir">
<exec command="sudo pirum add ${project.pirum_dir} ${dist.dir}/${}-${pear.version}.tgz" dir="." passthru="true"/>
<!-- Release files to a download directory if configured -->
<target name="distribute-download" if="project.download_dir">
<copy file="dist/${}-${version}-full.tar.gz" todir="${project.download_dir}"/>
<target name="build" depends="define-pear-package,generate-package,distribute-download,pirum-release"/>
Use this task to create a new release commit.
<target name="make-release-commit" depends="prepare">
<echo msg="Making a release commit of ${version}"/>
<condition property="isNotDevRelease" value="1">
<contains string="${version}" substring="-DEV" casesensitive="false"/>
<fail unless="isNotDevRelease" message="Cannot make a release commit of a non-DEV release (again!)"/>
<!-- get default version just without -dev -->
<exec command="php -r &quot;echo str_replace('-DEV', '', '${version}');&quot;" outputProperty="release_version"/>
<!-- prompt release master for new version number anyways -->
<propertyprompt propertyName="release_version" defaultValue="${release_version}" promptText="Enter version to be released (without -DEV)"/>
<!-- start replacing versions in the code -->
<replace file="${project.basedir}/${project.version_file}" token="${version}" value="${release_version}"/>
<!-- Git commit this release commit -->
<exec command="git add ${project.basedir}/${project.version_file}" passthru="true"/>
<exec command="git commit -m 'Release ${release_version}'" passthru="true"/>
<exec command="git tag -m 'Tag ${release_version}' ${release_version}" passthru="true"/>
<!-- calculate next version, assume that this is a mini version. -->
<versionincrement property="next_version" version="${release_version}" />
<replace file="${project.basedir}/${project.version_file}" token="${release_version}" value="${next_version}-DEV"/>
<exec command="git add ${project.basedir}/${project.version_file}" />
<exec command="git commit -m 'Bump dev version to ${next_version}'" />
<echo msg="Made a git commit for version ${release_version} and tagged it." />
<echo msg="IMPORTANT: You need to push the current branch and the tag to origin now!" />
<target name="next-version" depends="prepare">
<versionincrement property="next_version" version="${version}" />
<echo msg="Next version is supposedly ${next_version}" />
Jump to Line
Something went wrong with that request. Please try again.