Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 125 lines (105 sloc) 6.746 kB
df376cc @beberlei Initial refactoring of DBAL build.xml into a Build common project
beberlei authored
1 <?xml version="1.0"?>
2 <!-- Currently a Phing Project, may move to Ant shortly -->
3 <project name="DoctrineBuildCommon" default="prepare">
4 <!-- Phing is really annoying in this regard -->
5 <taskdef name="replace" classname="ReplaceTask" classpath="lib/vendor/doctrine-build-common/"/>
6 <taskdef name="versionincrement" classname="VersionIncrementTask" classpath="lib/vendor/doctrine-build-common/"/>
7
8 <property name="build.dir" value="${project.basedir}/build" />
9 <property name="dist.dir" value="${project.basedir}/dist" />
10
11 <!--
12 Clean the directory for the next build.
13 -->
14 <target name="clean">
15 <available file="${project.basedir}/build.properties" property="build_properties_exist" value="true"/>
16 <fail unless="build_properties_exist" message="The build.properties file is missing."/>
17
18 <delete dir="${build.dir}" includeemptydirs="true"/>
19 <delete dir="${dist.dir}" includeemptydirs="true"/>
20 </target>
21
22 <!--
23 Prepare the new build directories after cleaning
24 -->
25 <target name="prepare" depends="clean">
26 <echo msg="Creating build directory: ${build.dir}"/>
27 <mkdir dir="${build.dir}"/>
28 <mkdir dir="${build.dir}/logs"/>
29 <echo msg="Creating distribution directory: ${dist.dir}"/>
30 <mkdir dir="${dist.dir}"/>
31
32 <!-- Including version file and getting the current version from it into a variable -->
33 <exec executable="php" outputProperty="version">
34 <arg value="-r"/>
35 <arg value="include '${project.basedir}/${project.version_file}';echo ${project.version_class}::VERSION;"/>
36 </exec>
37
38 <!-- Guessing the Stability for PEAR from the version -->
39 <condition property="pear.stability" value="beta">
40 <contains string="${version}" substring="beta" casesensitive="false"/>
41 </condition>
42 <condition property="pear.stability" value="alpha">
43 <contains string="${version}" substring="alpha" casesensitive="false"/>
44 </condition>
efa94de @beberlei PEAR Dev Versions have to be named devel
beberlei authored
45 <condition property="pear.stability" value="devel">
7560e36 @beberlei Fix another bug in packaging.xml
beberlei authored
46 <contains string="${version}" substring="dev" casesensitive="false"/>
df376cc @beberlei Initial refactoring of DBAL build.xml into a Build common project
beberlei authored
47 </condition>
7551ad6 @beberlei Fix bug in make-release-commit and version increment
beberlei authored
48 <condition property="pear.stability" value="beta">
49 <contains string="${version}" substring="rc" casesensitive="false" />
50 </condition>
df376cc @beberlei Initial refactoring of DBAL build.xml into a Build common project
beberlei authored
51 <condition property="pear.stability" value="stable">
52 <not><isset property="pear.stability"/></not>
53 </condition>
54
55 <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"/>
56 <!-- We need an extra PEAR version, as pear versions dont allow dashes and need to be DEVEL not DEV" -->
5812b7a @beberlei strtoupper of pear versions
beberlei authored
57 <exec command="php -r &quot;echo strtoupper(str_replace(array('-DEV', '-'), array('DEVEL', ''), '${version}'));&quot;" outputProperty="pear.version"/>
df376cc @beberlei Initial refactoring of DBAL build.xml into a Build common project
beberlei authored
58 <echo msg="Preparing release of version ${version} (${pear.version}+${pear.stability})"/>
59 </target>
60
61 <!-- Generate the PEAR package from a directory and move the files to the dist folder -->
62 <target name="generate-package" depends="define-pear-package">
63 <exec command="pear package" dir="${build.dir}/${project.name}-${version}" passthru="true"/>
64 <echo msg="Moving ${project.name}-${pear.version}.tgz"/>
65 <exec command="mv ${project.name}-${pear.version}.tgz ${dist.dir}/" dir="${build.dir}/${project.name}-${version}" passthru="true" checkreturn="true"/>
66 <tar destfile="dist/${project.name}-${version}-full.tar.gz" compression="gzip" basedir="${build.dir}">
67 <fileset dir="${build.dir}">
68 <include name="**/**"/>
69 <exclude name="logs/"/>
70 </fileset>
71 </tar>
72 </target>
73
74 <!-- Release files to Pirum directory if configured -->
75 <target name="pirum-release" if="project.pirum_dir">
0266bee @beberlei Fix bug in pirum deploy
beberlei authored
76 <exec command="sudo pirum add ${project.pirum_dir} ${dist.dir}/${project.name}-${pear.version}.tgz" dir="." passthru="true"/>
df376cc @beberlei Initial refactoring of DBAL build.xml into a Build common project
beberlei authored
77 </target>
78
79 <!-- Release files to a download directory if configured -->
80 <target name="distribute-download" if="project.download_dir">
81 <copy file="dist/${project.name}-${version}-full.tar.gz" todir="${project.download_dir}"/>
82 </target>
83
84 <target name="build" depends="define-pear-package,generate-package,distribute-download,pirum-release"/>
85
86 <!--
87 Use this task to create a new release commit.
88 -->
89 <target name="make-release-commit" depends="prepare">
90 <echo msg="Making a release commit of ${version}"/>
91
92 <condition property="isNotDevRelease" value="1">
93 <contains string="${version}" substring="-DEV" casesensitive="false"/>
94 </condition>
95 <fail unless="isNotDevRelease" message="Cannot make a release commit of a non-DEV release (again!)"/>
96
97 <!-- get default version just without -dev -->
98 <exec command="php -r &quot;echo str_replace('-DEV', '', '${version}');&quot;" outputProperty="release_version"/>
99 <!-- prompt release master for new version number anyways -->
100 <propertyprompt propertyName="release_version" defaultValue="${release_version}" promptText="Enter version to be released (without -DEV)"/>
101
102 <!-- start replacing versions in the code -->
103 <replace file="${project.basedir}/${project.version_file}" token="${version}" value="${release_version}"/>
104
105 <!-- Git commit this release commit -->
41bfb6f @stof Removed the explicit composer version from tags
stof authored
106 <exec command="git add ${project.basedir}/${project.version_file}" passthru="true"/>
df376cc @beberlei Initial refactoring of DBAL build.xml into a Build common project
beberlei authored
107 <exec command="git commit -m 'Release ${release_version}'" passthru="true"/>
5c43f26 @beberlei Uncomment git commands
beberlei authored
108 <exec command="git tag -m 'Tag ${release_version}' ${release_version}" passthru="true"/>
df376cc @beberlei Initial refactoring of DBAL build.xml into a Build common project
beberlei authored
109
110 <!-- calculate next version, assume that this is a mini version. -->
a73df08 @beberlei Bugfix in packaging.xml
beberlei authored
111 <versionincrement property="next_version" version="${release_version}" />
7551ad6 @beberlei Fix bug in make-release-commit and version increment
beberlei authored
112 <replace file="${project.basedir}/${project.version_file}" token="${release_version}" value="${next_version}-DEV"/>
41bfb6f @stof Removed the explicit composer version from tags
stof authored
113 <exec command="git add ${project.basedir}/${project.version_file}" />
5c43f26 @beberlei Uncomment git commands
beberlei authored
114 <exec command="git commit -m 'Bump dev version to ${next_version}'" />
df376cc @beberlei Initial refactoring of DBAL build.xml into a Build common project
beberlei authored
115
116 <echo msg="Made a git commit for version ${release_version} and tagged it." />
117 <echo msg="IMPORTANT: You need to push the current branch and the tag to origin now!" />
118 </target>
119
120 <target name="next-version" depends="prepare">
121 <versionincrement property="next_version" version="${version}" />
122 <echo msg="Next version is supposedly ${next_version}" />
123 </target>
124 </project>
Something went wrong with that request. Please try again.