source: branches/ant-install-branch/gsdl3/build.xml@ 9628

Last change on this file since 9628 was 9628, checked in by kjdon, 19 years ago

added some restart targets, changes to axis targets

  • Property svn:keywords set to Author Date Id Revision
File size: 40.8 KB
Line 
1<?xml version="1.0"?>
2
3<!-- ======================================================================
4 March 2005
5
6 GSDL3 build and install script
7
8 kjdon
9 ====================================================================== -->
10<project name="gsdl3" 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="src.home" value="${basedir}/src/java"/>
51 <property name="build.home" value="${basedir}/build"/>
52 <property name="packages.home" value="${basedir}/packages"/>
53 <property name="javalib" value="${basedir}/lib/java"/>
54 <property name="web.home" value="${basedir}/web"/>
55 <property name="web.lib" value="${web.home}/lib"/>
56 <property name="web.classes" value="${web.home}/WEB-INF/classes"/>
57
58 <property name="javadocs" value="${basedir}/docs/javadoc"/>
59
60 <property name="app.name" value="gsdl3"/>
61 <property name="app.path" value="/${app.name}"/>
62 <property name="app.version" value="3.00alpha"/>
63 <property name="catalina.home" value="${basedir}/comms/jakarta/tomcat"/>
64
65 <property name="os.linux" value="Linux"/> <!-- mac??-->
66 <property name="os.windows" value="Windows 95,Windows 98,Windows 2000,Windows XP, Windows NT,Windows ME"/> <!-- check this!!!-->
67
68 <condition property="current.os.islinux">
69 <os family="unix"/>
70 </condition>
71 <condition property="current.os.iswindows">
72 <os family="windows"/>
73 </condition>
74 <!-- ============= Base dirs for each package and component ============ -->
75 <property name="applet.home" value="${src.home}/org/greenstone/applet"/>
76 <property name="gsdl3.home" value="${src.home}/org/greenstone/gsdl3"/>
77 <property name="anttasks.home" value="${src.home}/org/greenstone/anttasks"/>
78 <property name="gs2build.home" value="${basedir}/gs2build"/>
79 <property name="gli.home" value="${basedir}/gli"/>
80 <property name="vishnu.home" value="${packages.home}/vishnu"/>
81 <property name="mg.home" value="${packages.home}/mg"/>
82 <property name="mgpp.home" value="${packages.home}/mgpp"/>
83 <property name="mysql.home" value="${packages.home}/mysql"/>
84 <property name="gsdl-as.home" value="${packages.home}/gsdl-as"/>
85
86<!-- ==================== Compilation Control Options ==================== -->
87
88<!--
89
90 These properties control option settings on the Javac compiler when it
91 is invoked using the <javac> task.
92
93 compile.debug Should compilation include the debug option?
94
95 compile.deprecation Should compilation include the deprecation option?
96
97 compile.optimize Should compilation include the optimize option?
98
99-->
100
101 <property name="compile.debug" value="true"/>
102 <property name="compile.deprecation" value="true"/>
103 <property name="compile.optimize" value="true"/>
104
105<!--
106
107 Rather than relying on the CLASSPATH environment variable, Ant includes
108 features that makes it easy to dynamically construct the classpath you
109 need for each compilation. The example below constructs the compile
110 classpath to include the servlet.jar file, as well as the other components
111 that Tomcat makes available to web applications automatically, plus anything
112 that you explicitly added.
113
114-->
115
116 <path id="compile.classpath">
117 <!-- Include all jar files in our lib directory -->
118 <pathelement location="${javalib}"/>
119 <fileset dir="${javalib}">
120 <include name="*.jar"/>
121 </fileset>
122 <!-- Include the resources directory -->
123 <pathelement location="${basedir}/resources/java"/>
124 <pathelement location="${basedir}/resources/dtd"/>
125
126 <!-- Include the axis jar files -->
127 <fileset dir="${basedir}/comms/soap/axis/lib">
128 <include name="*.jar"/>
129 </fileset>
130
131 <!-- Include all elements that Tomcat exposes to applications -->
132 <pathelement location="${catalina.home}/common/classes"/>
133 <fileset dir="${catalina.home}/common/endorsed">
134 <include name="*.jar"/>
135 </fileset>
136 <fileset dir="${catalina.home}/common/lib">
137 <include name="*.jar"/>
138 </fileset>
139 <pathelement location="${catalina.home}/shared/classes"/>
140 <fileset dir="${catalina.home}/shared/lib">
141 <include name="*.jar"/>
142 </fileset>
143 </path>
144
145<!-- ==================== Primary Targets ============================= -->
146
147
148 <!-- add comments about using xxx-core, xxx-packages if only want certain parts?? -->
149
150 <target name="install" depends="accept-properties,init,prepare,cvsupdate,configure,clean,compile" description="Install Greenstone 3. Use this when you first checkout the code. Also running this target later on will reinstall Greenstone. Most things will be reset back to their defaults, except for code changes.">
151 </target>
152
153 <target name="all" depends="init,compile"
154 description="Recompile the code?"/>
155
156 <target name="clean" depends="init,clean-packages,clean-core,clean-gs2building"
157 description="Remove all old compiled code. Includes core, packages and gs2building if necessary"/>
158
159 <target name="compile" depends="init,compile-extra,compile-packages,compile-core,compile-gs2building"
160 description="Compile all the source code, includes core, packages and gs2building if necessary. Copy jar files and executables to their correct places."/>
161
162 <target name="update" depends="init,update-packages,update-core,update-gs2building"
163 description="Update (thru CVS) all the source (including core, packages and gs2building) and recompile. Similar to install but doesn't reinstall components such as Tomcat and axis."/>
164
165 <target name="cvsupdate" depends="init,cvsupdate-packages,cvsupdate-core,cvsupdate-gs2building"
166 description="Do a cvs update for all sources. Doesn't reompile teh code."/>
167 <!-- this is config stuff, that can be done more than once - should be rerun is the build.properties file changes -->
168 <target name="configure" depends="init,configure-tomcat,configure-files,configure-packages,configure-core,configure-gs2building"
169 description="Configure the installation. Includes setting up config files and configuring the C/C++ packages. This is called from install and update. Should be re-run if you change the build.properties file."/>
170
171
172<!-- =========== Help targets =================================== -->
173
174 <target name="usage" description="Print a help message">
175 <echo message=" Execute 'ant -projecthelp' for build file help."/>
176 <echo message=" Execute 'ant -help' for Ant help."/>
177 <echo>put the primary targets in here</echo>
178 </target>
179
180 <target name="help" depends="usage" description="Print a help message"/>
181
182 <target name="debug" depends="init" description="Display all the currently used properties">
183 <echoproperties/>
184 </target>
185
186<!-- ====== initialization and setup targets ================== -->
187
188 <target name="accept-properties">
189 <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
190tomcat.server=${tomcat.server}
191tomcat.port=${tomcat.port}
192tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
193gsdl.installed.path=${gsdl.installed.path} (this is the location of Greenstone 2 if you have it)
194proxy.host=${proxy.host}
195proxy.port=${proxy.port}
196If these are not acceptable, please change them and rerun this target. Continue [y/n]?" />
197 </input>
198 <condition property="do.abort">
199 <equals arg1="n" arg2="${properties.ok}"/>
200 </condition>
201 <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
202 </target>
203
204 <!-- this sets up some initial properties -->
205 <target name="init">
206
207 <condition property="java.too.old">
208 <or>
209 <equals arg1="1.1" arg2="${ant.java.version}"/>
210 <equals arg1="1.2" arg2="${ant.java.version}"/>
211 <equals arg1="1.3" arg2="${ant.java.version}"/>
212 </or>
213 </condition>
214 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
215
216 <available file="${basedir}/packages/mgpp/text" property="mgpp.present"/>
217 <available file="${basedir}/packages/mysql/bin" property="mysql.present"/>
218 <available file="${basedir}/comms/jakarta/tomcat" property="tomcat.present"/>
219 <available file="${basedir}/gli" property="gli.present"/>
220 <available file="${basedir}/gs2build" property="gs2build.present"/>
221 <available file="${basedir}/comms/soap/axis" property="axis.present"/>
222 <available file="${basedir}/comms/jakarta/tomcat/webapps/axis" property="axis.installed"/>
223 <condition property="gsdl2.islocal">
224 <or>
225 <not>
226 <isset property="gsdl.installed.path"/>
227 </not>
228 <equals arg1="" arg2="${gsdl.installed.path}"/>
229 </or>
230 </condition>
231 <condition property="mysql.islocal">
232 <or>
233 <not>
234 <isset property="mysql.installed.path"/>
235 </not>
236 <equals arg1="" arg2="${mysql.installed.path}"/>
237 </or>
238 </condition>
239 <condition property="tomcat.islocal">
240 <or>
241 <not>
242 <isset property="tomcat.installed.path"/>
243 </not>
244 <equals arg1="" arg2="${tomcat.installed.path}"/>
245 </or>
246 </condition>
247
248 <echo>tomcat.port:${tomcat.port}, gli.present:${gli.present} gsdlislocal=${gsdl2.islocal} gs2build.present=${gs2build.present} gsdl.path = ${gsdl.path}</echo>
249 <condition property="proxy.present">
250 <not>
251 <equals arg1="" arg2="${proxy.host}"/>
252 </not>
253 </condition>
254 </target>
255
256 <target name="setup-proxy" depends="init" if="proxy.present">
257 <condition property="ask.user">
258 <or>
259 <equals arg1="" arg2="${proxy.user}"/>
260 <equals arg1="" arg2="${proxy.password}"/>
261 </or>
262 </condition>
263 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}"/>
264 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.user}" proxypassword="${proxy.password}"/>
265 </target>
266
267 <!-- this is all the do-once things -->
268 <target name="prepare" depends="init,prepare-packages,prepare-gs2building,prepare-tomcat,prepare-axis,prepare-mysql,prepare-collections">
269 </target>
270
271 <target name="prepare-collections">
272 <property name="collect.dir" value="${basedir}/web/sites/localsite/collect"/>
273 <!-- gs3mgdemo -->
274 <unzip src="${collect.dir}/gs3mgdemo/import.zip"
275 dest="${collect.dir}/gs3mgdemo"/>
276 <unzip src="${collect.dir}/gs3mgdemo/archives.zip"
277 dest="${collect.dir}/gs3mgdemo"/>
278 <unzip src="${collect.dir}/gs3mgdemo/index/index.zip"
279 dest="${collect.dir}/gs3mgdemo/index"/>
280 <!-- gs2mgdemo -->
281 <unzip src="${collect.dir}/gs2mgdemo/import.zip"
282 dest="${collect.dir}/gs2mgdemo"/>
283 <unzip src="${collect.dir}/gs2mgdemo/metadata.zip"
284 dest="${collect.dir}/gs2mgdemo"/>
285 <unzip src="${collect.dir}/gs2mgdemo/index/index.zip"
286 dest="${collect.dir}/gs2mgdemo/index"/>
287 <!-- gs2mgppdemo -->
288 <unzip src="${collect.dir}/gs2mgppdemo/import.zip"
289 dest="${collect.dir}/gs2mgppdemo"/>
290 <unzip src="${collect.dir}/gs2mgppdemo/metadata.zip"
291 dest="${collect.dir}/gs2mgppdemo"/>
292 <unzip src="${collect.dir}/gs2mgppdemo/index/index.zip"
293 dest="${collect.dir}/gs2mgppdemo/index"/>
294 <!-- gberg -->
295 <unzip src="${collect.dir}/gberg/index/index.zip"
296 dest="${collect.dir}/gberg/index"/>
297 </target>
298
299
300 <target name="configure-files" depends="init">
301 <filter token="port" value="${tomcat.port}"/>
302 <filter token="hostname" value="${tomcat.server}"/>
303 <filter token="gsdl3home" value="${basedir}"/>
304 <copy file="${basedir}/web/WEB-INF/web.xml.in" tofile="${basedir}/web/WEB-INF/web.xml" filtering="true"/>
305 <copy file="${basedir}/web/sites/localsite/siteConfig.xml.in" tofile="${basedir}/web/sites/localsite/siteConfig.xml" filtering="true"/>
306 <copy file="${basedir}/web/sites/gateway/siteConfig.xml.in" tofile="${basedir}/web/sites/gateway/siteConfig.xml" filtering="true"/>
307 <copy file="${basedir}/resources/java/SOAPServer.cfg.in" tofile="${basedir}/resources/java/SOAPServer.cfg" filtering="true"/>
308
309 </target>
310
311 <!-- this target sets up tomcat for teh first time, or resets it any subsequent times -->
312 <target name="prepare-tomcat" depends="init,setup-proxy">
313 <get src="http://www.greenstone.org/gs3files/jakarta-tomcat-5.5.7.zip"
314 dest="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7.zip"
315 usetimestamp="true"/>
316 <delete dir="${basedir}/comms/jakarta/tomcat.bak"/>
317 <move todir="${basedir}/comms/jakarta/tomcat.bak" failonerror="false">
318 <fileset dir="${basedir}/comms/jakarta/tomcat"/>
319 </move>
320 <unzip src="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7.zip"
321 dest="${basedir}/comms/jakarta"/>
322 <condition property="need.tomcat.compat">
323 <equals arg1="1.4" arg2="${ant.java.version}"/>
324 </condition>
325 <antcall target="prepare-tomcat-compat"/>
326 <move todir="${basedir}/comms/jakarta/tomcat">
327 <fileset dir="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7"/>
328 </move>
329 <!-- make sure we have execute permission for the .sh files -->
330 <chmod dir="${basedir}/comms/jakarta/tomcat/bin" perm="ugo+rx"
331 includes="*.sh"/>
332 </target>
333
334
335 <target name="prepare-tomcat-compat" if="need.tomcat.compat">
336 <get src="http://www.greenstone.org/gs3files/jakarta-tomcat-5.5.7-compat.zip"
337 dest="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7-compat.zip"
338 usetimestamp="true"/>
339 <unzip src="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7-compat.zip"
340 dest="${basedir}/comms/jakarta"/>
341 </target>
342
343 <target name="configure-tomcat" depends="init" if="tomcat.present">
344 <!-- re-setup the server.xml file -->
345 <copy file="${basedir}/comms/jakarta/server.xml.in" tofile="${basedir}/comms/jakarta/tomcat/conf/server.xml" overwrite="true">
346 <filterset>
347 <filter token="port" value="${tomcat.port}"/>
348 <filter token="gsdl3home" value="${basedir}"/>
349 </filterset>
350 </copy>
351 </target>
352
353 <!-- this is one target that we only want to run once. -->
354 <target name="prepare-mysql" depends="init,install-mysql,startup-mysql" if="mysql.islocal" unless="mysql.present">
355 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
356 <arg value="--user=root"/>
357 <arg value="--execute=GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@localhost;"/>
358 </exec>
359 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
360 <arg value="--user=root"/>
361 <arg value="--execute=GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@'%'"/>
362 </exec>
363 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
364 <arg value="--user=root"/>
365 <arg value="--execute=GRANT SELECT ON *.* TO gsdl3reader@localhost;"/>
366 </exec>
367 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
368 <arg value="--user=root"/>
369 <arg value="--execute=create database localsite_gs3mgdemo;"/>
370 </exec>
371 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}"
372 input="${basedir}/web/sites/localsite/collect/gs3mgdemo/mysqldatadump.sql">
373 <arg value="--user=root"/>
374 <arg value="localsite_gs3mgdemo"/>
375 </exec>
376 </target>
377
378 <target name="install-mysql" depends="init,install-mysql-linux,install-mysql-windows" if="mysql.islocal"/>
379
380 <!-- install and set up the database -->
381 <target name="install-mysql-linux" depends="init" if="current.os.islinux" unless="mysql.present">
382 <get src="http://www.greenstone.org/gs3files/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz"
383 dest="${packages.home}/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz"
384 usetimestamp="true"/>
385 <untar src="${packages.home}/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz"
386 dest="${packages.home}"
387 compression="gzip"/>
388 <move todir="${packages.home}/mysql">
389 <fileset dir="${packages.home}/mysql-standard-4.1.11-pc-linux-gnu-i686"/>
390 </move>
391 <!-- file permissions are screwed up, so make executables executable -->
392 <chmod file="${mysql.home}/scripts/mysql_install_db" perm="a+x"/>
393 <chmod perm="a+x">
394 <fileset dir="${mysql.home}/bin" />
395 </chmod>
396 <mkdir dir="${mysql.home}/var/"/>
397 <mkdir dir="${mysql.home}/var/log/"/>
398 <chmod file="${mysql.home}/var/" perm="777"/>
399 <chmod file="${mysql.home}/var/log/" perm="777"/>
400
401 <exec executable="${mysql.home}/scripts/mysql_install_db" dir="${mysql.home}">
402 <arg value="--datadir=./data"/>
403 <arg value="--basedir=."/>
404 <arg value="--user=root"/>
405 <arg value="--force"/>
406 </exec>
407 </target>
408
409 <target name="install-mysql-windows" depends="init" if="current.os.iswindows">
410 <get src="http://www.greenstone.org/gs3files/mysql-essential-4.1.11-win32.msi"
411 dest="${packages.home}/mysql-essential-4.1.11-win32.msi"
412 usetimestamp="true"/>
413 <!-- can we run the installer?? -->
414 </target>
415
416 <target name="prepare-axis" depends="init">
417 <get src="http://www.greenstone.org/gs3files/axis-1_1.zip"
418 dest="${basedir}/comms/soap/axis-1_1.zip"
419 usetimestamp="true"/>
420 <delete dir="${basedir}/comms/soap/axis.bak"/>
421 <move todir="${basedir}/comms/soap/axis.bak" failonerror="false">
422 <fileset dir="${basedir}/comms/soap/axis"/>
423 </move>
424 <unzip src="${basedir}/comms/soap/axis-1_1.zip"
425 dest="${basedir}/comms/soap/"/>
426 <move todir="${basedir}/comms/soap/axis">
427 <fileset dir="${basedir}/comms/soap/axis-1_1"/>
428 </move>
429 <!-- install the webapp into tomcat -->
430 <copy todir="${basedir}/comms/jakarta/tomcat/webapps/axis">
431 <fileset dir="${basedir}/comms/soap/axis/webapps/axis"/>
432 </copy>
433 </target>
434
435<!-- ====================== Core targets ============================== -->
436<!-- core targets refer to the core gsdl3 java src -->
437
438 <target name="prepare-core"/>
439 <target name="configure-core"/>
440 <target name="update-core" depends="init,cvsupdate-core,clean-core,compile-core"
441 description="Update only the Greenstone core" />
442
443 <target name="cvsupdate-core">
444 <cvs command="update -l"/>
445 <cvs command="update -dP bin comms dist-resources docs interfaces lib resources src web winutil"/>
446 </target>
447
448 <target name="clean-core"
449 description="Clean only the Greenstone core">
450 <delete dir="${build.home}"/>
451 </target>
452
453 <target name="compile-core"
454 description="Compile only the Greenstone core">
455 <mkdir dir="${build.home}"/>
456 <javac srcdir="${src.home}"
457 destdir="${build.home}"
458 debug="${compile.debug}"
459 deprecation="${compile.deprecation}"
460 optimize="${compile.optimize}">
461 <classpath>
462 <path refid="compile.classpath"/>
463 <!-- need to add in package jar files to classpath -->
464 <pathelement location="${mg.home}/java/mg.jar"/>
465 <pathelement location="${mgpp.home}/java/mgpp.jar"/>
466 <pathelement location="${vishnu.home}/vishnu.jar"/>
467 </classpath>
468 </javac>
469 <jar destfile="${build.home}/gsdl3.jar">
470 <fileset dir="${build.home}">
471 <include name="org/greenstone/gsdl3/**"/>
472 <exclude name="**/Test.class"/>
473 </fileset>
474 <manifest>
475 <attribute name="Built-By" value="${user.name}" />
476 </manifest>
477 </jar>
478 <copy file="${build.home}/gsdl3.jar" todir="${javalib}"/>
479 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
480 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
481 <copy file="${build.home}/org/greenstone/gsdl3/LibraryServlet.class"
482 todir="${web.classes}/org/greenstone/gsdl3"/>
483 <jar destfile="${build.home}/phind.jar">
484 <fileset dir="${build.home}">
485 <include name="org/greenstone/applet/phind/**"/>
486 </fileset>
487 <manifest>
488 <attribute name="Built-By" value="${user.name}" />
489 </manifest>
490 </jar>
491 <copy file="${build.home}/phind.jar" todir="${javalib}"/>
492 <copy file="${build.home}/phind.jar" todir="${web.lib}"/>
493 <jar destfile="${build.home}/anttasks.jar">
494 <fileset dir="${build.home}">
495 <include name="org/greenstone/anttasks/**"/>
496 </fileset>
497 <manifest>
498 <attribute name="Built-By" value="${user.name}" />
499 </manifest>
500 </jar>
501 <copy file="${build.home}/anttasks.jar" todir="${javalib}"/>
502 <jar destfile="${build.home}/gsdl3test.jar">
503 <fileset dir="${build.home}">
504 <include name="org/greenstone/gsdl3/**/*Test.class"/>
505 <include name="org/greenstone/testing/**"/>
506 </fileset>
507 <manifest>
508 <attribute name="Built-By" value="${user.name}" />
509 </manifest>
510 </jar>
511 </target>
512
513<!-- ================== Packages targets ================================ -->
514 <!-- these targets refer to the greenstone packages - these need updating
515 less often, so are in separate targets to the core -->
516 <target name="prepare-packages" depends="init,prepare-mgpp"/>
517
518 <target name="prepare-mgpp" depends="init" unless="mgpp.present">
519 <cvs command="checkout -P" package="mgpp" dest="${basedir}/packages/"/>
520 </target>
521
522 <target name="update-packages" depends="init,cvsupdate-packages,configure-packages,clean-packages,compile-packages"
523 description="Update only the packages"/>
524
525 <target name="cvsupdate-packages">
526 <cvs command="update -dP" dest="${packages.home}"/>
527 </target>
528
529 <target name="configure-packages" description="Configure only the packages.">
530 <echo>
531 Configuring MG
532 </echo>
533 <exec executable="configure" os="Linux"
534 dir="${mg.home}">
535 <arg value="--prefix=${basedir}"/>
536 </exec>
537 <echo>
538 Configuring MGPP
539 </echo>
540 <exec executable="configure" os="Linux"
541 dir="${mgpp.home}">
542 <arg value="--prefix=${basedir}"/>
543 </exec>
544 </target>
545
546 <target name="clean-packages"
547 description="Clean only the packages">
548 <!-- mg -->
549 <exec executable="make" os="Linux"
550 dir="${mg.home}">
551 <arg value="clean"/>
552 </exec>
553 <delete dir="${mg.home}/java/classes"/>
554 <delete file="${mg.home}/java/mg.jar"/>
555 <delete file="${mg.home}/jni/org_greenstone_mg_MGWrapper.h"/>
556 <delete file="${mg.home}/jni/org_greenstone_mg_MGPassesWrapper.h"/>
557 <!-- mgpp -->
558 <exec executable="make" os="Linux"
559 dir="${mg.home}">
560 <arg value="clean"/>
561 </exec>
562 <delete dir="${mgpp.home}/java/classes"/>
563 <delete file="${mgpp.home}/java/mgpp.jar"/>
564 <delete file="${mgpp.home}/jni/org_greenstone_mgpp_MGPPWrapper.h"/>
565 <delete file="${mgpp.home}/jni/org_greenstone_mgpp_MGPPPassesWrapper.h"/>
566 <!-- vishnu -->
567 <delete dir="${vishnu.home}/src/classes"/>
568 <delete file="${vishnu.home}/src/vishnu.jar"/>
569
570 <!-- gsdl-as : just call the ant target-->
571 <ant antfile="${gsdl-as.home}/build.xml" dir="${gsdl-as.home}"
572 inheritall="false" target="clean"/>
573 </target>
574
575 <target name="compile-packages"
576 description="Compile only the packages">
577 <!-- mg -->
578 <echo>Compiling MG</echo>
579 <!-- c code -->
580 <!-- javacode -->
581 <mkdir dir="${mg.home}/java/classes"/>
582 <javac srcdir="${mg.home}/java"
583 destdir="${mg.home}/java/classes"
584 debug="${compile.debug}"
585 deprecation="${compile.deprecation}"
586 optimize="${compile.optimize}">
587 </javac>
588 <javah classpath="${mg.home}/java/classes"
589 destdir="${mg.home}/jni">
590 <class name="org.greenstone.mg.MGWrapper"/>
591 <class name="org.greenstone.mg.MGPassesWrapper"/>
592 </javah>
593 <jar destfile="${mg.home}/java/mg.jar">
594 <fileset dir="${mg.home}/java/classes"/>
595 <manifest>
596 <attribute name="Built-By" value="${user.name}" />
597 </manifest>
598 </jar>
599 <copy file="${mg.home}/java/mg.jar" todir="${javalib}"/>
600 <!-- make the c code -->
601 <exec executable="make" os="Linux"
602 dir="${mg.home}">
603 </exec>
604 <exec executable="make" os="Linux"
605 dir="${mg.home}">
606 <arg value="install"/>
607 </exec>
608
609 <!-- mgpp -->
610 <echo>Compiling MGPP</echo>
611 <!-- javacode -->
612 <mkdir dir="${mgpp.home}/java/classes"/>
613 <javac srcdir="${mgpp.home}/java"
614 destdir="${mgpp.home}/java/classes"
615 debug="${compile.debug}"
616 deprecation="${compile.deprecation}"
617 optimize="${compile.optimize}">
618 </javac>
619 <javah classpath="${mgpp.home}/java/classes"
620 destdir="${mgpp.home}/jni">
621 <class name="org.greenstone.mgpp.MGPPWrapper"/>
622 <class name="org.greenstone.mgpp.MGPPPassesWrapper"/>
623 </javah>
624 <jar destfile="${mgpp.home}/java/mgpp.jar">
625 <fileset dir="${mgpp.home}/java/classes"/>
626 <manifest>
627 <attribute name="Built-By" value="${user.name}" />
628 </manifest>
629 </jar>
630 <copy file="${mgpp.home}/java/mgpp.jar" todir="${javalib}"/>
631 <!-- c++ code -->
632 <exec executable="make" os="Linux"
633 dir="${mgpp.home}">
634 </exec>
635 <exec executable="make" os="Linux"
636 dir="${mgpp.home}">
637 <arg value="install"/>
638 </exec>
639
640 <!-- vishnu -->
641 <echo>Compiling Vishnu</echo>
642 <mkdir dir="${vishnu.home}/classes"/>
643 <javac srcdir="${vishnu.home}/src"
644 destdir="${vishnu.home}/classes"
645 debug="${compile.debug}"
646 deprecation="${compile.deprecation}"
647 optimize="${compile.optimize}">
648 <classpath>
649 <path refid="compile.classpath"/>
650 <pathelement location="${mg.home}/java/mg.jar"/>
651 </classpath>
652 </javac>
653 <jar destfile="${vishnu.home}/vishnu.jar">
654 <fileset dir="${vishnu.home}/classes"/>
655 <manifest>
656 <attribute name="Built-By" value="${user.name}" />
657 </manifest>
658 </jar>
659 <copy file="${vishnu.home}/vishnu.jar" todir="${javalib}"/>
660 <copy file="${vishnu.home}/vishnu.jar" todir="${web.lib}"/>
661 <mkdir dir="${web.classes}/vishnu/server"/>
662 <copy file="${vishnu.home}/classes/vishnu/server/VisServlet.class"
663 todir="${web.classes}/vishnu/server"/>
664
665 <!-- gsdl-as -->
666 <echo>Compiling GSDL-AS</echo>
667 <ant antfile="${gsdl-as.home}/build.xml" dir="${gsdl-as.home}"
668 inheritall="false" target="compile"/>
669 </target>
670
671 <!-- ================== gs2building targets ===============-->
672
673
674 <target name="update-gs2building" if="gsdl2.islocal"
675 depends="init,cvsupdate-gs2building,configure-gs2building,clean-gs2building,compile-gs2building"
676 description="Update only the Greenstone 2 building components"/>
677
678 <target name="cvsupdate-gs2building" if="gsdl2.islocal" depends="init">
679 <cvs command="update -dP" dest="${gli.home}"/>
680 <!-- Note: can't do a -d update here cos it will get all of gsdl-->
681 <cvs command="update -P" dest="${gs2build.home}"/>
682 <!-- rename the .gs2build files - we may have gotten changes to the main
683 gsdl versions - make sure they are set back to the gs2build versions -->
684 <antcall target="rename-gs2build-files"/>
685 </target>
686
687 <target name="prepare-gs2building" depends="init,prepare-gs2build,prepare-gli" if="gsdl2.islocal">
688 <echo>checking out gs2 building stuff</echo>
689 </target>
690
691 <target name="prepare-gs2build" depends="init" if="gsdl2.islocal" unless="gs2build.present">
692 <echo>checking out gs2build</echo>
693 <cvs command="co -P" package="gs2build"/>
694
695 <!-- rename the .gs2build files -->
696 <antcall target="rename-gs2build-files"/>
697 </target>
698
699 <target name="rename-gs2build-files">
700 <copy file="${gs2build.home}/configure.gs2build" tofile="${gs2build.home}/configure"/>
701 <chmod file="${gs2build.home}/configure" perm="a+x"/>
702 <copy file="${gs2build.home}/configure.in.gs2build" tofile="${gs2build.home}/configure.in"/>
703 <copy file="${gs2build.home}/Makefile.in.gs2build" tofile="${gs2build.home}/Makefile.in"/>
704 <copy file="${gs2build.home}/packages/configure.gs2build" tofile="${gs2build.home}/packages/configure"/>
705 <chmod file="${gs2build.home}/packages/configure" perm="a+x"/>
706 <copy file="${gs2build.home}/packages/Makefile.gs2build" tofile="${gs2build.home}/packages/Makefile"/>
707 <copy file="${gs2build.home}/lib/Makefile.in.gs2build" tofile="${gs2build.home}/lib/Makefile.in"/>
708
709 </target>
710 <target name="prepare-gli" depends="init" if="gsdl2.islocal" unless="gli.present">
711 <echo>checking out gli</echo>
712 <cvs command="co -P" package="gli"/>
713 </target>
714
715 <target name="configure-gs2building" if="gsdl2.islocal"
716 description="Configure only the Greenstone 2 building components">
717 <exec executable="${gs2build.home}/configure" os="${os.linux}"
718 dir="${gs2build.home}">
719 <arg value="--prefix=${gs2build.home}"/>
720 </exec>
721 </target>
722
723 <target name="clean-gs2building" depends="init" if="gsdl2.islocal"
724 description="Clean only the Greenstone 2 building components">
725 <!-- gli -->
726 <property name="gli.home" value="${basedir}/gli"/>
727 <!-- linux -->
728 <exec executable="clean.sh" os="${os.linux}" dir="${gli.home}"
729 resolveExecutable="true"/>
730 <!-- windows -->
731 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
732 resolveExecutable="true"/>
733 <!-- gs2build -->
734 <!--linux: -->
735 <exec executable="make" os="${os.linux}" dir="${gs2build.home}">
736 <arg value="clean"/>
737 </exec>
738 <!-- windows: -->
739 </target>
740
741 <target name="compile-gs2building" depends="init" if="gsdl2.islocal"
742 description="Compile only the Greenstone 2 building components">
743 <!-- gli -->
744 <property name="gli.home" value="${basedir}/gli"/>
745 <!-- linux -->
746 <exec executable="makegli.sh" os="${os.linux}" dir="${gli.home}"
747 resolveExecutable="true"/>
748 <!-- windows -->
749 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}"
750 resolveExecutable="true"/>
751 <!-- gs2build -->
752 <!--linux: make, make install -->
753 <exec executable="make" os="${os.linux}" dir="${gs2build.home}">
754 </exec>
755 <exec executable="make" os="${os.linux}" dir="${gs2build.home}">
756 <arg value="install"/>
757 </exec>
758
759 <!-- windows: -->
760 </target>
761
762
763<!-- ============ running targets ========================-->
764
765 <target name="setup-catalina-ant-tasks">
766 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
767 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
768 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
769 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
770 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
771 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
772 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
773 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
774 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
775 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
776 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
777 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
778 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
779 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
780 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
781 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
782 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
783 </target>
784
785 <target name="gli" description="Run the Greenstone Librarian Interface" depends="gli-local,gli-external">
786 <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 gsdl3/gli directory.
787 </echo>
788 </target>
789
790 <target name="gli-local" depends="init" if="gsdl2.islocal">
791 <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.linux}" dir="${basedir}/gli" spawn="true">
792 <env key="GSDLHOME" path="${basedir}/gs2build"/>
793 <env key="GSDL3HOME" value="${basedir}"/>
794 </exec>
795 <exec executable="${basedir}/gli/gli4gs3.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
796 <env key="GSDLHOME" value="${basedir}/gs2build"/>
797 <env key="GSDL3HOME" value="${basedir}"/>
798 </exec>
799 </target>
800
801 <target name="gli-external" depends="init" unless="gsdl2.islocal">
802 <exec executable="${gsdl.path}/gli/gli4gs3.sh" os="${os.linux}" dir="${gsdl.path}/gli"/>
803 <exec executable="${gsdl.path}/gli/gli4gs3.bat" os="${os.windows}" dir="${gsdl.path}/gli"/>
804 </target>
805
806
807 <target name="reload" description="Reload web application"
808 depends="init,setup-catalina-ant-tasks">
809 <reload url="http://kanuka:7070/manager" username="admin" password="admin"
810 path="/gsdl3"/>
811 </target>
812
813 <target name="startup" description="Startup the (local) Greenstone servers (tomcat,mysql...)" depends="init,startup-mysql,startup-tomcat"/>
814
815 <target name="startup-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
816 <property name="tomcat.classpath" refid="compile.classpath"/>
817 <property name="tomcat.path" value="${basedir}/packages/mysql/bin:${basedir}/bin/script:${basedir}/bin:${env.PATH}"/>
818 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
819 <exec executable="${catalina.home}/bin/startup.sh" os="${os.linux}" dir="${catalina.home}/bin" spawn="false">
820 <env key="GSDLOS" value="linux"/>
821 <env key="GSDL3HOME" value="${basedir}"/>
822 <env key="PATH" path="${tomcat.path}"/>
823 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
824 <env key="CLASSPATH" path="${tomcat.classpath}"/>
825 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${basedir}/lib:${mysql.home}/lib/mysql"/>
826 </exec>
827 <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false">
828 <env key="GSDLOS" value="windows"/>
829 <env key="GSDL3HOME" value="${basedir}"/>
830 <env key="PATH" path="${tomcat.path}:${basedir}/lib"/>
831 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
832 <env key="CLASSPATH" path="${tomcat.classpath}"/>
833 </exec>
834 <!-- wait for the server to startup in case other targets need it running -->
835 <waitfor maxwait="5" maxwaitunit="second">
836 <and>
837 <socket server="${tomcat.server}" port="${tomcat.port}"/>
838 <http url="http://${tomcat.server}:${tomcat.port}/gsdl3/index.html"/>
839 </and>
840 </waitfor>
841 </target>
842
843 <target name="shutdown" depends="init,shutdown-tomcat,shutdown-mysql" description="Shutdown the (local) Greenstone servers."/>
844
845 <target name="shutdown-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
846 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.linux}" dir="${catalina.home}/bin" spawn="false"/>
847 </target>
848
849 <target name="restart" description="Shutdown and restart the Greenstone servers" depends="init,shutdown,startup"/>
850 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,shutdown-tomcat,startup-tomcat"/>
851 <target name="restart-mysql" description="Shutdown and restart only mysql" depends="init,shutdown-mysql,startup-mysql"/>
852
853 <target name="test" description="Run the (incomplete) JUnit test suite "
854 depends="init">
855 <mkdir dir="${basedir}/test"/>
856 <junit printsummary="withOutAndErr"
857 errorproperty="test.failed"
858 failureproperty="test.failed"
859 fork="${junit.fork}">
860 <formatter type="plain"/>
861 <classpath>
862 <pathelement location="${build.home}/gsdl3test.jar"/>
863 <path refid="compile.classpath"/>
864 </classpath>
865 <test name="${testcase}" if="testcase"/>
866 <batchtest todir="${basedir}/test" unless="testcase">
867 <fileset dir="${build.home}"
868 includes="**/*Test.class"
869 />
870 </batchtest>
871 </junit>
872 <echo>
873 *********************************************
874 Test output can be found in directory 'test'
875 *********************************************
876 </echo>
877 </target>
878
879 <target name="compile-extra" depends="init">
880 <javac srcdir="${web.home}/WEB-INF/classes"
881 destdir="${web.home}/WEB-INF/classes"
882 debug="${compile.debug}"
883 deprecation="${compile.deprecation}"
884 optimize="${compile.optimize}">
885 <classpath>
886 <path refid="compile.classpath"/>
887 </classpath>
888 </javac>
889 </target>
890
891 <target name="get-sitename">
892 <input addproperty="axis.sitename" message="What site? (press enter for default:localsite)" defaultvalue="localsite"/>
893 <condition property="deploy.exists">
894 <available file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
895 </condition>
896 <condition property="undeploy.exists">
897 <available file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
898 </condition>
899 <echo>${axis.sitename}, ${deploy.exists}, ${undeploy.exists}</echo>
900 </target>
901
902 <target name="get-siteuri">
903 <input addproperty="axis.siteuri" message="What name do you want the service to have? (press enter for default:localsite)" defaultvalue="localsite"/>
904 </target>
905 <target name="create-deployment-files" depends="get-sitename"
906 if="axis.sitename" unless="deploy.exists">
907 <filter token="sitename" value="${axis.sitename}"/>
908 <filter token="siteuri" value="${axis.siteuri}"/>
909 <copy file="${basedir}/resources/soap/site.wsdd.template"
910 tofile="${basedir}/resources/soap/${axis.sitename}.wsdd"
911 filtering="true"/>
912 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
913 tofile="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"
914 filtering="true"/>
915 <!-- create the java files and compile them -->
916 <copy file="${gsdl3.home}/SOAPServer.java.in"
917 tofile="${gsdl3.home}/SOAPServer${axis.sitename}.java"
918 filtering="true"/>
919 <javac srcdir="${src.home}"
920 destdir="${build.home}"
921 debug="${compile.debug}"
922 deprecation="${compile.deprecation}"
923 optimize="${compile.optimize}">
924 <classpath refid="compile.classpath"/>
925 <include name="org/greenstone/gsdl3/SOAPServer${axis.sitename}.java" />
926 </javac>
927 <jar destfile="${build.home}/gsdl3.jar">
928 <fileset dir="${build.home}">
929 <include name="org/greenstone/gsdl3/**"/>
930 <exclude name="**/Test.class"/>
931 </fileset>
932 <manifest>
933 <attribute name="Built-By" value="${user.name}" />
934 </manifest>
935 </jar>
936 <copy file="${build.home}/gsdl3.jar" todir="${javalib}"/>
937 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
938 </target>
939
940 <target name="soap-deploy-site" depends="get-sitename,get-siteuri,create-deployment-files,restart-tomcat"
941 description="Deploy a SOAP web service for a local Greenstone site">
942 <java classname="org.apache.axis.client.AdminClient">
943 <classpath refid="compile.classpath"/>
944 <arg value="-p"/>
945 <arg value="${tomcat.port}"/>
946 <arg file="${basedir}/resources/soap/${axis.sitename}.wsdd"/>
947 </java>
948 </target>
949
950 <target name="soap-undeploy-site" depends="get-sitename"
951 description="Undeploy a SOAP web service for a local Greenstone site">
952 <java classname="org.apache.axis.client.AdminClient">
953 <classpath refid="compile.classpath"/>
954 <arg value="-p"/>
955 <arg value="${tomcat.port}"/>
956 <arg file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/>
957 </java>
958 </target>
959
960 <!-- mysql targets -->
961 <target name="startup-mysql" depends="init" if="mysql.islocal"
962 description="Startup only mysql">
963 <exec executable="${mysql.home}/bin/mysqld_safe" dir="${mysql.home}"
964 spawn="true">
965 <arg value="--user=root"/>
966 <arg value="--datadir=./data"/>
967 <arg value="--basedir=."/>
968 <arg value="--pid_file=gsdl3.pid"/>
969 <arg value="--socket=/tmp/mysql.sock"/>
970 <arg value="--err-log=./var/log/mysql.log"/>
971 </exec>
972 <sleep seconds="2"/>
973 <!-- need to test that the server has started up -->
974 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}"
975 failonerror="true" outputproperty="throw.away">
976 <arg value="--user=root"/>
977 <arg value="--execute=show databases;"/>
978 </exec>
979 <echo>MYSQL database server started successfully</echo>
980 </target>
981
982 <target name="shutdown-mysql" depends="init" if="mysql.islocal"
983 description="Shutdown only mysql">
984 <exec executable="${mysql.home}/bin/mysqladmin" dir="${mysql.home}"
985 failonerror="true">
986 <arg value="--user=root"/>
987 <arg value="--socket=/tmp/mysql.sock"/>
988 <arg value="shutdown"/>
989 </exec>
990 <echo>MYSQL database server shutdown successfully</echo>
991 </target>
992
993</project>
994
995
Note: See TracBrowser for help on using the repository browser.