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