Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 215 lines (184 sloc) 8.647 kb
864cb39 @markstory Adding phing build.xml
markstory authored
1 <?xml version="1.0" encoding="utf-8"?>
2 <project name="CakePHP" default="build">
baaa2e6 @markstory Add help and docs.
markstory authored
3 <!--
4 Build.xml file for CakePHP
5
6 Uses phing to create releases, and pear packages.
7 Based off of build.xml in doctrine.
8
9 Requires the d51PearPkg2 to be installed:
10
11 pear channel-discover pear.domain51.com
12 pear install domain51/Phing_d51PearPkg2Task
13
14 Use the `release` task to update VERSION.txt, and create a new tag.
15 Use the `build` task to create a pear package based on the current working copy.
16 Use the `clean` task to clean up packaging artifacts.
17
18 -->
19
864cb39 @markstory Adding phing build.xml
markstory authored
20 <taskdef classname="phing.tasks.ext.d51PearPkg2Task" name="d51pearpkg2" />
21 <property file="build.properties" />
22
23 <!--
24 The set of files we're going to package
25 Exclude the cli scripts, as they get installed separately.
26 -->
27 <fileset id="libs" dir="./lib/Cake">
28 <include name="**" />
29 <exclude name="Console/cake.bat" />
30 <exclude name="Console/cake.php" />
31 <exclude name="Console/cake" />
32 </fileset>
33
34 <!--
35 CLI scripts to package and install
36 -->
37 <fileset id="cli" dir="./lib/Cake/Console">
38 <include name="cake.bat" />
39 <include name="cake.php" />
40 <include name="cake" />
41 </fileset>
42
43
44 <!-- start fresh each time. Remove the dist and build dirs -->
45 <target name="clean">
46 <delete dir="${build.dir}" includeemptydirs="true" />
47 <delete dir="${dist.dir}" includeemptydirs="true" />
48 </target>
49
1644b1c @markstory Fix a few problems with the build.xml
markstory authored
50 <!-- Read the current version, so we can replace it -->
51 <target name="current-version">
864cb39 @markstory Adding phing build.xml
markstory authored
52 <exec executable="php" outputProperty="version">
53 <arg value="-r" />
41bbc02 @markstory Add next-version task.
markstory authored
54 <arg value="$fh = file('./lib/Cake/VERSION.txt'); echo array_pop($fh);" />
864cb39 @markstory Adding phing build.xml
markstory authored
55 </exec>
1644b1c @markstory Fix a few problems with the build.xml
markstory authored
56 </target>
864cb39 @markstory Adding phing build.xml
markstory authored
57
1644b1c @markstory Fix a few problems with the build.xml
markstory authored
58 <!-- Makes directories and sets properties -->
59 <target name="prepare" depends="current-version">
864cb39 @markstory Adding phing build.xml
markstory authored
60 <!-- set PEAR stability based on version number. -->
61 <condition property="pear.stability" value="beta">
62 <contains string="${version}" substring="beta" casesensitive="false"/>
63 </condition>
64 <condition property="pear.stability" value="alpha">
65 <contains string="${version}" substring="alpha" casesensitive="false"/>
66 </condition>
67 <condition property="pear.stability" value="devel">
68 <contains string="${version}" substring="dev" casesensitive="false"/>
69 </condition>
70 <condition property="pear.stability" value="beta">
71 <contains string="${version}" substring="rc" casesensitive="false" />
72 </condition>
73 <condition property="pear.stability" value="stable">
74 <not><isset property="pear.stability"/></not>
75 </condition>
76
77 <!-- pear versions need to not have '-' -->
78 <exec executable="php" outputProperty="pear.version">
79 <arg value="-r" />
80 <arg value="echo str_replace(array('-'), array(''), '${version}');" />
81 </exec>
82
ca99ebf @markstory distribute target works
markstory authored
83 <!-- Used for other targets -->
84 <property name="pear.package" value="${project.name}-${pear.version}" />
85
864cb39 @markstory Adding phing build.xml
markstory authored
86 <echo msg="Preparing package of ${version} (${pear.version}+${pear.stability})" />
19292a0 @markstory Add git branch to phing build.
markstory authored
87
88 <!-- Get the current git branch -->
89 <exec command="git name-rev HEAD 2>/dev/null | awk '{ print $2 }'" outputProperty="git.branch" />
864cb39 @markstory Adding phing build.xml
markstory authored
90 </target>
91
92 <!--
93 Copy all the files to build/ so they can be packaged up.
94 -->
ca99ebf @markstory distribute target works
markstory authored
95 <target name="copy-files" depends="clean,prepare">
96 <echo msg="Creating build + dist directories." />
97 <mkdir dir="${build.dir}" />
98 <mkdir dir="${dist.dir}" />
99
864cb39 @markstory Adding phing build.xml
markstory authored
100 <echo msg="Copying files to build directory" />
ca99ebf @markstory distribute target works
markstory authored
101 <copy todir="${build.dir}/${pear.package}/Cake">
864cb39 @markstory Adding phing build.xml
markstory authored
102 <fileset refid="libs" />
103 </copy>
ca99ebf @markstory distribute target works
markstory authored
104 <copy todir="${build.dir}/${pear.package}/bin">
864cb39 @markstory Adding phing build.xml
markstory authored
105 <fileset refid="cli" />
106 </copy>
107 </target>
108
109 <!--
110 Define the package.xml. Using xml to make xml is fun!
111 -->
112 <target name="define-pear-package" depends="copy-files">
ca99ebf @markstory distribute target works
markstory authored
113 <d51pearpkg2 baseinstalldir="/" dir="${build.dir}/${pear.package}">
864cb39 @markstory Adding phing build.xml
markstory authored
114 <name>CakePHP</name>
af5fe31 @markstory Update build definition.
markstory authored
115 <summary>CakePHP Rapid Development Framework</summary>
ca99ebf @markstory distribute target works
markstory authored
116 <channel>pear.cakephp.org</channel>
db10bdb @ADmad Info tweaks in build file
ADmad authored
117 <description>CakePHP is an application development framework for PHP 5.2+</description>
2aa6822 @markstory Add other core members.
markstory authored
118
864cb39 @markstory Adding phing build.xml
markstory authored
119 <lead user="mark_story" name="Mark Story" email="mark@mark-story.com" />
ce80a78 @markstory Adding task to cut a release tag and push it.
markstory authored
120 <lead user="lorenzo" name="José Lorenzo Rodríguez" email="jose.zap@gmail.com" />
121 <lead user="PhpNut" name="Larry Masters" email="phpnut@cakephp.org" />
7c042a6 @ADmad Updating developer name in build file
ADmad authored
122 <developer user="ADmad" name="Adnan Sarela" email="admad.coder@gmail.com" />
2aa6822 @markstory Add other core members.
markstory authored
123 <developer user="AD7six" name="Andy Dawson" email="andydawson76@gmail.com" />
124 <developer user="Ceeram" name="Marc Ypes" email="c33ram@gmail.com" />
125 <developer user="jrbasso" name="Juan Basso" email="" />
126 <developer user="Predominant" name="Graham Weldon" email="graham@grahamweldon.com" />
127 <developer user="renan.saddam" name="Renan Gonçalves" email="renan.saddam@gmail.com" />
128 <developer user="rchavik" name="Rachman Chavik" email="rchavik@xintesa.com" />
129
864cb39 @markstory Adding phing build.xml
markstory authored
130 <license>MIT License</license>
131 <version release="${pear.version}" api="${pear.version}" />
132 <stability release="${pear.stability}" api="${pear.stability}" />
133 <notes>http://github.com/cakephp/cakephp/blob/master/README</notes>
134 <dependencies>
db10bdb @ADmad Info tweaks in build file
ADmad authored
135 <php minimum_version="5.2.8" />
864cb39 @markstory Adding phing build.xml
markstory authored
136 <pear minimum_version="1.9.0" recommended_version="1.9.4" />
137 <package name="PHPUnit" channel="pear.phpunit.de" minimum_version="3.5.0" type="optional" />
138 </dependencies>
139 <dirroles key="bin">script</dirroles>
fe3d354 @markstory Define roles in pear package for files.
markstory authored
140 <dirroles key="Cake/Test">php</dirroles>
141 <dirroles key="Cake/Console/Templates/skel">php</dirroles>
142 <dirroles key="Cake/Console/Templates/default">php</dirroles>
143 <dirroles key="Cake/View">php</dirroles>
864cb39 @markstory Adding phing build.xml
markstory authored
144 <release>
145 <install as="cake" name="bin/cake" />
146 <install as="cake.php" name="bin/cake.php" />
147 <install as="cake.bat" name="bin/cake.bat" />
148 </release>
fe3d354 @markstory Define roles in pear package for files.
markstory authored
149 <exceptions key="Cake/VERSION.txt">php</exceptions>
150 <exceptions key="Cake/LICENSE.txt">php</exceptions>
864cb39 @markstory Adding phing build.xml
markstory authored
151 </d51pearpkg2>
152 </target>
153
154 <!-- Generate the PEAR package from a directory and move the files to the dist folder -->
155 <target name="generate-package" depends="define-pear-package">
ca99ebf @markstory distribute target works
markstory authored
156 <exec command="pear package" dir="${build.dir}/${pear.package}" passthru="true"/>
157 <echo msg="Moving ${pear.package}.tgz"/>
158 <move file="${build.dir}/${pear.package}/${pear.package}.tgz" todir="${dist.dir}" />
864cb39 @markstory Adding phing build.xml
markstory authored
159 </target>
160
41bbc02 @markstory Add next-version task.
markstory authored
161 <!--
162 Bump the version number and commit that.
163 -->
1644b1c @markstory Fix a few problems with the build.xml
markstory authored
164 <target name="next-version" depends="current-version">
41bbc02 @markstory Add next-version task.
markstory authored
165 <echo msg="Incrementing version." />
1644b1c @markstory Fix a few problems with the build.xml
markstory authored
166 <propertyprompt propertyName="release_version" defaultValue="${version}" promptText="Enter version to be released."/>
41bbc02 @markstory Add next-version task.
markstory authored
167 <echo msg="$file = file_get_contents('./lib/Cake/VERSION.txt'); $file = str_replace('${version}', '${release_version}', $file); file_put_contents('./lib/Cake/VERSION.txt', $file);" />
168 <exec executable="php">
169 <arg value="-r" />
170 <arg value="$file = file_get_contents('./lib/Cake/VERSION.txt'); $file = str_replace('${version}', '${release_version}', $file); file_put_contents('./lib/Cake/VERSION.txt', $file);" />
171 </exec>
ce80a78 @markstory Adding task to cut a release tag and push it.
markstory authored
172 <echo msg="Version number updated." />
1644b1c @markstory Fix a few problems with the build.xml
markstory authored
173 <property name="version" value="${release_version}" override="true" />
ce80a78 @markstory Adding task to cut a release tag and push it.
markstory authored
174 </target>
41bbc02 @markstory Add next-version task.
markstory authored
175
393bc7f @markstory Add distribute task.
markstory authored
176 <!--
177 Create the release commit that updates the version number and pushes the commits.
178 -->
1644b1c @markstory Fix a few problems with the build.xml
markstory authored
179 <target name="release-commit" depends="next-version,prepare">
ce80a78 @markstory Adding task to cut a release tag and push it.
markstory authored
180 <echo msg="Creating new release commit" />
90423dc @markstory Add more verbose output to the various commands.
markstory authored
181 <exec command="git add ./lib/Cake/VERSION.txt" logoutput="true" checkreturn="true" />
182 <exec command="git commit -m 'Update version number to ${release_version}'" logoutput="true" checkreturn="true" />
183 <exec command="git tag -a ${release_version} -m 'CakePHP ${release_version}'" logoutput="true" checkreturn="true" />
ce80a78 @markstory Adding task to cut a release tag and push it.
markstory authored
184
185 <propertyprompt propertyName="shipit" defaultValue="n" promptText="Ship the new commit and tag?" />
186 <condition property="noshipit" value="1">
1644b1c @markstory Fix a few problems with the build.xml
markstory authored
187 <equals arg1="n" arg2="${shipit}" casesensitive="false" />
ce80a78 @markstory Adding task to cut a release tag and push it.
markstory authored
188 </condition>
189 <fail if="noshipit" msg="You said not to ship it." />
190
1644b1c @markstory Fix a few problems with the build.xml
markstory authored
191 <echo msg="Pushing commit and tag." />
19292a0 @markstory Add git branch to phing build.
markstory authored
192 <exec command="git push ${git.remote} ${git.branch}" logoutput="true" checkreturn="true" />
90423dc @markstory Add more verbose output to the various commands.
markstory authored
193 <exec command="git push ${git.remote} ${release_version}" logoutput="true" checkreturn="true" />
1644b1c @markstory Fix a few problems with the build.xml
markstory authored
194 <echo msg="Push complete." />
41bbc02 @markstory Add next-version task.
markstory authored
195 </target>
196
393bc7f @markstory Add distribute task.
markstory authored
197 <!--
af5fe31 @markstory Update build definition.
markstory authored
198 Upload to pirum pear channel.
393bc7f @markstory Add distribute task.
markstory authored
199 -->
ca99ebf @markstory distribute target works
markstory authored
200 <target name="distribute" depends="prepare">
201 <echo msg="Uploading tgz file to cakephp.org" />
1644b1c @markstory Fix a few problems with the build.xml
markstory authored
202 <exec command="scp ${dist.dir}/${pear.package}.tgz cakephp@cakephp.org:${pirum.dir}" dir="." checkreturn="true" />
ca99ebf @markstory distribute target works
markstory authored
203
204 <echo msg="Adding new release to pirum" />
1644b1c @markstory Fix a few problems with the build.xml
markstory authored
205 <exec command="ssh cakephp@cakephp.org pirum add ${pirum.dir} ${pirum.dir}/${pear.package}.tgz" checkreturn="true" />
393bc7f @markstory Add distribute task.
markstory authored
206 </target>
864cb39 @markstory Adding phing build.xml
markstory authored
207
393bc7f @markstory Add distribute task.
markstory authored
208 <!--
209 Top level easy to type targets
210 -->
211 <target name="build" depends="generate-package" />
212 <target name="release" depends="release-commit,build,distribute" />
ce80a78 @markstory Adding task to cut a release tag and push it.
markstory authored
213
864cb39 @markstory Adding phing build.xml
markstory authored
214 </project>
Something went wrong with that request. Please try again.