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