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