| 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="phing.home" value=".."/> |
|---|
| 9 |
<property name="build.base.dir" value="build"/> |
|---|
| 10 |
<property name="pkgname" value="phing-${version}"/> |
|---|
| 11 |
<property name="build.src.dir" value="${build.base.dir}/${pkgname}"/> |
|---|
| 12 |
|
|---|
| 13 |
<!-- some default properties --> |
|---|
| 14 |
<property name="notes">This is the latest release of Phing.</property> |
|---|
| 15 |
<property name="state" value="stable"/> |
|---|
| 16 |
|
|---|
| 17 |
<taskdef |
|---|
| 18 |
name="pear-package" |
|---|
| 19 |
classname="BuildPhingPEARPackageTask" classpath="."/> |
|---|
| 20 |
|
|---|
| 21 |
<fileset dir="${phing.home}/classes/phing" id="classes"> |
|---|
| 22 |
<include name="**"/> |
|---|
| 23 |
</fileset> |
|---|
| 24 |
|
|---|
| 25 |
<fileset dir="${phing.home}/docs" id="docs"> |
|---|
| 26 |
<include name="example/**"/> |
|---|
| 27 |
<include name="phing_guide/book/**"/> |
|---|
| 28 |
</fileset> |
|---|
| 29 |
|
|---|
| 30 |
<fileset dir="${phing.home}" id="etc"> |
|---|
| 31 |
<include name="etc/**"/> |
|---|
| 32 |
<exclude name="etc/VERSION.TXT"/> |
|---|
| 33 |
</fileset> |
|---|
| 34 |
|
|---|
| 35 |
<fileset dir="${phing.home}" id="scripts"> |
|---|
| 36 |
<include name="bin/pear-*"/> |
|---|
| 37 |
<include name="bin/phing.php"/> |
|---|
| 38 |
</fileset> |
|---|
| 39 |
|
|---|
| 40 |
<fileset dir="${phing.home}" id="misc"> |
|---|
| 41 |
<include name="CHANGELOG"/> |
|---|
| 42 |
<include name="CREDITS"/> |
|---|
| 43 |
<include name="README"/> |
|---|
| 44 |
<include name="TODO"/> |
|---|
| 45 |
<exclude name="INSTALL*"/> |
|---|
| 46 |
</fileset> |
|---|
| 47 |
|
|---|
| 48 |
<!-- |
|---|
| 49 |
============================================== |
|---|
| 50 |
Main entry point |
|---|
| 51 |
============================================== |
|---|
| 52 |
--> |
|---|
| 53 |
<target name="main" if="version" depends="versioncheck,copy-files,create-package-xml,tar"/> |
|---|
| 54 |
|
|---|
| 55 |
<!-- |
|---|
| 56 |
=================================================================== |
|---|
| 57 |
Target: checks if language was given, otherwise fail |
|---|
| 58 |
=================================================================== |
|---|
| 59 |
--> |
|---|
| 60 |
<target name="versioncheck" unless="version"> |
|---|
| 61 |
<echo message="====================================================="/> |
|---|
| 62 |
<echo message="Version not specified. You must enter a version. In"/> |
|---|
| 63 |
<echo message="the future you can add this to build.properties or"/> |
|---|
| 64 |
<echo message="enter it on the command line: "/> |
|---|
| 65 |
<echo message=" "/> |
|---|
| 66 |
<echo message="-Dversion=2.0.0b1"/> |
|---|
| 67 |
<echo message="====================================================="/> |
|---|
| 68 |
<input propertyname="version" promptChar=":">Phing version for package</input> |
|---|
| 69 |
|
|---|
| 70 |
<property name="pkgname" value="phing-${version}" override="true"/> |
|---|
| 71 |
<property name="build.src.dir" value="${build.base.dir}/${pkgname}" override="true"/> |
|---|
| 72 |
|
|---|
| 73 |
</target> |
|---|
| 74 |
|
|---|
| 75 |
<!-- |
|---|
| 76 |
============================================== |
|---|
| 77 |
Copy the desired files into the build/ dir |
|---|
| 78 |
making sure to put them in the directory |
|---|
| 79 |
structure that will be needed for PEAR install |
|---|
| 80 |
============================================== |
|---|
| 81 |
--> |
|---|
| 82 |
<target name="copy-files"> |
|---|
| 83 |
|
|---|
| 84 |
<echo>-----------------------------</echo> |
|---|
| 85 |
<echo>| Creating directory layout |</echo> |
|---|
| 86 |
<echo>-----------------------------</echo> |
|---|
| 87 |
|
|---|
| 88 |
<delete dir="${build.base.dir}"/> |
|---|
| 89 |
|
|---|
| 90 |
<copy todir="${build.src.dir}"> |
|---|
| 91 |
<fileset refid="classes"/> |
|---|
| 92 |
<fileset refid="docs"/> |
|---|
| 93 |
<fileset refid="etc"/> |
|---|
| 94 |
<fileset refid="scripts"/> |
|---|
| 95 |
<fileset refid="misc"/> |
|---|
| 96 |
</copy> |
|---|
| 97 |
|
|---|
| 98 |
<append destFile="${build.src.dir}/etc/VERSION.TXT">Phing version ${version}</append> |
|---|
| 99 |
|
|---|
| 100 |
<chmod file="${build.src.dir}/bin/pear-phing" mode="755"/> |
|---|
| 101 |
|
|---|
| 102 |
</target> |
|---|
| 103 |
|
|---|
| 104 |
<!-- |
|---|
| 105 |
============================================== |
|---|
| 106 |
Create a PEAR package.xml which will guide the |
|---|
| 107 |
installation. |
|---|
| 108 |
============================================== |
|---|
| 109 |
--> |
|---|
| 110 |
<target name="create-package-xml" depends="versioncheck" if="version"> |
|---|
| 111 |
|
|---|
| 112 |
<echo>-----------------------------</echo> |
|---|
| 113 |
<echo>| Creating PEAR package.xml |</echo> |
|---|
| 114 |
<echo>-----------------------------</echo> |
|---|
| 115 |
<echo></echo> |
|---|
| 116 |
<echo>... (This step may take some time) ...</echo> |
|---|
| 117 |
|
|---|
| 118 |
<delete file="${tarfile}"/> |
|---|
| 119 |
<pear-package dir="${build.src.dir}" destFile="${build.base.dir}/package.xml" version="${version}" state="${state}" notes="${notes}"> |
|---|
| 120 |
|
|---|
| 121 |
<fileset refid="classes"/> |
|---|
| 122 |
<fileset refid="docs"/> |
|---|
| 123 |
<fileset refid="etc"/> |
|---|
| 124 |
<fileset refid="misc"/> |
|---|
| 125 |
<fileset refid="scripts"/> |
|---|
| 126 |
|
|---|
| 127 |
<fileset dir="${build.src.dir}"> |
|---|
| 128 |
<include name="etc/VERSION.TXT"/> |
|---|
| 129 |
</fileset> |
|---|
| 130 |
|
|---|
| 131 |
</pear-package> |
|---|
| 132 |
|
|---|
| 133 |
</target> |
|---|
| 134 |
|
|---|
| 135 |
<!-- |
|---|
| 136 |
============================================== |
|---|
| 137 |
Create a tar.gz of the files, which will be |
|---|
| 138 |
installed by pear package manager. |
|---|
| 139 |
============================================== |
|---|
| 140 |
--> |
|---|
| 141 |
<target name="tar"> |
|---|
| 142 |
<echo>-----------------------------</echo> |
|---|
| 143 |
<echo>| Creating TAR packages |</echo> |
|---|
| 144 |
<echo>-----------------------------</echo> |
|---|
| 145 |
|
|---|
| 146 |
<property name="tgzfile" value="${build.base.dir}/${pkgname}.tgz"/> |
|---|
| 147 |
<delete file="${tgzfile}"/> |
|---|
| 148 |
<tar compression="gzip" destFile="${tgzfile}" basedir="${build.base.dir}" /> |
|---|
| 149 |
|
|---|
| 150 |
<property name="tarfile" value="${build.base.dir}/${pkgname}.tar"/> |
|---|
| 151 |
<delete file="${tarfile}"/> |
|---|
| 152 |
<tar compression="none" destFile="${tarfile}" basedir="${build.base.dir}" /> |
|---|
| 153 |
|
|---|
| 154 |
</target> |
|---|
| 155 |
|
|---|
| 156 |
</project> |
|---|