1 |
<!-- build file for i-scream CMS server --> |
2 |
<!-- $Id: build.xml,v 1.12 2002/02/02 19:40:38 tdb Exp $ --> |
3 |
|
4 |
<project name="iscream-server" default="usage"> |
5 |
|
6 |
<!-- |
7 |
===================================================== |
8 |
Initialisation & Configuration |
9 |
===================================================== |
10 |
--> |
11 |
|
12 |
<property name="SOURCEROOT" value="${basedir}"/> |
13 |
<property name="CONFIGFILE" value="build.config"/> |
14 |
|
15 |
<target name="config"> |
16 |
<echo message="Reading build configuration"/> |
17 |
<property file="${CONFIGFILE}"/> |
18 |
</target> |
19 |
|
20 |
<!-- |
21 |
===================================================== |
22 |
Usage |
23 |
===================================================== |
24 |
--> |
25 |
|
26 |
<target name="usage"> |
27 |
<echo> |
28 |
|
29 |
These are the targets supported by this ANT build script: |
30 |
|
31 |
fetch - fetch all the JAR library files |
32 |
|
33 |
idl - generate java source from IDL |
34 |
build - compile all source code |
35 |
package - generate JAR package and distributions |
36 |
packageutil - generate UTIL JAR package |
37 |
|
38 |
cvsbuild - build from cvs tag |
39 |
use -Drev=TAG switch to specify cvs tag |
40 |
|
41 |
javadoc - generate javadoc API |
42 |
install - install server |
43 |
use -Dprefix=/path/ switch to specify dest |
44 |
run - run the server |
45 |
|
46 |
clean - clean all generated files |
47 |
distclean - remove 'fetched' libraries + clean |
48 |
|
49 |
Recommend to run the following target order: |
50 |
|
51 |
fetch packageutil package javadoc install |
52 |
</echo> |
53 |
</target> |
54 |
|
55 |
<target name="help"> |
56 |
<antcall target="usage"/> |
57 |
</target> |
58 |
|
59 |
<!-- |
60 |
===================================================== |
61 |
Fetch required libraries (not in dependency tree) |
62 |
===================================================== |
63 |
--> |
64 |
|
65 |
<!-- this uses static names, which is messy --> |
66 |
<!-- distclean target has same problem --> |
67 |
<target name="fetch" depends="config"> |
68 |
<get |
69 |
src="${LIBURL}/crimson.jar" |
70 |
dest="${LIBDIR}/crimson.jar" |
71 |
verbose="true" usetimestamp="true" |
72 |
/> |
73 |
<get |
74 |
src="${LIBURL}/idl.jar" |
75 |
dest="${LIBDIR}/idl.jar" |
76 |
verbose="true" usetimestamp="true" |
77 |
/> |
78 |
<get |
79 |
src="${LIBURL}/jacorb.jar" |
80 |
dest="${LIBDIR}/jacorb.jar" |
81 |
verbose="true" usetimestamp="true" |
82 |
/> |
83 |
<get |
84 |
src="${LIBURL}/jaxp.jar" |
85 |
dest="${LIBDIR}/jaxp.jar" |
86 |
verbose="true" usetimestamp="true" |
87 |
/> |
88 |
<get |
89 |
src="${LIBURL}/mm.mysql-2.0.11-bin.jar" |
90 |
dest="${LIBDIR}/mm.mysql-2.0.11-bin.jar" |
91 |
verbose="true" usetimestamp="true" |
92 |
/> |
93 |
<get |
94 |
src="${LIBURL}/pircbot.jar" |
95 |
dest="${LIBDIR}/pircbot.jar" |
96 |
verbose="true" usetimestamp="true" |
97 |
/> |
98 |
<!-- also get jacorb.properties? --> |
99 |
</target> |
100 |
|
101 |
<!-- |
102 |
===================================================== |
103 |
IDL Generation |
104 |
===================================================== |
105 |
--> |
106 |
|
107 |
<!-- generate java code from idl files --> |
108 |
<target name="idl" depends="config"> |
109 |
<echo message="Generating Java source from IDL"/> |
110 |
<java classname="${IDLPARSER}"> |
111 |
<arg line="-sloppy_names -d ${IDLDIR} ${IDLFILE}"/> |
112 |
<classpath path="${IDLPARSERJAR}"/> |
113 |
</java> |
114 |
</target> |
115 |
|
116 |
<!-- |
117 |
===================================================== |
118 |
Source code compilation (including idl-generated) |
119 |
===================================================== |
120 |
--> |
121 |
|
122 |
<target name="buildidl" depends="idl"> |
123 |
<javac |
124 |
srcdir="${IDLDIR}" |
125 |
destdir="${BUILDDIR}" |
126 |
classpath="${JCCLASSPATH}" |
127 |
includes="uk/**/*.java" |
128 |
debug="${JCDEBUG}" |
129 |
optimize="${JCOPTIM}" |
130 |
deprecation="${JCDEPRE}" |
131 |
/> |
132 |
</target> |
133 |
|
134 |
<target name="build" depends="buildidl"> |
135 |
<javac |
136 |
srcdir="${SOURCEROOT}" |
137 |
destdir="${BUILDDIR}" |
138 |
classpath="${JCCLASSPATH}" |
139 |
includes="uk/**/*.java" |
140 |
debug="${JCDEBUG}" |
141 |
optimize="${JCOPTIM}" |
142 |
deprecation="${JCDEPRE}" |
143 |
/> |
144 |
</target> |
145 |
|
146 |
<!-- |
147 |
===================================================== |
148 |
Package creation |
149 |
===================================================== |
150 |
--> |
151 |
|
152 |
<target name="makejar" depends="build"> |
153 |
<echo file="${BUILDDIR}/MANIFEST_TMP" |
154 |
>Manifest-Version: 1.0 |
155 |
Created-By: www.i-scream.org.uk |
156 |
Main-Class: ${MFMAINCLASS} |
157 |
Class-Path: ${MFCLPATH} |
158 |
</echo> |
159 |
<jar |
160 |
jarfile="${BUILDDIR}/${SERVERJAR}" |
161 |
basedir="${BUILDDIR}" |
162 |
includes="uk/**/*.class" |
163 |
manifest="${BUILDDIR}/MANIFEST_TMP" |
164 |
/> |
165 |
<delete file="${BUILDDIR}/MANIFEST_TMP"/> |
166 |
</target> |
167 |
|
168 |
<target name="maketardist" depends="makejar"> |
169 |
<tar |
170 |
longfile="fail" |
171 |
basedir="${BUILDDIR}" |
172 |
tarfile="${BUILDDIR}/${TARFILE}" |
173 |
includes="${SERVERJAR}, run.sh, lib/**, etc/**, README" |
174 |
/> |
175 |
<gzip src="${BUILDDIR}/${TARFILE}" zipfile="${BUILDDIR}/${TARGZFILE}"/> |
176 |
<delete file="${BUILDDIR}/${TARFILE}"/> |
177 |
</target> |
178 |
|
179 |
<target name="makezipdist" depends="makejar"> |
180 |
<zip |
181 |
basedir="${BUILDDIR}" |
182 |
zipfile="${BUILDDIR}/${ZIPFILE}" |
183 |
includes="${SERVERJAR}, run.bat, lib/**, etc/**, README" |
184 |
/> |
185 |
</target> |
186 |
|
187 |
<target name="package" depends="maketardist, makezipdist"/> |
188 |
|
189 |
<!-- |
190 |
===================================================== |
191 |
Cleaning |
192 |
===================================================== |
193 |
--> |
194 |
|
195 |
<target name="clean" depends="config"> |
196 |
<delete dir="${IDLDIR}/${ROOTPKG}"/> |
197 |
<delete dir="${BUILDDIR}/${ROOTPKG}"/> |
198 |
<delete dir="${JDOCDIR}"/> |
199 |
<delete dir="${CVSBUILDTEMP}"/> |
200 |
<delete> |
201 |
<fileset dir="${BUILDDIR}"> |
202 |
<include name="${SERVERJAR}"/> |
203 |
<include name="${UTILJAR}"/> |
204 |
<include name="${ARCNAME}*${TAREXT}"/> |
205 |
<include name="${ARCNAME}*${TARGZEXT}"/> |
206 |
<include name="${ARCNAME}*${ZIPEXT}"/> |
207 |
</fileset> |
208 |
</delete> |
209 |
</target> |
210 |
|
211 |
<target name="distclean" depends="clean"> |
212 |
<!-- this is messy, we should only delete specific jars --> |
213 |
<delete> |
214 |
<fileset dir="${LIBDIR}" includes="*.jar"/> |
215 |
</delete> |
216 |
</target> |
217 |
|
218 |
<!-- |
219 |
===================================================== |
220 |
Running |
221 |
===================================================== |
222 |
--> |
223 |
|
224 |
<!-- is this really the best way to do this? no... --> |
225 |
<target name="run" depends="config"> |
226 |
<java classname="${MFMAINCLASS}" dir="${BUILDDIR}" fork="yes"> |
227 |
<arg line="-f ${RUNFILTERNAME}"/> |
228 |
<classpath path="${BUILDDIR}/${SERVERJAR}"/> |
229 |
</java> |
230 |
</target> |
231 |
|
232 |
<!-- |
233 |
===================================================== |
234 |
Javadoc |
235 |
===================================================== |
236 |
--> |
237 |
|
238 |
<target name="javadoc" depends="config, idl"> |
239 |
<mkdir dir="${JDOCDIR}"/> |
240 |
<!-- link in here requires a live net link! --> |
241 |
<javadoc |
242 |
packagenames="${JDOCPKGS}" |
243 |
destdir="${JDOCDIR}" |
244 |
classpath="${JCCLASSPATH}" |
245 |
author="true" |
246 |
version="true" |
247 |
private="true" |
248 |
use="true" |
249 |
windowtitle="${JDOCTITLE}" |
250 |
header="${JDOCHEADER}" |
251 |
bottom="${JDOCBOTTOM}" |
252 |
link="${JDOCJAPI}" |
253 |
> |
254 |
<!-- need to do idl generated source too --> |
255 |
<sourcepath> |
256 |
<pathelement path="${SOURCEROOT}"/> |
257 |
<pathelement path="${IDLDIR}"/> |
258 |
</sourcepath> |
259 |
</javadoc> |
260 |
</target> |
261 |
|
262 |
<!-- |
263 |
===================================================== |
264 |
Util Package |
265 |
===================================================== |
266 |
--> |
267 |
|
268 |
<!-- MUST clean here to ensure util package is tidy --> |
269 |
<target name="buildutil" depends="config, clean"> |
270 |
<javac |
271 |
srcdir="${SOURCEROOT}" |
272 |
destdir="${BUILDDIR}" |
273 |
classpath="${JCCLASSPATH}" |
274 |
includes="${UTILSRC}" |
275 |
debug="${JCDEBUG}" |
276 |
optimize="${JCOPTIM}" |
277 |
deprecation="${JCDEPRE}" |
278 |
/> |
279 |
</target> |
280 |
|
281 |
<target name="packageutil" depends="buildutil"> |
282 |
<jar |
283 |
jarfile="${BUILDDIR}/${UTILJAR}" |
284 |
basedir="${BUILDDIR}" |
285 |
includes="uk/**/*.class" |
286 |
/> |
287 |
</target> |
288 |
|
289 |
<!-- |
290 |
===================================================== |
291 |
Install |
292 |
===================================================== |
293 |
--> |
294 |
|
295 |
<target name="install" depends="config, makejar"> |
296 |
<mkdir dir="${INSTALLDEST}"/> |
297 |
<mkdir dir="${INSTALLDEST}/etc"/> |
298 |
<mkdir dir="${INSTALLDEST}/lib"/> |
299 |
<copy file="${BUILDDIR}/${SERVERJAR}" todir="${INSTALLDEST}"/> |
300 |
<copy file="${BUILDDIR}/run.sh" todir="${INSTALLDEST}"/> |
301 |
<copy file="${BUILDDIR}/run.bat" todir="${INSTALLDEST}"/> |
302 |
<copy todir="${INSTALLDEST}/lib" > |
303 |
<fileset dir="${LIBDIR}"> |
304 |
<include name="**/*.jar"/> |
305 |
<exclude name="**/CVS/*"/> |
306 |
</fileset> |
307 |
</copy> |
308 |
<copy todir="${INSTALLDEST}/etc" > |
309 |
<fileset dir="${BUILDDIR}/etc"> |
310 |
<include name="**/*"/> |
311 |
<exclude name="**/CVS/*"/> |
312 |
</fileset> |
313 |
</copy> |
314 |
<copy file="${BUILDDIR}/README" todir="${INSTALLDEST}"/> |
315 |
</target> |
316 |
|
317 |
<!-- |
318 |
===================================================== |
319 |
CVS Build |
320 |
===================================================== |
321 |
--> |
322 |
|
323 |
<target name="cvsbuild" depends="config"> |
324 |
<mkdir dir="${CVSBUILDTEMP}"/> |
325 |
<cvs |
326 |
cvsRoot="${CVSROOT}" |
327 |
command="export -d ${CVSBUILDTEMP}" |
328 |
tag="${REVISION}" |
329 |
package="${CVSMODULE}" |
330 |
/> |
331 |
<!-- it would be IDEAL to use the ant target here. |
332 |
BUT, it would need to use it's OWN properties. |
333 |
exec is a poor substitute. |
334 |
no idea about windows compatibility. --> |
335 |
<exec executable="ant" dir="${CVSBUILDTEMP}"> |
336 |
<arg value="fetch"/> |
337 |
</exec> |
338 |
<exec executable="ant" dir="${CVSBUILDTEMP}"> |
339 |
<arg value="packageutil"/> |
340 |
</exec> |
341 |
<exec executable="ant" dir="${CVSBUILDTEMP}"> |
342 |
<arg value="package"/> |
343 |
</exec> |
344 |
<copy file="${CVSBUILDTEMP}/build/${TARGZFILE}" |
345 |
tofile="${BUILDDIR}/${ARCNAME}-${REVISION}${TARGZEXT}"/> |
346 |
<copy file="${CVSBUILDTEMP}/build/${ZIPFILE}" |
347 |
tofile="${BUILDDIR}/${ARCNAME}-${REVISION}${ZIPEXT}"/> |
348 |
<!-- should we be overwriting any old util jar here? --> |
349 |
<copy file="${CVSBUILDTEMP}/build/${UTILJAR}" todir="${BUILDDIR}"/> |
350 |
</target> |
351 |
|
352 |
</project> |