| 1 | <?xml version="1.0"?> |
|---|
| 2 | <!-- |
|---|
| 3 | This build file packages the phing files, builds a package.xml (version 2) for installation |
|---|
| 4 | using PEAR and creates the TAR and TGZ files. |
|---|
| 5 | --> |
|---|
| 6 | <project name="phing" basedir="." default="main"> |
|---|
| 7 | |
|---|
| 8 | <property name="phingpkg.home" value=".."/> |
|---|
| 9 | <property name="build.pear.dir" value="pear"/> |
|---|
| 10 | |
|---|
| 11 | <taskdef |
|---|
| 12 | name="pear-package" |
|---|
| 13 | classname="BuildPhingPEARPackageTask" classpath="."/> |
|---|
| 14 | |
|---|
| 15 | <fileset dir="${phingpkg.home}" id="all"> |
|---|
| 16 | <include name="**/**"/> |
|---|
| 17 | <exclude name="bin/pear-phing"/> |
|---|
| 18 | <exclude name="bin/pear-phing.bat"/> |
|---|
| 19 | <exclude name="build/**"/> |
|---|
| 20 | <exclude name=".settings/**"/> |
|---|
| 21 | <exclude name=".buildpath"/> |
|---|
| 22 | <exclude name=".project"/> |
|---|
| 23 | <exclude name="test/performance/**"/> |
|---|
| 24 | <exclude name="test/reports/**"/> |
|---|
| 25 | </fileset> |
|---|
| 26 | |
|---|
| 27 | <fileset dir="${phingpkg.home}/classes/phing" id="classes"> |
|---|
| 28 | <include name="**"/> |
|---|
| 29 | </fileset> |
|---|
| 30 | |
|---|
| 31 | <fileset dir="${phingpkg.home}/docs" id="docs"> |
|---|
| 32 | <include name="api/docs/**"/> |
|---|
| 33 | <include name="example/**"/> |
|---|
| 34 | <include name="phing_guide/book/**"/> |
|---|
| 35 | </fileset> |
|---|
| 36 | |
|---|
| 37 | <fileset dir="${phingpkg.home}" id="etc"> |
|---|
| 38 | <include name="etc/**"/> |
|---|
| 39 | </fileset> |
|---|
| 40 | |
|---|
| 41 | <fileset dir="${phingpkg.home}" id="etc-no-version"> |
|---|
| 42 | <include name="etc/**"/> |
|---|
| 43 | <exclude name="etc/VERSION.TXT"/> |
|---|
| 44 | </fileset> |
|---|
| 45 | |
|---|
| 46 | <fileset dir="${phingpkg.home}" id="scripts"> |
|---|
| 47 | <include name="bin/pear-*"/> |
|---|
| 48 | <include name="bin/phing.php"/> |
|---|
| 49 | </fileset> |
|---|
| 50 | |
|---|
| 51 | <fileset dir="${phingpkg.home}" id="misc"> |
|---|
| 52 | <include name="CHANGELOG"/> |
|---|
| 53 | <include name="CREDITS"/> |
|---|
| 54 | <include name="TODO"/> |
|---|
| 55 | <include name="UPGRADE"/> |
|---|
| 56 | <exclude name="INSTALL*"/> |
|---|
| 57 | </fileset> |
|---|
| 58 | |
|---|
| 59 | <!-- |
|---|
| 60 | ============================================== |
|---|
| 61 | Main entry point |
|---|
| 62 | ============================================== |
|---|
| 63 | --> |
|---|
| 64 | <target name="main" if="version" |
|---|
| 65 | depends="versioncheck,setproperties,clean,copy-files,create-package-xml,tar"/> |
|---|
| 66 | |
|---|
| 67 | <!-- |
|---|
| 68 | =================================================================== |
|---|
| 69 | Retrieve version number from commandline if not set |
|---|
| 70 | =================================================================== |
|---|
| 71 | --> |
|---|
| 72 | <target name="versioncheck" unless="version"> |
|---|
| 73 | <echo message="====================================================="/> |
|---|
| 74 | <echo message="Version not specified. You must enter a version. In"/> |
|---|
| 75 | <echo message="the future you can add this to build.properties or"/> |
|---|
| 76 | <echo message="enter it on the command line: "/> |
|---|
| 77 | <echo message=" "/> |
|---|
| 78 | <echo message="-Dversion=2.0.0b1"/> |
|---|
| 79 | <echo message="====================================================="/> |
|---|
| 80 | <input propertyname="version" promptChar=":">Phing version for package</input> |
|---|
| 81 | |
|---|
| 82 | </target> |
|---|
| 83 | |
|---|
| 84 | <!-- |
|---|
| 85 | ============================================== |
|---|
| 86 | Sets some default properties |
|---|
| 87 | ============================================== |
|---|
| 88 | --> |
|---|
| 89 | <target name="setproperties"> |
|---|
| 90 | |
|---|
| 91 | <property name="pkgname" value="phing-${version}"/> |
|---|
| 92 | <property name="pkgname-docs" value="phingdocs-${version}" override="true"/> |
|---|
| 93 | <property name="build.src.dir" value="${build.pear.dir}/phing/${pkgname}"/> |
|---|
| 94 | <property name="build.docs.dir" value="${build.pear.dir}/phingdocs/${pkgname-docs}" override="true"/> |
|---|
| 95 | <property name="build.full.dir" value="full/${pkgname}"/> |
|---|
| 96 | |
|---|
| 97 | <if> |
|---|
| 98 | <isset property="version"/> |
|---|
| 99 | <then> |
|---|
| 100 | <if> |
|---|
| 101 | <contains string="${version}" substring="RC"/> |
|---|
| 102 | <then> |
|---|
| 103 | <property name="notes">This is the latest beta release of Phing.</property> |
|---|
| 104 | <property name="state" value="beta"/> |
|---|
| 105 | </then> |
|---|
| 106 | |
|---|
| 107 | <elseif> |
|---|
| 108 | <contains string="${version}" substring="snapshot"/> |
|---|
| 109 | <then> |
|---|
| 110 | <property name="notes">This is a snapshot release that might not be functional.</property> |
|---|
| 111 | <property name="state" value="alpha"/> |
|---|
| 112 | </then> |
|---|
| 113 | </elseif> |
|---|
| 114 | |
|---|
| 115 | <else> |
|---|
| 116 | <property name="notes">This is the latest stable release of Phing.</property> |
|---|
| 117 | <property name="state" value="stable"/> |
|---|
| 118 | </else> |
|---|
| 119 | </if> |
|---|
| 120 | </then> |
|---|
| 121 | </if> |
|---|
| 122 | |
|---|
| 123 | <echo>Building Phing PEAR/full version ${version}</echo> |
|---|
| 124 | <echo>Build notes: ${notes} (${state})</echo> |
|---|
| 125 | |
|---|
| 126 | </target> |
|---|
| 127 | |
|---|
| 128 | <!-- |
|---|
| 129 | ============================================== |
|---|
| 130 | Copy the desired files into the build/ dir |
|---|
| 131 | making sure to put them in the directory |
|---|
| 132 | structure that will be needed for PEAR install |
|---|
| 133 | ============================================== |
|---|
| 134 | --> |
|---|
| 135 | <target name="copy-files"> |
|---|
| 136 | |
|---|
| 137 | <echo>-----------------------------</echo> |
|---|
| 138 | <echo>| Creating directory layout |</echo> |
|---|
| 139 | <echo>-----------------------------</echo> |
|---|
| 140 | |
|---|
| 141 | <copy todir="${build.full.dir}"> |
|---|
| 142 | <fileset refid="all"/> |
|---|
| 143 | </copy> |
|---|
| 144 | |
|---|
| 145 | <copy todir="${build.src.dir}"> |
|---|
| 146 | <fileset refid="classes"/> |
|---|
| 147 | <fileset refid="etc-no-version"/> |
|---|
| 148 | <fileset refid="scripts"/> |
|---|
| 149 | <fileset refid="misc"/> |
|---|
| 150 | </copy> |
|---|
| 151 | |
|---|
| 152 | <!-- copy README.md to README --> |
|---|
| 153 | <copy file="${phingpkg.home}/README.md" tofile="${build.src.dir}/README"/> |
|---|
| 154 | |
|---|
| 155 | <copy todir="${build.docs.dir}"> |
|---|
| 156 | <fileset refid="docs"/> |
|---|
| 157 | </copy> |
|---|
| 158 | |
|---|
| 159 | <echo append="false" file="${build.src.dir}/etc/VERSION.TXT">Phing ${version}</echo> |
|---|
| 160 | <echo append="false" file="${build.full.dir}/etc/VERSION.TXT">Phing ${version}</echo> |
|---|
| 161 | |
|---|
| 162 | <chmod file="${build.src.dir}/bin/pear-phing" mode="755"/> |
|---|
| 163 | <chmod file="${build.full.dir}/bin/phing" mode="755"/> |
|---|
| 164 | |
|---|
| 165 | </target> |
|---|
| 166 | |
|---|
| 167 | <!-- |
|---|
| 168 | ============================================== |
|---|
| 169 | Create a PEAR package.xml which will guide the |
|---|
| 170 | installation. |
|---|
| 171 | ============================================== |
|---|
| 172 | --> |
|---|
| 173 | <target name="create-package-xml" depends="versioncheck" if="version"> |
|---|
| 174 | |
|---|
| 175 | <echo>-----------------------------</echo> |
|---|
| 176 | <echo>| Creating PEAR package.xml |</echo> |
|---|
| 177 | <echo>-----------------------------</echo> |
|---|
| 178 | <echo></echo> |
|---|
| 179 | <echo>... (This step may take some time) ...</echo> |
|---|
| 180 | |
|---|
| 181 | <delete file="${tarfile}"/> |
|---|
| 182 | <pear-package mode="source" dir="${build.src.dir}" |
|---|
| 183 | destFile="${build.pear.dir}/phing/package.xml" version="${version}" state="${state}" notes="${notes}"> |
|---|
| 184 | |
|---|
| 185 | <fileset refid="classes"/> |
|---|
| 186 | <fileset refid="etc"/> |
|---|
| 187 | <fileset refid="misc"/> |
|---|
| 188 | <fileset refid="scripts"/> |
|---|
| 189 | |
|---|
| 190 | <fileset dir="${build.src.dir}"> |
|---|
| 191 | <include name="README"/> |
|---|
| 192 | </fileset> |
|---|
| 193 | |
|---|
| 194 | </pear-package> |
|---|
| 195 | |
|---|
| 196 | <pear-package mode="docs" dir="${build.docs.dir}" |
|---|
| 197 | destFile="${build.pear.dir}/phingdocs/package.xml" version="${version}" state="${state}" notes="${notes}"> |
|---|
| 198 | |
|---|
| 199 | <fileset refid="docs"/> |
|---|
| 200 | |
|---|
| 201 | </pear-package> |
|---|
| 202 | |
|---|
| 203 | </target> |
|---|
| 204 | |
|---|
| 205 | <!-- |
|---|
| 206 | ============================================== |
|---|
| 207 | Create a tar.gz of the files, which will be |
|---|
| 208 | installed by pear package manager. |
|---|
| 209 | ============================================== |
|---|
| 210 | --> |
|---|
| 211 | <target name="tar"> |
|---|
| 212 | |
|---|
| 213 | <echo>-----------------------------</echo> |
|---|
| 214 | <echo>| Creating PEAR packages |</echo> |
|---|
| 215 | <echo>-----------------------------</echo> |
|---|
| 216 | |
|---|
| 217 | <property name="tgzfile" value="${build.pear.dir}/${pkgname}.tgz"/> |
|---|
| 218 | <delete file="${tgzfile}"/> |
|---|
| 219 | <tar compression="gzip" destFile="${tgzfile}" |
|---|
| 220 | basedir="${build.pear.dir}/phing" /> |
|---|
| 221 | |
|---|
| 222 | <property name="tarfile" value="${build.pear.dir}/${pkgname}.tar"/> |
|---|
| 223 | <delete file="${tarfile}"/> |
|---|
| 224 | <tar compression="none" destFile="${tarfile}" |
|---|
| 225 | basedir="${build.pear.dir}/phing" /> |
|---|
| 226 | |
|---|
| 227 | <property name="tgzfile-docs" value="${build.pear.dir}/${pkgname-docs}.tgz"/> |
|---|
| 228 | <delete file="${tgzfile-docs}"/> |
|---|
| 229 | <tar compression="gzip" destFile="${tgzfile-docs}" |
|---|
| 230 | basedir="${build.pear.dir}/phingdocs" /> |
|---|
| 231 | |
|---|
| 232 | <property name="tarfile-docs" value="${build.pear.dir}/${pkgname-docs}.tar"/> |
|---|
| 233 | <delete file="${tarfile-docs}"/> |
|---|
| 234 | <tar compression="none" destFile="${tarfile-docs}" |
|---|
| 235 | basedir="${build.pear.dir}/phingdocs" /> |
|---|
| 236 | |
|---|
| 237 | <property name="tgzfile-full" value="full/${pkgname}.tgz"/> |
|---|
| 238 | <delete file="${tgzfile-full}"/> |
|---|
| 239 | <tar compression="gzip" destFile="${tgzfile-full}" |
|---|
| 240 | basedir="full/${pkgname}" /> |
|---|
| 241 | |
|---|
| 242 | <property name="zipfile-full" value="full/${pkgname}.zip"/> |
|---|
| 243 | <delete file="${zipfile-full}"/> |
|---|
| 244 | <zip destFile="${zipfile-full}" basedir="full/${pkgname}" /> |
|---|
| 245 | </target> |
|---|
| 246 | |
|---|
| 247 | <!-- |
|---|
| 248 | ============================================== |
|---|
| 249 | Clean up build files. |
|---|
| 250 | ============================================== |
|---|
| 251 | --> |
|---|
| 252 | <target name="clean-external"> |
|---|
| 253 | <phing phingfile="../docs/example/build.xml" |
|---|
| 254 | target="clean"/> |
|---|
| 255 | |
|---|
| 256 | <phing phingfile="build.xml" dir="../docs/api" |
|---|
| 257 | target="clean"/> |
|---|
| 258 | |
|---|
| 259 | <phing phingfile="build.xml" dir="../docs/api" |
|---|
| 260 | target="build"/> |
|---|
| 261 | </target> |
|---|
| 262 | |
|---|
| 263 | <!-- |
|---|
| 264 | ============================================== |
|---|
| 265 | Clean up build files. |
|---|
| 266 | ============================================== |
|---|
| 267 | --> |
|---|
| 268 | <target name="clean" depends="clean-external"> |
|---|
| 269 | |
|---|
| 270 | <echo>-----------------------------</echo> |
|---|
| 271 | <echo>| Deleting build directory |</echo> |
|---|
| 272 | <echo>-----------------------------</echo> |
|---|
| 273 | |
|---|
| 274 | <delete dir="${build.pear.dir}"/> |
|---|
| 275 | <delete dir="full"/> |
|---|
| 276 | |
|---|
| 277 | </target> |
|---|
| 278 | |
|---|
| 279 | </project> |
|---|