1 |
<!-- build file for i-scream CMS server --> |
2 |
<!-- $Id: build.xml,v 1.10 2001/05/29 17:02:24 tdb1 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.4-bin.jar" |
90 |
dest="${LIBDIR}/mm.mysql-2.0.4-bin.jar" |
91 |
verbose="true" usetimestamp="true" |
92 |
/> |
93 |
<!-- also get jacorb.properties? --> |
94 |
</target> |
95 |
|
96 |
<!-- |
97 |
===================================================== |
98 |
IDL Generation |
99 |
===================================================== |
100 |
--> |
101 |
|
102 |
<!-- generate java code from idl files --> |
103 |
<target name="idl" depends="config"> |
104 |
<echo message="Generating Java source from IDL"/> |
105 |
<java classname="${IDLPARSER}"> |
106 |
<arg line="-sloppy_names -d ${IDLDIR} ${IDLFILE}"/> |
107 |
<classpath path="${IDLPARSERJAR}"/> |
108 |
</java> |
109 |
</target> |
110 |
|
111 |
<!-- |
112 |
===================================================== |
113 |
Source code compilation (including idl-generated) |
114 |
===================================================== |
115 |
--> |
116 |
|
117 |
<target name="buildidl" depends="idl"> |
118 |
<javac |
119 |
srcdir="${IDLDIR}" |
120 |
destdir="${BUILDDIR}" |
121 |
classpath="${JCCLASSPATH}" |
122 |
includes="uk/**/*.java" |
123 |
debug="${JCDEBUG}" |
124 |
optimize="${JCOPTIM}" |
125 |
deprecation="${JCDEPRE}" |
126 |
/> |
127 |
</target> |
128 |
|
129 |
<target name="build" depends="buildidl"> |
130 |
<javac |
131 |
srcdir="${SOURCEROOT}" |
132 |
destdir="${BUILDDIR}" |
133 |
classpath="${JCCLASSPATH}" |
134 |
includes="uk/**/*.java" |
135 |
debug="${JCDEBUG}" |
136 |
optimize="${JCOPTIM}" |
137 |
deprecation="${JCDEPRE}" |
138 |
/> |
139 |
</target> |
140 |
|
141 |
<!-- |
142 |
===================================================== |
143 |
Package creation |
144 |
===================================================== |
145 |
--> |
146 |
|
147 |
<target name="makejar" depends="build"> |
148 |
<echo file="${BUILDDIR}/MANIFEST_TMP" |
149 |
>Manifest-Version: 1.0 |
150 |
Created-By: www.i-scream.org.uk |
151 |
Main-Class: ${MFMAINCLASS} |
152 |
Class-Path: ${MFCLPATH} |
153 |
</echo> |
154 |
<jar |
155 |
jarfile="${BUILDDIR}/${SERVERJAR}" |
156 |
basedir="${BUILDDIR}" |
157 |
includes="uk/**/*.class" |
158 |
manifest="${BUILDDIR}/MANIFEST_TMP" |
159 |
/> |
160 |
<delete file="${BUILDDIR}/MANIFEST_TMP"/> |
161 |
</target> |
162 |
|
163 |
<target name="maketardist" depends="makejar"> |
164 |
<tar |
165 |
longfile="fail" |
166 |
basedir="${BUILDDIR}" |
167 |
tarfile="${BUILDDIR}/${TARFILE}" |
168 |
includes="${SERVERJAR}, run.sh, lib/**, etc/**, README" |
169 |
/> |
170 |
<gzip src="${BUILDDIR}/${TARFILE}" zipfile="${BUILDDIR}/${TARGZFILE}"/> |
171 |
<delete file="${BUILDDIR}/${TARFILE}"/> |
172 |
</target> |
173 |
|
174 |
<target name="makezipdist" depends="makejar"> |
175 |
<zip |
176 |
basedir="${BUILDDIR}" |
177 |
zipfile="${BUILDDIR}/${ZIPFILE}" |
178 |
includes="${SERVERJAR}, run.bat, lib/**, etc/**, README" |
179 |
/> |
180 |
</target> |
181 |
|
182 |
<target name="package" depends="maketardist, makezipdist"/> |
183 |
|
184 |
<!-- |
185 |
===================================================== |
186 |
Cleaning |
187 |
===================================================== |
188 |
--> |
189 |
|
190 |
<target name="clean" depends="config"> |
191 |
<delete dir="${IDLDIR}/${ROOTPKG}"/> |
192 |
<delete dir="${BUILDDIR}/${ROOTPKG}"/> |
193 |
<delete dir="${JDOCDIR}"/> |
194 |
<delete dir="${CVSBUILDTEMP}"/> |
195 |
<delete> |
196 |
<fileset dir="${BUILDDIR}"> |
197 |
<include name="${SERVERJAR}"/> |
198 |
<include name="${UTILJAR}"/> |
199 |
<include name="${ARCNAME}*${TAREXT}"/> |
200 |
<include name="${ARCNAME}*${TARGZEXT}"/> |
201 |
<include name="${ARCNAME}*${ZIPEXT}"/> |
202 |
</fileset> |
203 |
</delete> |
204 |
</target> |
205 |
|
206 |
<target name="distclean" depends="clean"> |
207 |
<!-- this is messy, we should only delete specific jars --> |
208 |
<delete> |
209 |
<fileset dir="${LIBDIR}" includes="*.jar"/> |
210 |
</delete> |
211 |
</target> |
212 |
|
213 |
<!-- |
214 |
===================================================== |
215 |
Running |
216 |
===================================================== |
217 |
--> |
218 |
|
219 |
<!-- is this really the best way to do this? no... --> |
220 |
<target name="run" depends="config"> |
221 |
<java classname="${MFMAINCLASS}" dir="${BUILDDIR}" fork="yes"> |
222 |
<arg line="-f ${RUNFILTERNAME}"/> |
223 |
<classpath path="${BUILDDIR}/${SERVERJAR}"/> |
224 |
</java> |
225 |
</target> |
226 |
|
227 |
<!-- |
228 |
===================================================== |
229 |
Javadoc |
230 |
===================================================== |
231 |
--> |
232 |
|
233 |
<target name="javadoc" depends="config, idl"> |
234 |
<mkdir dir="${JDOCDIR}"/> |
235 |
<!-- link in here requires a live net link! --> |
236 |
<javadoc |
237 |
packagenames="${JDOCPKGS}" |
238 |
destdir="${JDOCDIR}" |
239 |
classpath="${JCCLASSPATH}" |
240 |
author="true" |
241 |
version="true" |
242 |
private="true" |
243 |
use="true" |
244 |
windowtitle="${JDOCTITLE}" |
245 |
header="${JDOCHEADER}" |
246 |
bottom="${JDOCBOTTOM}" |
247 |
link="${JDOCJAPI}" |
248 |
> |
249 |
<!-- need to do idl generated source too --> |
250 |
<sourcepath> |
251 |
<pathelement path="${SOURCEROOT}"/> |
252 |
<pathelement path="${IDLDIR}"/> |
253 |
</sourcepath> |
254 |
</javadoc> |
255 |
</target> |
256 |
|
257 |
<!-- |
258 |
===================================================== |
259 |
Util Package |
260 |
===================================================== |
261 |
--> |
262 |
|
263 |
<!-- MUST clean here to ensure util package is tidy --> |
264 |
<target name="buildutil" depends="config, clean"> |
265 |
<javac |
266 |
srcdir="${SOURCEROOT}" |
267 |
destdir="${BUILDDIR}" |
268 |
classpath="${JCCLASSPATH}" |
269 |
includes="${UTILSRC}" |
270 |
debug="${JCDEBUG}" |
271 |
optimize="${JCOPTIM}" |
272 |
deprecation="${JCDEPRE}" |
273 |
/> |
274 |
</target> |
275 |
|
276 |
<target name="packageutil" depends="buildutil"> |
277 |
<jar |
278 |
jarfile="${BUILDDIR}/${UTILJAR}" |
279 |
basedir="${BUILDDIR}" |
280 |
includes="uk/**/*.class" |
281 |
/> |
282 |
</target> |
283 |
|
284 |
<!-- |
285 |
===================================================== |
286 |
Install |
287 |
===================================================== |
288 |
--> |
289 |
|
290 |
<target name="install" depends="config, makejar"> |
291 |
<mkdir dir="${INSTALLDEST}"/> |
292 |
<mkdir dir="${INSTALLDEST}/etc"/> |
293 |
<mkdir dir="${INSTALLDEST}/lib"/> |
294 |
<copy file="${BUILDDIR}/${SERVERJAR}" todir="${INSTALLDEST}"/> |
295 |
<copy file="${BUILDDIR}/run.sh" todir="${INSTALLDEST}"/> |
296 |
<copy file="${BUILDDIR}/run.bat" todir="${INSTALLDEST}"/> |
297 |
<copy todir="${INSTALLDEST}/lib" > |
298 |
<fileset dir="${LIBDIR}"> |
299 |
<include name="**/*.jar"/> |
300 |
<exclude name="**/CVS/*"/> |
301 |
</fileset> |
302 |
</copy> |
303 |
<copy todir="${INSTALLDEST}/etc" > |
304 |
<fileset dir="${BUILDDIR}/etc"> |
305 |
<include name="**/*"/> |
306 |
<exclude name="**/CVS/*"/> |
307 |
</fileset> |
308 |
</copy> |
309 |
<copy file="${BUILDDIR}/README" todir="${INSTALLDEST}"/> |
310 |
</target> |
311 |
|
312 |
<!-- |
313 |
===================================================== |
314 |
CVS Build |
315 |
===================================================== |
316 |
--> |
317 |
|
318 |
<target name="cvsbuild" depends="config"> |
319 |
<mkdir dir="${CVSBUILDTEMP}"/> |
320 |
<cvs |
321 |
cvsRoot="${CVSROOT}" |
322 |
command="export -d ${CVSBUILDTEMP}" |
323 |
tag="${REVISION}" |
324 |
package="${CVSMODULE}" |
325 |
/> |
326 |
<!-- it would be IDEAL to use the ant target here. |
327 |
BUT, it would need to use it's OWN properties. |
328 |
exec is a poor substitute. |
329 |
no idea about windows compatibility. --> |
330 |
<exec executable="ant" dir="${CVSBUILDTEMP}"> |
331 |
<arg value="fetch"/> |
332 |
</exec> |
333 |
<exec executable="ant" dir="${CVSBUILDTEMP}"> |
334 |
<arg value="packageutil"/> |
335 |
</exec> |
336 |
<exec executable="ant" dir="${CVSBUILDTEMP}"> |
337 |
<arg value="package"/> |
338 |
</exec> |
339 |
<copy file="${CVSBUILDTEMP}/build/${TARGZFILE}" |
340 |
tofile="${BUILDDIR}/${ARCNAME}-${REVISION}${TARGZEXT}"/> |
341 |
<copy file="${CVSBUILDTEMP}/build/${ZIPFILE}" |
342 |
tofile="${BUILDDIR}/${ARCNAME}-${REVISION}${ZIPEXT}"/> |
343 |
<!-- should we be overwriting any old util jar here? --> |
344 |
<copy file="${CVSBUILDTEMP}/build/${UTILJAR}" todir="${BUILDDIR}"/> |
345 |
</target> |
346 |
|
347 |
</project> |