root/trunk/gsdl3/build.xml @ 10909

Revision 10909, 68.6 KB (checked in by kjdon, 14 years ago)

source dist - need to run the xslt

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