root/greenstone3/trunk/build.xml @ 20085

Revision 20085, 71.9 KB (checked in by kjdon, 10 years ago)

tidied up some targets. indentation. using else on a condition instead of having two conditions. added a check for env.GSDL3HOME so that people have to run gs3-setup before runnign ant.

Line 
1<?xml version="1.0"?>
2<!-- ======================================================================
3     March 2005                                                   
4
5     Greenstone3 build and install script
6                 
7     kjdon                                                               
8     ====================================================================== -->
9<project name="greenstone3" default="usage" basedir=".">
10
11  <!-- ============ classpath =================== -->
12  <path id="project.classpath">
13    <fileset dir="lib/java">
14      <include name="**/*.jar"/>
15    </fileset>
16  </path>
17 
18  <!-- ============ self defined tasks =================== -->
19  <taskdef name="mysetproxy" classname="org.greenstone.anttasks.MySetProxy" classpathref="project.classpath"/>
20  <taskdef name="getuserandpassword" classname="org.greenstone.anttasks.MyGetUserAndPassword" classpathref="project.classpath"/>
21  <taskdef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="project.classpath"/>
22  <taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" classpathref="project.classpath"/>
23  <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="project.classpath"/>
24  <taskdef name="try" classname="ise.antelope.tasks.TryTask" classpathref="project.classpath"/>
25 
26  <!-- ===================== Property Definitions =========================== -->
27 
28  <!--
29
30  Each of the following properties are used in the build script.
31  Values for these properties are set by the first place they are
32  defined, from the following list:
33
34  * Definitions on the "ant" command line (ant -Dfoo=bar compile).
35
36  * Definitions from a "build.properties" file in the top level
37  source directory of this application.
38
39  * Definitions from a "build.properties" file in the user's
40  home directory.
41
42  * Default definitions in this build.xml file.
43
44  You will note below that property values can be composed based on the
45  contents of previously defined properties.  This is a powerful technique
46  that helps you minimize the number of changes required when your development
47  environment is modified.  Note that property composition is allowed within
48  "build.properties" files as well as in the "build.xml" script.
49
50  -->
51
52  <!-- create build.properties if it has not been created yet -->
53  <if>
54    <bool><not><available file="build.properties"/></not></bool>
55    <copy file="build.properties.in" tofile="build.properties"/>
56  </if>
57
58  <!-- create the packages dir if it has not been created yet -->
59  <mkdir dir="packages"/>
60 
61  <!--the first three properties have to be put on the top to be used by build.properties-->
62  <property name="gs2build.home" value="${basedir}${file.separator}gs2build"/>
63  <property name="src.packages.home" value="${basedir}/src/packages"/>
64  <property name="flax.svn.root" value="http://svn.greenstone.org/flax"/>
65
66  <property file="build.properties"/>
67  <if><bool><available file="${user.home}/build.properties"/></bool>
68    <property file="${user.home}/build.properties"/>
69  </if>
70
71  <!-- get properties from the environment -->
72  <property environment="env"/>
73
74  <!-- get the fileset defining what is sourcecode -->
75  <import file="resources/xml/components.xml"/>
76   
77  <!-- version properties for external packages -->
78  <!-- for Java versions < 1.4, we print out the message that Java is too old.
79    For Java 1.4, we use Tomcat 5.5, for Java5 and higher, we use Tomcat 6.0-->
80  <condition property="tomcat.version" value="apache-tomcat-5.5.25" else="apache-tomcat-6.0.20">
81    <equals arg1="1.4" arg2="${ant.java.version}"/>
82  </condition>
83  <condition property="tomcat.version.major" value="5" else="6">
84    <equals arg1="1.4" arg2="${ant.java.version}"/>
85  </condition>
86  <property name="axis.zip.version" value="axis-bin-1_2_1.zip"/>
87  <property name="axis.dir.version" value="axis-1_2_1"/>
88  <property name="sqlite.targz.version" value="sqlite-amalgamation-3.5.9.tar.gz"/>
89
90  <property name="build.home" value="${basedir}/build"/>
91  <property name="src.home" value="${basedir}/src/java"/>
92  <property name="packages.home" value="${basedir}/packages"/>
93  <!-- this may be set in build.properties, eg if you move the web dir to
94  tomcats webapps directory -->
95  <property name="web.home" value="${basedir}/web"/>
96  <!-- jar files needed by applets go here -->
97  <property name="web.applet" value="${web.home}/applet"/>
98
99  <!-- jar files needed by the servlet (and extra ones) go here -->
100  <property name="web.lib" value="${web.home}/WEB-INF/lib"/>
101  <!-- other files needed by the servlet go here -->
102  <property name="web.classes" value="${web.home}/WEB-INF/classes"/>
103  <!--- flax: the WordNet home -->
104  <property name="wn.home" value="${web.home}/WEB-INF/classes/flax/WordNet"/>
105
106  <!-- jni libraries and java wrappers go here -->
107  <property name="lib.jni" value="${basedir}/lib/jni"/>
108
109  <!-- other jar files needed for installation (but not runtime) go here -->
110  <property name="lib.java" value="${basedir}/lib/java"/>
111 
112  <property name="javadocs" value="${basedir}/docs/javadoc"/>
113
114  <property name="app.name"      value="greenstone3"/>
115  <property name="app.path"      value="/${app.name}"/>
116
117   <property name="admin.dir"      value="${basedir}/admin"/>
118
119  <!-- defaults - set these on the command line or in build.properties or they will take these default values-->
120  <property name="app.version" value="trunk"/>
121  <property name="branch.path" value="trunk"/>
122  <property name="branch.revision" value="HEAD"/>
123
124  <!--constants -->
125  <property name="svn.root" value="http://svn.greenstone.org"/>
126
127  <!-- catalina home is set to tomcat basedir if already installed, otherwise
128  use greenstone's tomcat -->
129  <condition property="catalina.home" value="${tomcat.installed.path}" else="${packages.home}/tomcat">
130    <and>
131      <isset property="tomcat.installed.path"/>
132      <not>
133      <equals arg1="" arg2="${tomcat.installed.path}"/>
134      </not>
135    </and>
136  </condition>
137 
138  <property name="os.linux" value="Linux"/>
139  <property name="os.mac" value="Mac OS X"/>
140  <property name="os.solaris" value="SunOS"/>
141  <property name="os.unix" value="${os.linux},${os.mac},${os.solaris}"/>
142  <property name="os.windows" value="Windows 95,Windows 98,Windows 2000,Windows 2003,Windows XP,Windows NT,Windows ME,Windows Vista"/> <!-- check this!!!-->
143
144  <!-- this is true for linux and macs -->
145  <condition property="current.os.isunix">
146    <os family="unix"/>
147  </condition>
148 
149  <condition property="current.os.isunixnotmac">
150    <and>
151      <os family="unix"/>
152      <not>
153    <os family="mac"/>
154      </not>
155    </and>
156  </condition>
157 
158  <condition property="current.os.ismac">
159    <os family="mac"/>
160  </condition>
161 
162  <condition property="current.os.iswindows">
163    <os family="windows"/>
164  </condition>
165
166  <!-- is there a better way to do this?? what about solaris?? -->
167  <condition property="os.bin.dir" value="windows">
168    <os family="windows"/>
169  </condition>
170  <condition property="os.bin.dir" value="darwin">
171    <os family="mac"/>
172  </condition>
173  <condition property="os.bin.dir" value="linux">
174    <and>
175      <os family="unix"/>
176      <not>
177    <os family="mac"/>
178      </not>
179    </and>
180  </condition>
181 
182 
183  <condition property="collection.building.disabled">
184    <isset property="disable.collection.building"/>
185  </condition>
186
187  <condition property="collection.building.enabled">
188    <not>
189      <isset property="disable.collection.building"/>
190    </not>
191  </condition>
192 
193  <condition property="collection.building.enabled.windows">
194    <and>
195      <isset property="collection.building.enabled"/>
196      <isset property="current.os.iswindows"/>
197    </and>
198  </condition>
199 
200  <condition property="collection.building.enabled.unix">
201    <and>
202      <isset property="collection.building.enabled"/>
203      <isset property="current.os.isunix"/>
204    </and>
205  </condition>
206 
207  <condition property="static.arg" value="LDFLAGS=-static" else=" ">
208    <isset property="compile.static"/>
209  </condition>
210 
211  <!-- where is search4j tool -->
212  <condition property="search4j.exec" value="bin/search4j.exe" else="bin/search4j">
213    <isset property="current.os.iswindows"/>
214  </condition>
215
216 
217  <!-- ============= Base dirs for each package and component ============ -->
218  <property name="src.gsdl3.home" value="${src.home}/org/greenstone/gsdl3"/>
219  <property name="anttasks.home" value="${src.home}/org/greenstone/anttasks"/>
220  <property name="gli.home" value="${basedir}/gli"/>
221  <property name="javagdbm.home" value="${src.packages.home}/javagdbm"/>
222
223  <condition property="common.src.home" value="${basedir}/common-src" else="${gs2build.home}/common-src">
224    <isset property="disable.collection.building"/>
225  </condition>
226 
227  <property name="build.src.home" value="${gs2build.home}/build-src"/>
228  <property name="gdbm.home" value="${common.src.home}/packages/gdbm"/>
229  <property name="mg.home" value="${common.src.home}/indexers/mg"/>
230  <property name="mgpp.home" value="${common.src.home}/indexers/mgpp"/>
231  <property name="lucene.home" value="${common.src.home}/indexers/lucene-gs"/>
232
233  <!--  ==================== Compilation Control Options ==================== -->
234
235  <!--
236
237  These properties control option settings on the Javac compiler when it
238  is invoked using the <javac> task.
239
240  compile.debug        Should compilation include the debug option?
241
242  compile.deprecation  Should compilation include the deprecation option?
243
244  compile.optimize     Should compilation include the optimize option?
245
246  -->
247
248  <property name="compile.debug"       value="true"/>
249  <property name="compile.deprecation" value="true"/>
250  <property name="compile.optimize"    value="true"/>
251
252  <!--
253
254  Rather than relying on the CLASSPATH environment variable, Ant includes
255  features that makes it easy to dynamically construct the classpath you
256  need for each compilation.  The example below constructs the compile
257  classpath to include the servlet.jar file, as well as the other components
258  that Tomcat makes available to web applications automatically, plus anything
259  that you explicitly added.
260
261  -->
262 
263  <!-- All elements that Tomcat 5 exposes to applications -->
264  <path id="tomcat5">
265    <pathelement location="${catalina.home}/common/classes"/>
266    <fileset dir="${catalina.home}/common/endorsed">
267      <include name="*.jar"/>
268    </fileset>
269    <fileset dir="${catalina.home}/common/lib">
270      <include name="*.jar"/>
271    </fileset>
272    <!-- seems to be empty, but will leave in just in case some people make use of this to customise their install: -->
273    <pathelement location="${catalina.home}/shared/classes"/>
274    <fileset dir="${catalina.home}/shared/lib">
275      <include name="*.jar"/>
276    </fileset>
277  </path>
278 
279  <!-- All elements that Tomcat 6 exposes to applications -->
280  <path id="tomcat6">
281    <fileset dir="${catalina.home}/lib">
282      <include name="*.jar"/>
283    </fileset>
284  </path>
285 
286  <path id="compile.classpath">
287    <!-- Include all jar files and libraries in our jni lib directory -->
288    <pathelement location="${lib.jni}"/>
289    <fileset dir="${lib.jni}">
290      <include name="*.jar"/>
291    </fileset>
292    <!-- Include all jar files in our web lib directory -->
293    <pathelement location="${web.lib}"/>
294    <fileset dir="${web.lib}">
295      <include name="*.jar"/>
296    </fileset>
297   
298    <pathelement location="${lib.java}"/>
299    <fileset dir="${lib.java}">
300      <include name="*.jar"/>
301    </fileset>
302   
303    <!-- include the jar files from the source packages -->
304    <!-- mg and mgpp get installed into lib/jni but they may not be there yet
305    so we add them in by name -->
306    <pathelement location="${lib.jni}/mg.jar"/>
307    <pathelement location="${lib.jni}/mgpp.jar"/>
308   
309    <!-- Include all elements that Tomcat exposes to applications -->
310    <path refid="tomcat${tomcat.version.major}"/>
311   
312  </path>
313
314  <path id="local.tomcat.classpath">
315    <!-- explicitly include the jni java wrappers in the classpath -->
316    <pathelement location="${lib.jni}"/>
317    <fileset dir="${lib.jni}">
318      <include name="*.jar"/>
319    </fileset>
320  </path>
321 
322  <path id="local.tomcat.path">
323    <pathelement location="${basedir}/bin/script"/>
324    <pathelement location="${basedir}/bin"/>
325    <pathelement location="${lib.jni}"/>
326    <pathelement path="${env.PATH}"/>
327    <pathelement path="${env.Path}"/>
328    <pathelement path="${wn.home}/bin"/>
329  </path>
330
331  <target name="test-setup">
332    <echo>ant java version=${ant.java.version}</echo>
333    <echo>is unix : ${current.os.isunix}</echo>
334    <echo>is mac : ${current.os.ismac}</echo>
335    <echo>is unixnotmac : ${current.os.isunixnotmac}</echo>
336    <echo>is windows : ${current.os.iswindows}</echo>
337    <echo>os.unix: ${os.unix}</echo>
338  </target>
339 
340  <!-- ==================== Primary and Global Targets ============================= -->
341
342  <target name="prepare" depends="accept-properties,init,prepare-core,prepare-packages,prepare-common-src,prepare-collection-building,prepare-tomcat,prepare-axis,prepare-web,prepare-collections, prepare-flax"
343    description="Use this when you first checkout the code: 'ant prepare install'. This will do some additional subversion checkouts and downloads, so you need to be online to run this.">
344
345    <!-- make sure .sh files are executable -->
346    <chmod dir="${basedir}" perm="ugo+rx"
347      includes="*.sh"/>
348    <chmod dir="${basedir}/bin/script" perm="ugo+rx"
349      includes="*.sh,*.pl"/>
350  </target>
351
352  <!-- install-common-src and install-collection-building are mutually exclusive and either one or the other will be done depending on whether collection building is enabled or not -->
353  <target name="install" depends="init,install-common-src,install-collection-building,install-runtime"
354    description="Install Greenstone 3. Use this when you first checkout the code: 'ant prepare new-install'."/>
355
356  <target name="install-common-src" depends="init"
357    description="Install (configure, compile, install) only the common-src package (shared code from Greenstone 2). " >
358    <antcall target="configure-common-src"/>
359    <antcall target="compile-common-src"/>
360    <antcall target="install-auxiliary-jar-files"/>
361    <antcall target="install-jni-files"/>
362  </target>
363
364  <target name="install-collection-building" depends="init" if="collection.building.enabled"
365    description="Install (configure, compile, install) the Greenstone 2 collection building package." >
366    <antcall target="configure-collection-building"/>
367    <antcall target="tweak-makefiles" />
368    <antcall target="compile-collection-building"/>
369  </target>
370   
371
372  <target name="install-runtime" depends="init,configure,configure-packages,configure-core,compile-web,compile-packages,compile-core"
373    description="Install (configure, compile, install) the runtime system. Needs either common-src or collection-building to have been installed first." />
374   
375  <target name="svnupdate" depends="init,svnupdate-packages,svnupdate-core,svnupdate-common-src,svnupdate-collection-building,svnupdate-web"
376    description="Do a `svn update` for all sources. Doesn't recompile the code. You need to be online to run this."/>
377 
378  <target name="configure" depends="init,configure-tomcat,configure-web"
379    description="Configure the installation (not the C++ code). Includes setting up config files. Should be re-run if you change the build.properties file."/>
380
381  <target name="clean" depends="init,clean-packages,clean-core,clean-common-src,clean-collection-building"
382    description="Remove all old compiled code. Includes runtime and collection-building if necessary"/>
383 
384  <target name="distclean" depends="init,distclean-packages,clean-core,distclean-common-src,distclean-collection-building"
385    description="Remove all compiled code and also any Makefiles etc generated during configure-c++. Includes runtime and collection-building as necessary"/>
386 
387  <target name="update" depends="init,svnupdate,clean,install"
388    description="Update (thru Subversion) all the source (including common-src or collection-building, and runtime), then clean, and re-install. To do this without any SVN updates, run it like 'ant -Dnosvn.mode=yes update'"/>
389
390  <target name="start" depends="init,start-tomcat"
391    description="Startup the Tomcat server." >
392    <echo>${app.name} (${app.version}) server running using Apache Tomcat and Java</echo>
393    <echo>Tomcat: ${catalina.home}</echo>
394    <echo>Java  : ${java.home}</echo>
395    <echo>URL   : http://${tomcat.server}:${tomcat.port}${app.path}/</echo>
396    <!-- assuming that index.html is not needed here -->   
397  </target>
398
399  <target name="stop" depends="init,stop-tomcat"
400    description="Shutdown the Tomcat server."/>
401 
402  <target name="restart" description="Shutdown and restart Tomcat"  depends="init,stop,start"/>
403
404
405  <!-- =========== Help targets ===================================  -->
406 
407  <property name="install-command" value="ant [options] prepare install"/>
408 
409  <target name="usage" description="Print a help message">
410    <echo message="  Execute 'ant -projecthelp' for a list of targets."/>
411    <echo message="  Execute 'ant -help' for Ant help."/>
412    <echo>To install Greenstone3, run '${install-command}'.
413      There are properties defined in build.properties. The install process will ask you if these properties are set correctly. To avoid this prompt, use the '-Dproperties.accepted=yes' option.
414      To log the output, use the '-logfile build.log' option.
415      The README.txt file has more information about the ant targets and install process.
416    </echo>
417  </target>
418 
419  <target name="help" depends="usage" description="Print a help message"/>
420 
421  <target name="debug" depends="init" description="Display all the currently used properties">
422    <echoproperties/>
423  </target>
424
425  <!-- ====== initialization and setup targets ================== -->
426
427  <target name="accept-properties" unless="properties.accepted">
428    <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
429      tomcat.server=${tomcat.server}
430      tomcat.port=${tomcat.port}
431      tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
432      proxy.host=${proxy.host}
433      proxy.port=${proxy.port}
434      disable.collection.building=${disable.collection.building}
435      If these are not acceptable, please change them and rerun this target. Continue [y/n]?
436    </input>
437    <condition property="do.abort">
438      <equals arg1="n" arg2="${properties.ok}"/>
439    </condition>
440    <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
441  </target>
442 
443  <!-- this sets up some initial properties -->
444  <target name="init">
445
446    <!-- has the gs3-setup script been run?? -->
447    <condition property="gs3-setup-not-done">
448      <not>
449    <isset property="env.GSDL3HOME"/>
450      </not>
451    </condition>
452
453    <fail if="gs3-setup-not-done" message="please run 'gs3-setup' (Windows) or 'source gs3-setup.sh' (Linux/Mac) before running this target."/>
454   
455    <condition property="java.too.old">
456      <or>
457        <equals arg1="1.1" arg2="${ant.java.version}"/>
458        <equals arg1="1.2" arg2="${ant.java.version}"/>
459        <equals arg1="1.3" arg2="${ant.java.version}"/>
460      </or>
461    </condition>
462    <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
463   
464    <available file="${basedir}/gli" property="gli.present"/>
465    <available file="${basedir}/common-src" property="common.src.present"/>
466    <available file="${basedir}/gs2build" property="gs2build.present"/>
467
468    <condition property="tomcat.islocal">
469      <or>
470        <not><isset property="tomcat.installed.path"/></not>
471        <equals arg1="" arg2="${tomcat.installed.path}"/>
472      </or>
473    </condition>
474   
475    <echo>tomcat.port = ${tomcat.port}</echo>
476
477    <condition property="proxy.present">
478      <and>
479        <isset property="proxy.host"/>
480        <not><equals arg1="" arg2="${proxy.host}"/></not>
481      </and>
482    </condition>
483
484  </target>
485
486  <target name="setup-proxy" depends="init" if="proxy.present">
487    <condition property="ask.user">
488      <or>
489        <equals arg1="" arg2="${proxy.user}"/>
490        <equals arg1="" arg2="${proxy.password}"/>
491      </or>
492    </condition>
493   
494    <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}" userproperty="proxy.username" pwordproperty="proxy.password"/>
495    <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
496  </target>
497 
498  <!-- ========== Web app Targets ================================ -->
499 
500  <target name="prepare-web" depends="init,configure-java-version">
501    <mkdir dir="${web.home}/applet"/>
502    <mkdir dir="${web.home}/logs"/>
503  </target>
504 
505  <!-- if we are using java 1.5+, we need the xalan.jar file in web/WEB-INF/lib,  but if we are using java 1.4, we can't have it there -->
506  <target name="configure-java-version" depends="init"
507    description="Activates or deactivates some jar libraries as needed depending on your java version">
508
509    <available property="have.xalan.jar" file="${web.lib}/xalan.jar"/>
510    <condition property="need.xalan.jar">
511      <or>
512        <equals arg1="1.5" arg2="${ant.java.version}"/>
513        <equals arg1="1.6" arg2="${ant.java.version}"/>
514      </or>
515    </condition>
516
517    <!-- if they have xalan.jar but dont need it -->
518    <if>
519      <bool>
520        <and>
521          <isset property="have.xalan.jar"/>
522          <not><isset property="need.xalan.jar"/></not>
523        </and>
524      </bool>
525      <antcall target="deactivate-xalan-jar"/>
526    </if>
527
528    <!-- if they need xalan.jar but dont have it -->
529    <if>
530      <bool>
531        <and>
532          <not><isset property="have.xalan.jar"/></not>
533          <isset property="need.xalan.jar"/>
534        </and>
535      </bool>
536      <antcall target="activate-xalan-jar"/>
537    </if>
538
539  </target>
540 
541  <target name="activate-xalan-jar">
542    <echo>activating xalan.jar</echo>
543    <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
544    <if>
545      <bool>
546    <and>
547      <isset property="current.os.ismac"/>
548      <available file="${catalina.home}/common/endorsed" type="dir"/>
549    </and>
550      </bool>
551      <copy file="${web.lib}/xalan.jar.tmp" tofile="${catalina.home}/common/endorsed/xalan.jar"/>
552    </if>
553  </target>
554
555  <target name="deactivate-xalan-jar">
556    <echo>deactivating xalan.jar</echo>
557    <delete file="${web.lib}/xalan.jar"/>
558  </target>
559
560
561  <target name="prepare-collections" depends="init">
562    <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
563    <property name="index.zip" value="index.zip"/>
564
565    <echo message="installing collections..."/>
566    <antcall target="gs2mgdemo-install"/>
567    <antcall target="gs2mgppdemo-install"/>
568    <antcall target="gberg-install"/>
569  </target>
570
571  <target name="gs2mgdemo-prepare" if="collect.dir">
572    <property name="gs2mgdemo.dir" value="${collect.dir}/gs2mgdemo"/>
573
574    <condition property="gs2mgdemo.present">
575      <and>
576        <available file="${gs2mgdemo.dir}/${index.zip}"/>
577      </and>
578    </condition>
579  </target>
580
581  <target name="gs2mgdemo-install" if="gs2mgdemo.present" depends="gs2mgdemo-prepare">
582    <echo> installing gs2mgdemo</echo>
583    <unzip dest="${gs2mgdemo.dir}" src="${gs2mgdemo.dir}/${index.zip}" />
584    <echo>collection gs2mgdemo installed</echo>
585  </target>
586
587  <target name="gs2mgppdemo-prepare" if="collect.dir">
588    <property name="gs2mgppdemo.dir" value="${collect.dir}/gs2mgppdemo"/>
589 
590    <condition property="gs2mgppdemo.present">
591      <and>
592        <available file="${gs2mgppdemo.dir}/${index.zip}"/>
593      </and>
594    </condition>
595  </target>
596
597  <target name="gs2mgppdemo-install" if="gs2mgppdemo.present" depends="gs2mgppdemo-prepare">
598    <unzip dest="${gs2mgppdemo.dir}" src="${gs2mgppdemo.dir}/${index.zip}" />
599    <echo>collection gs2mgppdemo installed</echo>
600  </target>   
601
602  <target name="gberg-prepare" if="collect.dir">
603    <property name="gberg.dir" value="${collect.dir}/gberg"/>
604    <available file="${gberg.dir}/index/${index.zip}" property="gberg.present"/>
605  </target>
606
607  <target name="gberg-install" if="gberg.present" depends="gberg-prepare">
608    <unzip dest="${gberg.dir}/index" src="${gberg.dir}/index/${index.zip}"/>
609    <echo>collection gberg installed</echo>
610  </target>
611
612  <target name="configure-web" depends="init"
613    description="Configure only the web app config files">
614    <!-- we want a unix path in the global.properties file -->
615    <pathconvert targetos="unix" property="src.gsdl3.home.unix">
616      <path path="${web.home}"/>
617    </pathconvert>
618    <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
619    <filter token="gsdl3version" value="${app.version}"/>
620    <filter token="tomcat.server" value="${tomcat.server}"/>
621    <filter token="tomcat.port" value="${tomcat.port}"/>
622    <copy file="${basedir}/resources/java/global.properties.in" tofile="${web.classes}/global.properties" filtering="true" overwrite="true"/>
623    <copy file="${basedir}/resources/java/log4j.properties.in" tofile="${web.classes}/log4j.properties" filtering="true" overwrite="true"/>
624    <chmod file="${web.classes}/global.properties" perm="600"/>
625    <chmod file="${web.classes}/log4j.properties" perm="600"/>
626  </target>
627
628  <target name="compile-web" depends="init">
629    <javac srcdir="${web.classes}"
630      destdir="${web.classes}"
631      debug="${compile.debug}"
632      deprecation="${compile.deprecation}"
633      optimize="${compile.optimize}">
634      <classpath><path refid="compile.classpath"/></classpath>
635    </javac>
636  </target>
637
638  <target name="svnupdate-web" unless="nosvn.mode">
639    <svn>
640      <update dir="${web.home}" revision="${branch.revision}"/>
641    </svn>
642  </target>
643
644  <target name="update-web" depends="init,svnupdate-web,configure-web"
645    description="update only the web stuff (config files)"/>
646
647  <!-- ======================= Tomcat Targets ========================== -->
648 
649  <!-- this target downloads and installs Tomcat -->
650  <!-- we download tomcat and the compat module - its needed for 1.4, and doesn't seem to harm 1.5 -->
651  <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal">
652    <if>
653      <bool>
654        <not><available file="${packages.home}/tomcat/.flagfile"/></not>
655      </bool>
656
657      <!-- check that packages dir is there -->
658      <mkdir dir="${packages.home}"/>
659      <get src="http://www.greenstone.org/gs3files/${tomcat.version}.zip"
660        dest="${packages.home}/${tomcat.version}.zip"
661        usetimestamp="true"/>
662      <unzip src="${packages.home}/${tomcat.version}.zip"
663        dest="${packages.home}"/>
664     
665      <!-- If we are using Java 1.4, we'd be using tomcat 5.5 in which case
666      we would need to have the tomcat compat package to work with Java 1.4-->
667      <if>
668    <bool><equals arg1="1.4" arg2="${ant.java.version}"/></bool>
669    <get src="http://www.greenstone.org/gs3files/${tomcat.version}-compat.zip"
670      dest="${packages.home}/${tomcat.version}-compat.zip"
671      usetimestamp="true"/>
672    <unzip src="${packages.home}/${tomcat.version}-compat.zip"
673      dest="${packages.home}"/>
674      </if>
675     
676      <!-- delete any existing tomcat -->
677      <delete dir="${packages.home}/tomcat"/>
678      <move todir="${packages.home}/tomcat">
679        <fileset dir="${packages.home}/${tomcat.version}"/>
680      </move>
681      <copy file="${basedir}/resources/tomcat/setclasspath.bat"
682        tofile="${packages.home}/tomcat/bin/setclasspath.bat"
683        overwrite="true"/>
684      <copy file="${basedir}/resources/tomcat/setclasspath.sh"
685        tofile="${packages.home}/tomcat/bin/setclasspath.sh"
686        overwrite="true"/>
687      <!-- make sure we have execute permission for the .sh files -->
688      <chmod dir="${packages.home}/tomcat/bin" perm="ugo+rx"
689        includes="*.sh"/>   
690
691      <echo file="${packages.home}/tomcat/.flagfile">
692        the timestamp of this file is the time that tomcat was extracted from the zip files.
693        it is used to figure out whether the files need to be refreshed or not in `ant prepare-tomcat`
694      </echo>
695
696      <else>
697        <echo>Tomcat has been prepared, will not prepare</echo>
698        <echo>Delete ${packages.home}/tomcat/.flagfile to force refresh</echo>
699      </else>
700
701    </if>
702
703  </target>
704 
705  <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
706 
707  <target name="configure-tomcat-local" depends="init" if="tomcat.islocal">
708    <!-- re-setup the server.xml file -->
709    <copy file="${basedir}/resources/tomcat/server_tomcat${tomcat.version.major}.xml"
710        tofile="${packages.home}/tomcat/conf/server.xml" overwrite="true">
711      <filterset>
712        <filter token="port" value="${tomcat.port}"/>
713        <filter token="shutdown-port" value="${tomcat.shutdown.port}"/>
714      </filterset>
715    </copy>
716    <!-- set up the greenstone3 context -->
717    <copy file="${basedir}/resources/tomcat/greenstone3.xml" tofile="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true">
718      <filterset>
719        <filter token="gsdl3webhome" value="${web.home}"/>
720      </filterset>
721    </copy>
722  </target>
723
724  <target name="configure-tomcat-external" depends="init" unless="tomcat.islocal">
725    <!-- re-setup the server.xml file -->
726    <!-- need to edit the config file, or do we get the user to do this???-->
727  </target>
728 
729  <target name="start-tomcat" description="Startup only Tomcat" depends="init,configure-java-version" if="tomcat.islocal">
730    <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
731    <property name="tomcat.path" refid="local.tomcat.path"/>
732    <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
733    <exec executable="${catalina.home}/bin/startup.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
734      <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
735      <env key="GSDL3HOME" value="${basedir}"/>
736      <env key="PATH" path="${tomcat.path}"/>
737      <env key="CATALINA_OPTS" value="${catalina.opts}"/>
738      <env key="CATALINA_HOME" value="${catalina.home}"/>
739      <env key="CLASSPATH" path="${tomcat.classpath}"/>
740      <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
741      <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.home}/lib"/> <!-- for mac os --> <!-- need gdbm here??-->
742      <env key="WNHOME" path="${wn.home}"/>
743    </exec>
744    <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
745      <env key="GSDLOS" value="windows"/>
746      <env key="GSDL3HOME" value="${basedir}"/>
747      <env key="Path" path="${tomcat.path}"/>
748      <env key="PATH" path="${tomcat.path}"/>
749      <env key="CATALINA_OPTS" value="${catalina.opts}"/>
750      <env key="CATALINA_HOME" value="${catalina.home}"/>
751      <env key="CLASSPATH" path="${tomcat.classpath}"/>
752    </exec>
753    <!-- wait for the server to startup in case other targets need it running -->
754    <waitfor maxwait="5" maxwaitunit="second">
755      <and>
756        <socket server="${tomcat.server}" port="${tomcat.port}"/>
757        <http url="http://${tomcat.server}:${tomcat.port}${app.path}/index.html"/>
758      </and>
759    </waitfor>
760  </target>
761
762  <!-- windows: do we want to launch a webrowser?? -->
763  <!-- shouldn't this test whether anything is running first? -->
764  <target name="stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
765    <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
766      <env key="CATALINA_HOME" value="${catalina.home}"/>
767    </exec>
768    <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false">
769      <env key="CATALINA_HOME" value="${catalina.home}"/>
770    </exec>
771  </target>
772
773  <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
774
775  <target name="setup-catalina-ant-tasks">
776    <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
777    <taskdef name="deploy"    classname="org.apache.catalina.ant.DeployTask"
778      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
779    <taskdef name="list"      classname="org.apache.catalina.ant.ListTask"
780      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
781    <taskdef name="reload"    classname="org.apache.catalina.ant.ReloadTask"
782      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
783    <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
784      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
785    <taskdef name="roles"     classname="org.apache.catalina.ant.RolesTask"
786      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
787    <taskdef name="start"     classname="org.apache.catalina.ant.StartTask"
788      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
789    <taskdef name="stop"      classname="org.apache.catalina.ant.StopTask"
790      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
791    <taskdef name="undeploy"  classname="org.apache.catalina.ant.UndeployTask"
792      classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
793  </target>
794
795
796  <!-- ======================= ant Targets ============================ -->
797  <target name="prepare-ant" depends="init">
798    <if>
799      <bool>
800        <not><available file="${packages.home}/ant/.flagfile"/></not>
801      </bool>
802
803      <get src="http://www.greenstone.org/gs3files/apache-ant-1.7.0-bin.zip"
804        dest="${packages.home}/apache-ant-1.7.0-bin.zip"
805        usetimestamp="true"/>
806      <unzip src="${packages.home}/apache-ant-1.7.0-bin.zip"
807        dest="${packages.home}"/>
808      <move todir="${packages.home}/ant">
809        <fileset dir="${packages.home}/apache-ant-1.7.0"/>
810      </move>
811      <echo file="${packages.home}/ant/.flagfile">
812        the timestamp of this file is the time that ant was extracted from the zip files.
813        it is used to figure out whether the files need to be refreshed or not in `ant prepare-ant`
814      </echo>
815
816      <else>
817        <echo>Ant has been prepared, will not prepare</echo>
818        <echo>Delete ${packages.home}/ant/.flagfile to force refresh</echo>
819      </else>
820
821    </if>
822  </target>
823
824  <!-- ======================= Axis Targets ============================ --> 
825 
826  <target name="prepare-axis" depends="init">
827
828    <if>
829      <bool>
830        <not><available file="${packages.home}/axis/.flagfile"/></not>
831      </bool>
832
833      <get src="http://www.greenstone.org/gs3files/${axis.zip.version}"
834        dest="${packages.home}/${axis.zip.version}"
835        usetimestamp="true"/>
836      <unzip src="${packages.home}/${axis.zip.version}"
837        dest="${packages.home}"/>
838      <move todir="${packages.home}/axis">
839        <fileset dir="${packages.home}/${axis.dir.version}"/>
840      </move>
841      <!-- install axis into greenstone web app -->
842      <copy todir="${web.lib}">
843        <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
844          <include name="*.jar"/>
845        </fileset>
846      </copy>
847      <copy todir="${web.home}">
848        <fileset dir="${packages.home}/axis/webapps/axis/">
849          <include name="*.jsp"/>
850          <include name="*.jws"/>
851        </fileset>
852      </copy>
853      <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
854      <copy todir="${web.classes}">
855        <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
856          <include name="*.properties"/>
857        </fileset>
858      </copy>
859      <echo file="${packages.home}/axis/.flagfile">
860        the timestamp of this file is the time that axis was extracted from the zip files.
861        it is used to figure out whether the files need to be refreshed or not in `ant prepare-axis`
862      </echo>
863
864      <else>
865        <echo>Axis has been prepared, will not prepare</echo>
866        <echo>Delete ${packages.home}/axis/.flagfile to force refresh</echo>
867      </else>
868
869    </if>
870  </target>
871
872  <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,get-webservices,create-deployment-files,deploy-site"
873    description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
874   
875    <target name="deploy-site">
876    <java classname="org.apache.axis.client.AdminClient">
877      <classpath refid="compile.classpath"/>
878      <arg value="-l"/>
879      <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
880      <arg file="${basedir}/resources/soap/deploy.wsdd"/>
881    </java>
882    <delete file="${basedir}/resources/soap/deploy.wsdd"/> <!--clean up, no longer used-->
883  </target>
884 
885  <target name="soap-undeploy-site" depends="get-undeploy-service-name"
886    description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
887    <filter token="servicesname" value="${axis.undeploy.servicename}"/>
888    <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
889      tofile="${basedir}/resources/soap/undeploy.wsdd"
890      filtering="true"
891      overwrite="true"/>
892    <java classname="org.apache.axis.client.AdminClient">
893      <classpath refid="compile.classpath"/>
894      <arg value="-l"/>
895      <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
896      <arg file="${basedir}/resources/soap/undeploy.wsdd"/>
897    </java>
898    <delete file="${basedir}/resources/soap/undeploy.wsdd"/> <!--clean up, no longer used-->
899  </target> 
900
901  <!-- this target used to deploy the default web service SOAPServer (base.webservice.name) on the localsite server
902  with the default servicename of localsite-->
903  <target name="deploy-localsite" depends="init"
904    description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
905    <antcall target="start-tomcat"/>
906    <echo>Deploying ${base.webservice.name} web services for localsite under service name: localsite</echo>
907    <antcall target="create-deployment-files">
908      <param name="axis.sitename" value="localsite"/>
909      <param name="axis.servicesname" value="${base.webservice.name}"/>
910      <param name="axis.siteuri" value="localsite"/>
911    </antcall>
912    <antcall target="deploy-site">
913      <param name="axis.sitename" value="localsite"/>
914      <param name="axis.servicesname" value="${base.webservice.name}"/>
915      <param name="axis.siteuri" value="localsite"/>
916    </antcall>
917    <echo>The Greenstone server has been started up. If you do not want it running, please type: ant stop.</echo>
918  </target>
919   
920  <target name="get-sitename" unless="axis.sitename">
921    <input addproperty="axis.sitename" defaultvalue="localsite">What site do you want to deploy services for?
922Press Enter for default:localsite</input>
923  </target>
924
925  <target name="get-undeploy-service-name" unless="axis.undeploy.servicename">
926    <input addproperty="axis.undeploy.servicename" defaultvalue="localsite">Please enter the full name of the service you wish to undeploy.
927To find out which web services you've got deployed, point your browser to http://HOST:PORT/greenstone3/services
928Or press Enter for undeploying the default:localsite /></input>
929     <echo>Name of service to undeploy: ${axis.undeploy.servicename}</echo>
930  </target>
931
932  <target name="get-webservices" unless="axis.servicesname">
933    <input addproperty="axis.servicesname" defaultvalue="${base.webservice.name}">Which set of web services do you want to deploy?
934Choose from: ${web.services.list}
935Or press Enter for default:${base.webservice.name} /></input>
936    <echo>${axis.servicesname}</echo>
937  </target>
938
939  <target name="get-siteuri" depends="get-sitename,get-webservices" unless="axis.siteuri">
940    <input addproperty="axis.siteuri" defaultvalue="${axis.servicesname}${axis.sitename}">What name do you want the service to have? (Press Enter for default:${axis.servicesname}${axis.sitename})</input>
941    <echo>Site: ${axis.sitename}, services: ${axis.servicesname}, servicesname: ${axis.siteuri}</echo>
942  </target>
943
944  <target name="set-soapmethod" description="Determines whether the service in the wsdd should have the style attribute set to message or the provider attribute set to java:RPC"  if="axis.servicesname">
945   <condition property="soap.method" value="provider='java:MSG' style='message' use='literal'">
946      <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
947    </condition>
948   
949   <!--everything else defaults to java:RPC at present-->
950   <condition property="soap.method" value="provider='java:RPC'">
951     <not>
952      <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
953    </not>
954    </condition>
955  </target>
956   
957  <target name="create-deployment-files" depends="set-soapmethod" if="axis.sitename">
958    <filter token="sitename" value="${axis.sitename}"/>
959    <filter token="siteuri" value="${axis.siteuri}"/>
960    <filter token="servicesname" value="${axis.servicesname}"/>
961    <filter token="soapmethod" value="${soap.method}"/>
962    <copy file="${basedir}/resources/soap/site.wsdd.template"
963      tofile="${basedir}/resources/soap/deploy.wsdd"
964      filtering="true"
965      overwrite="true"/>
966    <!-- create the java files and compile them -->
967    <copy file="${basedir}/resources/java/${axis.servicesname}.java.in"
968      tofile="${src.gsdl3.home}/${axis.servicesname}${axis.sitename}.java"
969      filtering="true"
970      overwrite="true"/>
971    <mkdir dir="${build.home}"/>
972    <javac srcdir="${src.home}"
973      destdir="${build.home}"
974      debug="${compile.debug}"
975      deprecation="${compile.deprecation}"
976      optimize="${compile.optimize}">
977      <classpath refid="compile.classpath"/>
978      <include name="org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.java" />
979    </javac>
980    <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
981    <copy file="${build.home}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
982      tofile="${web.classes}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
983      overwrite="true" />
984  </target>
985 
986
987  <!-- ====================== Core targets ============================== -->
988  <!-- core targets refer to the core gsdl3 java src -->
989 
990  <target name="prepare-core"/>
991 
992  <target name="configure-core"/>
993
994  <target name="update-core" depends="init,svnupdate-core,clean-core,compile-core"
995    description="Update only the Greenstone core" />
996 
997  <target name="svnupdate-core" unless="nosvn.mode">
998    <svn>
999      <update dir="." revision="${branch.revision}"/>
1000    </svn>
1001  </target>
1002
1003  <target name="clean-core"
1004    description="Clean only the Greenstone core">
1005    <!-- should this delete the gsdl3.jar from web/WEB-INF?? -->
1006    <delete dir="${build.home}"/>
1007  </target>
1008
1009  <target name="compile-core" depends="init"
1010    description="Compile only the Greenstone core">
1011    <if>
1012      <!-- Rather than test for tomcat 6, testing here for NOT tomcat 5
1013      (so that it may hopefully still serve when it becomes tomcat 7) -->
1014      <bool><not><equals arg1="5" arg2="${tomcat.version.major}"/></not></bool>
1015      <copy file="${web.lib}/xercesImpl.jar" todir="${catalina.home}/lib"/>
1016      <copy file="${web.lib}/xml-apis.jar" todir="${catalina.home}/lib"/>
1017    </if>
1018    <mkdir dir="${build.home}"/>
1019    <javac srcdir="${src.home}"
1020      destdir="${build.home}"
1021      debug="${compile.debug}"
1022      deprecation="${compile.deprecation}"
1023      optimize="${compile.optimize}">
1024      <classpath>
1025        <path refid="compile.classpath"/>
1026      </classpath>
1027    </javac>
1028    <jar destfile="${build.home}/gsdl3.jar">
1029      <fileset dir="${build.home}">
1030        <include name="org/greenstone/gsdl3/**"/>
1031        <include name="org/flax/**"/>
1032        <exclude name="**/Test.class"/>
1033      </fileset>
1034      <manifest>
1035        <attribute name="Built-By" value="${user.name}" />
1036      </manifest>
1037    </jar>
1038    <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
1039    <!-- copy the localsite server in case we need it -->
1040    <copy file="${build.home}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" tofile="${web.classes}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" />
1041
1042    <!-- Greenstone Administrator Interface -->
1043    <jar destfile="${build.home}/GAI.jar">
1044      <fileset dir="${build.home}">
1045        <include name="org/greenstone/admin/**"/>
1046      </fileset>
1047      <manifest>
1048        <attribute name="Built-By" value="${user.name}" />
1049      </manifest>
1050    </jar>
1051    <copy file="${build.home}/GAI.jar" todir="${web.lib}"/>
1052    <copy file="${build.home}/GAI.jar" todir="${admin.dir}"/>
1053    <jar destfile="${build.home}/phind.jar">
1054      <fileset dir="${build.home}">
1055        <include name="org/greenstone/applet/phind/**"/>
1056      </fileset>
1057      <manifest>
1058        <attribute name="Built-By" value="${user.name}" />
1059      </manifest>
1060    </jar>
1061    <mkdir dir="${web.applet}"/>
1062    <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
1063    <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
1064    <if>
1065      <bool><istrue value="${tomcat.islocal}"/></bool>
1066      <copy file="${web.lib}/xercesImpl.jar" todir="${web.applet}"/>
1067      <copy file="${web.lib}/xml-apis.jar" todir="${web.applet}"/>
1068    </if>
1069
1070
1071    <!-- skip anttasks for now
1072    <jar destfile="${build.home}/anttasks.jar">
1073      <fileset dir="${build.home}">
1074        <include name="org/greenstone/anttasks/**"/>
1075      </fileset>
1076      <manifest>
1077        <attribute name="Built-By" value="${user.name}" />
1078      </manifest>
1079    </jar>
1080    <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>-->
1081    <jar destfile="${build.home}/gsdl3test.jar">
1082      <fileset dir="${build.home}">
1083        <include name="org/greenstone/gsdl3/**/*Test.class"/>
1084        <include name="org/greenstone/testing/**"/>
1085      </fileset>
1086      <manifest>
1087        <attribute name="Built-By" value="${user.name}" />
1088      </manifest>
1089    </jar>
1090    <jar destfile="${build.home}/server.jar">
1091      <fileset dir="${build.home}">
1092        <include name="org/greenstone/server/**"/>
1093      </fileset>
1094      <fileset file="${basedir}/resources/java/server.properties"/>
1095      <manifest>
1096        <attribute name="Built-By" value="${user.name}"/>
1097      </manifest>
1098    </jar>
1099    <copy file="${build.home}/server.jar" todir="${basedir}"/>
1100  </target>
1101 
1102  <!-- ================== Packages targets ================================ -->
1103  <!-- these targets refer to the greenstone source packages - these need
1104  updating less often, so are in  separate targets to the core -->
1105  <target name="prepare-packages" depends="init"/>
1106 
1107  <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
1108    description="Update only the source packages"/>
1109
1110  <target name="svnupdate-packages" unless="nosvn.mode">
1111    <svn>
1112      <update dir="${src.packages.home}" revision="${branch.revision}"/>
1113    </svn>
1114  </target>
1115
1116 
1117  <target name="configure-packages" depends="init,configure-javagdbm"
1118    description="Configure only the packages."/>
1119 
1120  <target name="configure-javagdbm">
1121    <echo>
1122      Configuring JavaGDBM
1123    </echo>
1124   
1125    <exec executable="${javagdbm.home}/configure" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
1126      <arg value="--prefix=${basedir}"/>
1127      <arg value="--libdir=${lib.jni}"/>
1128      <arg value="--with-gdbm=${gdbm.home}"/>
1129    </exec>   
1130  </target>
1131
1132  <target name="clean-packages" depends="init,clean-javagdbm" description="Clean only the packages"/>
1133
1134  <target name="clean-javagdbm" depends="init">
1135    <exec executable="make" os="${os.unix}"
1136      dir="${javagdbm.home}" failonerror="true">
1137      <arg value="clean"/>
1138    </exec>
1139  </target>
1140 
1141  <target name="distclean-packages" depends="init,distclean-javagdbm" description="Distclean only the packages"/>
1142
1143  <target name="distclean-javagdbm" depends="init">
1144    <exec executable="make" os="${os.unix}"
1145      dir="${javagdbm.home}" failonerror="true">
1146      <arg value="distclean"/>
1147    </exec>
1148  </target>
1149 
1150  <target name="compile-packages" description="Compile only the source packages">
1151   
1152    <!-- unix: -->
1153    <echo>compile javagdbm</echo>
1154    <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true"/>
1155    <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
1156      <arg value="install"/>
1157    </exec>
1158
1159    <!-- windows: just the java stuff. -->
1160    <echo>Windows: compile javagdbm (java only)</echo>
1161    <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
1162      <arg value="compile"/>
1163      <arg value="javaonly"/>
1164    </exec>
1165
1166    <!-- install the jar file -->
1167    <echo>Install the javagdbm jar file</echo>
1168    <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
1169
1170
1171    <!-- Search4j -->
1172    <antcall target="compile-search4j"/>
1173  </target>
1174
1175  <target name="compile-search4j">
1176
1177    <!-- windows -->
1178    <if><bool><istrue value="${current.os.iswindows}"/></bool>
1179      <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1180        <arg value="/f"/>
1181        <arg value="win32.mak"/>
1182        <arg value='BINDIR="${basedir}\bin"'/>
1183      </exec>
1184      <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1185        <arg value="/f"/>
1186        <arg value="win32.mak"/>
1187        <arg value="install"/>
1188        <arg value='BINDIR="${basedir}\bin"'/>
1189      </exec>
1190
1191    <!-- unix -->
1192    <else><if><bool><istrue value="${current.os.isunix}"/></bool>
1193      <exec executable="${src.packages.home}/search4j/configure" dir="${src.packages.home}/search4j" failonerror="true">
1194        <arg value="--bindir=${basedir}/bin"/>
1195        <arg value="${static.arg}"/>
1196      </exec>
1197      <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true"/>
1198      <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true">
1199        <arg value="install"/>
1200      </exec>
1201
1202    <!-- else warn -->
1203    <else>
1204      <fail>this target does not support the current os</fail>
1205
1206    </else></if></else></if>
1207
1208  </target>
1209
1210  <target name="install-auxiliary-jar-files" depends="init">
1211    <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
1212    <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
1213    <copy file="${lucene.home}/LuceneWrapper.jar" todir="${web.lib}"/>   
1214  </target>
1215 
1216  <target name="install-jni-files" depends="init,install-jni-files-linux,install-jni-files-windows,install-jni-files-macos"/>
1217
1218  <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
1219    <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
1220    <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
1221    <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
1222    <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
1223    <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
1224    <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
1225  </target>
1226  <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
1227    <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
1228    <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
1229    <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
1230    <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
1231    <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
1232    <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
1233  </target>
1234  <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
1235    <copy file="${mg.home}/jni/libmgretrievejni.jnilib" todir="${lib.jni}"/>
1236    <copy file="${mg.home}/jni/libmgsearchjni.jnilib" todir="${lib.jni}"/>
1237    <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
1238    <copy file="${mgpp.home}/jni/libmgppretrievejni.jnilib" todir="${lib.jni}"/>
1239    <copy file="${mgpp.home}/jni/libmgppsearchjni.jnilib" todir="${lib.jni}"/>
1240    <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
1241  </target>
1242 
1243  <!-- ========common-src targets =================================-->
1244  <!-- these are used to get common-src (for indexers, gdbm, sqlite etc) when
1245  collection building is not enabled -->
1246
1247  <target name="update-common-src" depends="init" if="collection.building.disabled">
1248  </target>
1249
1250  <target name="svnupdate-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1251    <svn>
1252      <update dir="${common.src.home}" revision="${branch.revision}"/>
1253    </svn>   
1254  </target>
1255
1256  <target name="prepare-common-src" depends="init" if="collection.building.disabled" unless="common.src.present">
1257    <antcall target="checkout-common-src"/>
1258    <antcall target="unzip-windows-packages"/>
1259  </target>
1260
1261  <target name="checkout-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1262    <echo>checking out common-src</echo>
1263    <svn>
1264      <checkout url="${svn.root}/gsdl/trunk/common-src" destPath="common-src" revision="${branch.revision}"/>
1265    </svn>
1266  </target>
1267   
1268  <target name="configure-common-src" depends="init">
1269    <exec executable="${common.src.home}/configure" os="${os.unix}"
1270      dir="${common.src.home}" failonerror="true">
1271      <arg value="--prefix=${gs2build.home}"/> <!-- what value to use?? -->
1272      <arg value="--bindir=${gs2build.home}/bin/${os.bin.dir}"/> <!-- what value to use?? -->
1273      <arg line="${static.arg}"/>
1274    </exec>
1275  </target>
1276
1277  <target name="clean-common-src" depends="init">
1278    <!-- unix:  -->
1279    <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1280      <arg value="clean"/>
1281    </exec>
1282    <!-- windows: -->   
1283    <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1284      <arg value="/f"/>
1285      <arg value="win32.mak"/>
1286      <arg value="clean"/>
1287      <arg value="GSDLHOME=${gs2build.home}"/>
1288    </exec>
1289  </target>
1290  <target name="distclean-common-src" depends="init">
1291    <!-- unix:  -->
1292    <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1293      <arg value="distclean"/>
1294    </exec>
1295    <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->   
1296    <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1297      <arg value="/f"/>
1298      <arg value="win32.mak"/>
1299      <arg value="clean"/>
1300      <arg value="GSDLHOME=${gs2build.home}"/>
1301    </exec>
1302  </target>
1303  <target name="compile-common-src" depends="init">
1304    <!-- unix: -->
1305    <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1306    </exec>
1307    <!-- windows: -->
1308    <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1309      <arg value="/f"/>
1310      <arg value="win32.mak"/>
1311      <arg value="GSDLHOME=${gs2build.home}"/>
1312    </exec>
1313  </target>
1314 
1315  <!-- ======= collection-building targets ===========================-->
1316
1317  <target name="update-collection-building" if="collection.building.enabled"
1318    depends="init,svnupdate-collection-building,gs2build-edit-setup-bat,configure-common-src,clean-common-src,compile-common-src,configure-collection-building,clean-collection-building,compile-collection-building"
1319    description="Update (SVN update, configure, compile etc) only the collection building components"/>
1320
1321  <target name="svnupdate-collection-building" if="collection.building.enabled" depends="init,svnupdate-gs2build,svnupdate-gli" unless="nosvn.mode"
1322    description="SVN update the collection building components">
1323  </target>
1324
1325  <target name="prepare-collection-building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
1326  </target>
1327
1328  <target name="configure-collection-building" depends="init,configure-build-src" if="collection.building.enabled"
1329    description="Configure the collection building components">
1330  </target>
1331
1332  <target name="clean-collection-building" depends="init,clean-gli,clean-build-src"
1333    description="Clean only the collection building components"
1334    if="collection.building.enabled"/>
1335
1336  <target name="distclean-collection-building" depends="init,clean-build-src,distclean-build-src"
1337    description="Distclean only the collection building components"
1338    if="collection.building.enabled"/>
1339
1340  <target name="compile-collection-building" depends="init,compile-build-src,compile-gli" if="collection.building.enabled"
1341    description="Compile only the collection building components">
1342    <!-- make install for common-src -->
1343    <!-- unix: -->
1344    <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1345      <arg value="install"/>
1346    </exec>
1347     
1348    <!-- windows: -->
1349    <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
1350      <arg value="/f"/>
1351      <arg value="win32.mak"/>
1352      <arg value="install"/>   
1353    </exec>
1354
1355    <!-- install gs2build indexers for windows -->
1356      <if>
1357    <bool><istrue value="${current.os.iswindows}"/></bool>
1358    <copy todir="${gs2build.home}/bin/windows">
1359      <fileset dir="${gs2build.home}/common-src/indexers/bin">
1360        <include name="*.*"/>
1361      </fileset>
1362    </copy>
1363      </if>
1364
1365    <!-- LuceneWrapper jar file not installed by default -->
1366    <mkdir dir="${gs2build.home}/bin/java"/>
1367    <copy file="${lucene.home}/LuceneWrapper.jar" todir="${gs2build.home}/bin/java"/>
1368
1369  </target>
1370
1371  <!-- ============== gli targets ================================= -->
1372  <target name="svnupdate-gli" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1373    <svn>
1374      <update dir="${gli.home}" revision="${branch.revision}"/>
1375
1376      <!-- some files from cgi-bin: necessary for remote GLI server  -->
1377      <export srcUrl="${svn.root}/gsdl/${branch.path}/cgi-bin/gliserver.pl" destPath="${web.home}/WEB-INF/cgi/gliserver.pl" revision="${branch.revision}"/> 
1378      <export srcUrl="${svn.root}/gsdl/${branch.path}/cgi-bin/gsdlCGI.pm" destPath="${web.home}/WEB-INF/cgi/gsdlCGI.pm" revision="${branch.revision}"/>
1379    </svn>
1380  </target>
1381
1382  <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
1383    <!-- checkout -->
1384    <if><bool><not><istrue value="${nosvn.mode}"/></not></bool>
1385      <svn>
1386        <checkout url="${svn.root}/gli/${branch.path}" destPath="gli" revision="${branch.revision}"/>
1387
1388    <!-- some files from cgi-bin: necessary for remote GLI server  -->
1389    <export srcUrl="${svn.root}/gsdl/${branch.path}/cgi-bin/gliserver.pl" destPath="${web.home}/WEB-INF/cgi/gliserver.pl" revision="${branch.revision}"/> 
1390    <export srcUrl="${svn.root}/gsdl/${branch.path}/cgi-bin/gsdlCGI.pm" destPath="${web.home}/WEB-INF/cgi/gsdlCGI.pm" revision="${branch.revision}"/>
1391      </svn>
1392    </if>
1393  </target>
1394 
1395  <target name="clean-gli" depends="init" if="collection.building.enabled">
1396    <!-- gli -->
1397    <property name="gli.home" value="${basedir}/gli"/>
1398    <!-- linux -->
1399    <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
1400      resolveExecutable="true"/>
1401    <!-- windows -->
1402    <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
1403      resolveExecutable="true"/>
1404  </target>
1405 
1406  <target name="compile-gli" depends="init" if="collection.building.enabled">
1407    <!-- gli -->
1408    <property name="gli.home" value="${basedir}/gli"/>
1409
1410    <!-- linux -->
1411    <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}" resolveExecutable="true"/>
1412    <!--remote gli-->
1413    <exec executable="makejar.sh" os="${os.unix}" dir="${gli.home}"
1414      resolveExecutable="true"/>
1415    <!-- windows -->
1416    <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}" resolveExecutable="true"/>
1417    <!--remote gli-->
1418    <exec executable="makejar.bat" os="${os.windows}" dir="${gli.home}"
1419      resolveExecutable="true"/>
1420    <copy file="${gli.home}/GLIServer.jar" todir="${gs2build.home}/bin/java" />
1421  </target>
1422
1423  <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
1424    <exec executable="${basedir}/gli/gli.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
1425      <env key="gsdl3path" path="${basedir}"/>
1426      <env key="gsdlpath" path="${gs2build.home}"/>
1427    </exec>
1428    <exec executable="${basedir}/gli/gli.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
1429      <env key="gsdl3path" path="${basedir}"/>
1430      <env key="gsdlpath" path="${gs2build.home}"/>
1431      <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.home}/lib"/>
1432    </exec>
1433    <exec executable="${basedir}/gli/gli.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
1434      <env key="GSDL3PATH" path="${basedir}"/>
1435      <env key="GSDLPATH" path="${gs2build.home}"/>
1436    </exec>
1437    <echo>Running GLI from Ant means that you don't get to see any of the terminal output. If you have problems with GLI and want to see the output, please run the script gli.sh/bat from the greenstone3/gli directory.
1438    </echo>
1439  </target>
1440
1441  <!-- ================ gs2build targets =========================== -->
1442
1443  <target name="svnupdate-gs2build" if="collection.building.enabled" depends="init" unless="nosvn.mode">
1444    <echo>svn updating gs2build</echo>
1445    <svn>
1446      <update dir="{gs2build.home}" revision="${branch.revision}"/>
1447    </svn>
1448  </target>
1449   
1450  <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
1451    <antcall target="checkout-gs2build"/>
1452    <antcall target="unzip-windows-packages"/>
1453    <antcall target="checkout-winbin"/>
1454    <antcall target="get-windows-binaries"/>
1455    <antcall target="delete-winbin"/>
1456  </target>
1457
1458  <target name="checkout-gs2build" depends="init" if="collection.building.enabled" unless="nosvn.mode">
1459    <echo>checking out gs2build</echo>
1460    <svn>
1461      <checkout url="${svn.root}/gs2build" destPath="gs2build" revision="${branch.revision}"/>
1462    </svn>
1463  </target>
1464
1465  <target name="checkout-winbin" depends="init" if="current.os.iswindows"
1466    unless="nosvn.mode">
1467    <svn>
1468      <checkout url="${svn.root}/other-projects/trunk/winbin" destPath="${basedir}/winbin" revision="${branch.revision}"/>
1469    </svn>
1470  </target>
1471
1472  <target name="update-winbin" depends="init" if="current.os.iswindows" unless="nosvn.mode">
1473    <svn>
1474      <update dir="winbin" revision="${branch.revision}"/>
1475    </svn>
1476  </target>
1477 
1478  <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
1479    <move todir="${gs2build.home}/bin/windows" failonerror="false">
1480      <fileset dir="${basedir}/winbin/bin"/>
1481    </move>
1482  </target>
1483
1484  <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
1485    <delete dir="${basedir}/winbin"/>
1486  </target>
1487 
1488  <target name="unzip-windows-packages" depends="init" if="current.os.iswindows"> 
1489    <unzip src="${common.src.home}/packages/windows/crypt/crypt.zip"
1490      dest="${common.src.home}/packages/windows/crypt"/>
1491    <unzip src="${common.src.home}/packages/windows/expat/expat.zip"
1492      dest="${common.src.home}/packages/windows/expat"/>
1493    <untar compression="gzip"
1494      src="${common.src.home}/packages/sqlite/${sqlite.targz.version}"
1495      dest="${common.src.home}/packages/sqlite"/>
1496    <unzip src="${common.src.home}/indexers/packages/windows/iconv/iconv.zip"
1497      dest="${common.src.home}/indexers/packages/windows/iconv"/>
1498  </target>
1499   
1500  <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
1501    <!-- we want a windows path in the setup.bat file -->
1502    <pathconvert targetos="windows" property="gs2build.home.windows">
1503      <path path="${gs2build.home}"/>
1504    </pathconvert>
1505    <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
1506      <filterset>
1507        <filter token="gsdlhome" value="${gs2build.home.windows}"/>
1508      </filterset>
1509    </move> 
1510    <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
1511  </target>
1512 
1513 
1514  <target name="clean-build-src" depends="init" if="collection.building.enabled">
1515    <!-- unix:  -->
1516    <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
1517      <arg value="clean"/>
1518    </exec>
1519    <!-- windows: -->   
1520    <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
1521      <arg value="/f"/>
1522      <arg value="win32.mak"/>
1523      <arg value="clean"/>
1524      <arg value="GSDLHOME=${gs2build.home}"/>
1525    </exec>
1526  </target>
1527 
1528 
1529  <target name="distclean-build-src" depends="init,clean-build-src" if="collection.building.enabled">
1530    <!-- unix:  -->
1531    <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
1532      <arg value="distclean"/>
1533    </exec>
1534    <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->   
1535    <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
1536      <arg value="/f"/>
1537      <arg value="win32.mak"/>
1538      <arg value="clean"/>
1539      <arg value="GSDLHOME=${gs2build.home}"/>
1540    </exec>
1541  </target>
1542 
1543  <target name="configure-build-src" depends="init" if="collection.building.enabled"
1544    description="Configure the build-src component">
1545    <exec executable="${build.src.home}/configure" os="${os.unix}"
1546      dir="${build.src.home}" failonerror="true">
1547      <arg value="--prefix=${gs2build.home}"/>
1548      <arg line="${static.arg}"/>
1549    </exec>
1550  </target>
1551
1552  <!-- common-src is done separately and needs to be compiled first -->
1553  <target name="compile-build-src" depends="init" if="collection.building.enabled">
1554   
1555    <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true"/>
1556    <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
1557      <arg value="install"/>
1558    </exec>
1559
1560    <!-- run the setup script -->
1561    <!-- <exec executable="${compile.windows.c++.setup}" os="${os.windows}"/>-->
1562      <!--Above does not work: even though vcvars.bat executes, the env changes it makes don't get saved. Need user to run vcvars.bat first before calling ant-->
1563      <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
1564        <arg value="/f"/>
1565        <arg value="win32.mak"/>
1566    <arg value="GSDLHOME=${gs2build.home}"/>
1567      </exec>
1568      <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
1569        <arg value="/f"/>
1570        <arg value="win32.mak"/>
1571        <arg value="install"/>
1572    <arg value="GSDLHOME=${gs2build.home}"/>
1573      </exec>
1574  </target>
1575 
1576
1577  <!-- ======================== TESTING Targets ========================= -->
1578 
1579  <target name="test" description="Run the (incomplete) JUnit test suite "
1580    depends="init">
1581    <mkdir dir="${basedir}/test"/>
1582    <junit printsummary="withOutAndErr"
1583      errorproperty="test.failed"
1584      failureproperty="test.failed"
1585      fork="${junit.fork}">
1586      <formatter type="plain"/>
1587      <classpath>
1588        <pathelement location="${build.home}/gsdl3test.jar"/>
1589        <path refid="compile.classpath"/>
1590      </classpath>
1591      <test name="${testcase}" if="testcase"/>
1592      <batchtest todir="${basedir}/test" unless="testcase">
1593        <fileset dir="${build.home}" includes="**/*Test.class" />
1594      </batchtest>
1595    </junit>
1596    <echo>
1597      *********************************************
1598      Test output can be found in directory 'test'
1599      *********************************************
1600    </echo>
1601  </target>
1602
1603  <!-- ======================== FLAX Targets ========================= -->
1604  <target name="prepare-flax" description="check out flax source code from another repository" if="install.flax">
1605    <echo>checking out flax ...</echo>
1606    <mkdir dir="${basedir}/src/java/org/flax"/>
1607    <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1608    <mkdir dir="${web.home}/WEB-INF/classes/flax"/>
1609    <mkdir dir="${web.home}/interfaces/flax"/>
1610    <mkdir dir="${web.home}/sites/flax"/>
1611    <mkdir dir="${basedir}/flax-resources"/>
1612    <mkdir dir="${basedir}/flax-lib"/>
1613    <svn>
1614      <checkout url="${flax.checkout.path}/src/java/org/flax/" 
1615        destPath="${basedir}/src/java/org/flax"/>
1616      <checkout url="${flax.checkout.path}/src/java/org/greenstone/gsdl3/flax/"
1617        destPath="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1618      <checkout url="${flax.checkout.path}/web/WEB-INF/classes/flax/"
1619        destPath="${web.home}/WEB-INF/classes/flax"/>
1620      <checkout url="${flax.checkout.path}/web/interfaces/flax/"
1621        destPath="${web.home}/interfaces/flax"/>
1622      <checkout url="${flax.checkout.path}/web/sites/flax/"
1623        destPath="${web.home}/sites/flax"/>
1624      <checkout url="${flax.checkout.path}/flax-resources"
1625        destPath="${basedir}/flax-resources"/>
1626      <checkout url="${flax.checkout.path}/lib"
1627        destPath="${basedir}/flax-lib"/>
1628    </svn>
1629    <echo>prepare flax files...</echo>
1630    <move file="${web.home}/WEB-INF/web.xml" tofile="${web.home}/WEB-INF/web.xml.greenstone3backup"/>
1631    <antcall target="flax-copy-files" />
1632    <antcall target="unzip-flax-resources" />
1633  </target>
1634
1635  <target name="update-flax" description="update flax from repository">
1636    <echo>updating flax ...</echo>
1637    <svn>
1638      <update dir="${basedir}/src/java/org/flax"/>
1639      <update dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
1640      <update dir="${web.home}/WEB-INF/classes/flax"/>
1641      <update dir="${web.home}/interfaces/flax"/>
1642      <update dir="${web.home}/sites/flax"/>
1643    </svn>
1644    <antcall target="flax-copy-files" />
1645  </target>
1646
1647  <target name="unzip-flax-resources" >
1648    <property name="classes.dir" value="${web.home}/WEB-INF/classes/flax"/>
1649    <unzip dest="${classes.dir}"> 
1650      <fileset dir="${classes.dir}">
1651        <include name="*.zip"/>
1652      </fileset>   
1653    </unzip>   
1654    <delete>
1655      <fileset dir="${classes.dir}" includes="*.zip"/>
1656    </delete>
1657  </target>
1658 
1659  <target name="flax-copy-files" description="copy some flax files into the appropriate greenstone3 directories">
1660    <echo>copying flax files ...</echo>
1661    <copy file="${web.home}/WEB-INF/classes/flax/web.xml" todir="${web.home}/WEB-INF" overwrite="true" />
1662    <!-- A configuration file containing web service binding information for the axis engine -->
1663    <copy file="${web.home}/WEB-INF/classes/flax/server-config.wsdd" todir="${web.home}/WEB-INF" overwrite="true" />
1664    <copy file="${basedir}/flax-resources/flax-build.xml" todir="${basedir}" overwrite="true" />
1665    <copy file="${basedir}/flax-lib/opennlp-tools-1.3.0.jar" todir="${web.home}/WEB-INF/lib" overwrite="true" />   
1666  </target>
1667
1668
1669
1670
1671  <target name="compile-javadocs">
1672    <javadoc packagenames="org.greenstone.*"
1673           sourcepath="src/java"
1674           defaultexcludes="yes"
1675           destdir="docs/javadoc"
1676           author="true"
1677           version="true"
1678           use="true"
1679           windowtitle="Greenstone3 API">
1680    <doctitle><![CDATA[<h1>Greenstone3 API</h1>]]></doctitle>
1681    </javadoc>
1682  </target>
1683
1684  <target name="remove-source">
1685    <delete includeEmptyDirs="true">
1686      <fileset dir="." defaultexcludes="false">
1687        <patternset refid="greenstone3.source.component"/>
1688     </fileset>
1689    </delete>
1690  </target>
1691
1692  <target name="dist-tidy"
1693    description="'tidies-up' a greenstone3 installation for distribution.">
1694
1695    <!-- delete unneeded things -->
1696    <delete dir="${packages.home}/axis"/>
1697    <delete><fileset dir="${packages.home}" includes="*.zip"/></delete>
1698    <delete file="README-SVN.txt"/>
1699
1700    <!-- delete source files -->
1701    <antcall target="remove-source"/>
1702
1703    <!-- create empty directories -->
1704    <mkdir dir="${web.home}/applet"/>
1705    <mkdir dir="${web.home}/logs"/>
1706
1707    <!-- os specific tidy-ups -->
1708    <!-- linux, mac -->
1709    <if><bool><istrue value="${current.os.isunix}"/></bool>
1710      <delete><fileset dir="." includes="*.bat"/></delete>
1711      <delete><fileset dir="gli" includes="*.bat"/></delete>
1712      <delete><fileset dir="gs2build" includes="*.bat"/></delete>
1713      <delete><fileset dir="bin/script" includes="*.bat"/></delete>
1714      <delete file="${basedir}/gs2build/win32cfg.h"/>
1715      <delete file="${basedir}/gs2build/win32.mak"/>
1716      <delete dir="${basedir}/winutil"/>
1717      <delete failonerror="false"><fileset dir="${lib.jni}" includes="*.dll"/></delete>
1718
1719    <!-- windows -->
1720    <else><if><bool><istrue value="${current.os.iswindows}"/></bool>
1721      <delete><fileset dir="." includes="*.sh,*.bash,*.csh"/></delete>
1722      <delete><fileset dir="gli" includes="*.sh,*.bash,*.csh"/></delete>
1723      <delete><fileset dir="gs2build" includes="*.sh,*.bash,*.csh"/></delete>
1724      <delete><fileset dir="bin/script" includes="*.sh,*.bash,*.csh"/></delete>
1725    </if></else></if>
1726
1727  </target>
1728
1729  <!-- ============= tweaks for making compilation static ========== --> 
1730  <target name="tweak-makefiles" depends="init" if="compile.static">
1731    <antcall target="rtftohtml-add-static" />
1732  </target>
1733   
1734  <target name="rtftohtml-add-static" depends="init" if="collection.building.enabled">
1735    <rsr file="${gs2build.home}/build-src/packages/rtftohtml/rtftohtml_src/Makefile" pattern="-o rtftohtml(.{2})EXEEXT(.{1})" replacement="-o rtftohtml$1EXEEXT$2 -static" />
1736  </target>
1737   
1738</project>
Note: See TracBrowser for help on using the browser.