source: main/trunk/greenstone3/build.xml@ 26776

Last change on this file since 26776 was 26776, checked in by davidb, 11 years ago

Changed target name 'clean-logs' to 'reset-logs'. This is to avoid running an accidental target such as 'clean', which will result in all your compiled code being wipedemacs build.xml

File size: 108.3 KB
Line 
1<?xml version="1.0"?>
2<!-- ======================================================================
3 March 2005
4
5 Greenstone3 build and install script
6
7 kjdon
8 ====================================================================== -->
9<project name="greenstone3" default="usage" basedir=".">
10 <echo>os.name: ${os.name}</echo>
11
12 <!-- ============ classpath =================== -->
13 <path id="project.classpath">
14 <fileset dir="lib/java">
15 <include name="**/*.jar"/>
16 </fileset>
17 </path>
18
19 <!-- ============ self defined tasks =================== -->
20 <taskdef name="mysetproxy" classname="org.greenstone.anttasks.MySetProxy" classpathref="project.classpath"/>
21 <taskdef name="getuserandpassword" classname="org.greenstone.anttasks.MyGetUserAndPassword" classpathref="project.classpath"/>
22 <taskdef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="project.classpath"/>
23 <!--<taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" classpathref="project.classpath"/>-->
24 <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="project.classpath"/>
25 <taskdef name="for" classname="net.sf.antcontrib.logic.ForTask" classpathref="project.classpath"/>
26 <taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpathref="project.classpath"/>
27
28
29 <!-- ===================== Property Definitions =========================== -->
30
31 <!--
32
33 Each of the following properties are used in the build script.
34 Values for these properties are set by the first place they are
35 defined, from the following list:
36
37 * Definitions on the "ant" command line (ant -Dfoo=bar compile).
38
39 * Definitions from a "build.properties" file in the top level
40 source directory of this application.
41
42 * Definitions from a "build.properties" file in the user's
43 home directory.
44
45 * Default definitions in this build.xml file.
46
47 You will note below that property values can be composed based on the
48 contents of previously defined properties. This is a powerful technique
49 that helps you minimize the number of changes required when your development
50 environment is modified. Note that property composition is allowed within
51 "build.properties" files as well as in the "build.xml" script.
52
53 -->
54
55 <!-- create build.properties if it has not been created yet -->
56 <if>
57 <bool><not><available file="build.properties"/></not></bool>
58 <copy file="build.properties.in" tofile="build.properties"/>
59 </if>
60
61 <!-- create the packages dir if it has not been created yet -->
62 <mkdir dir="packages"/>
63
64 <!--the first three properties have to be put on the top to be used by build.properties-->
65 <property name="gs2build.home" value="${basedir}${file.separator}gs2build"/>
66 <property name="src.packages.home" value="${basedir}/src/packages"/>
67 <property name="flax.svn.root" value="http://svn.greenstone.org/flax"/>
68
69 <property file="build.properties"/>
70 <if><bool><available file="${user.home}/build.properties"/></bool>
71 <property file="${user.home}/build.properties"/>
72 </if>
73
74 <!-- now we've read in properties, apply defaults -->
75 <property name="disable.collection.building" value="false"/>
76
77 <!-- get properties from the environment -->
78 <property environment="env"/>
79
80 <!-- get the filesets defining components and executables -->
81 <import file="resources/xml/components.xml"/>
82 <import file="resources/xml/executables.xml"/>
83
84 <!-- version properties for external packages -->
85 <!-- for Java versions < 1.4, we print out the message that Java is too old.
86 For Java 1.4, we use Tomcat 5.5, for Java5 and higher, we use Tomcat 7.0-->
87 <condition property="tomcat.version" value="apache-tomcat-5.5.25" else="apache-tomcat-7.0.26">
88 <equals arg1="1.4" arg2="${ant.java.version}"/>
89 </condition>
90 <condition property="tomcat.version.major" value="5" else="7">
91 <equals arg1="1.4" arg2="${ant.java.version}"/>
92 </condition>
93 <condition property="privileged.attribute" value="privileged='true'" else="">
94 <equals arg1="7" arg2="${tomcat.version.major}"/>
95 </condition>
96
97 <property name="axis.zip.version" value="axis-bin-1_4.zip"/>
98 <property name="axis.dir.version" value="axis-1_4"/>
99 <property name="sqlite.targz.version" value="sqlite-autoconf-3070602.tar.gz"/>
100
101 <property name="build.home" value="${basedir}/build"/>
102 <property name="src.home" value="${basedir}/src/java"/>
103 <property name="packages.home" value="${basedir}/packages"/>
104 <!-- this may be set in build.properties, eg if you move the web dir to
105 tomcats webapps directory -->
106 <property name="web.home" value="${basedir}/web"/>
107 <!-- jar files needed by applets go here -->
108 <property name="web.applet" value="${web.home}/applet"/>
109
110 <!-- jar files needed by the servlet (and extra ones) go here -->
111 <property name="web.lib" value="${web.home}/WEB-INF/lib"/>
112 <!-- other files needed by the servlet go here -->
113 <property name="web.classes" value="${web.home}/WEB-INF/classes"/>
114 <!--- flax: the WordNet home -->
115 <property name="wn.home" value="${web.home}/WEB-INF/classes/flax/WordNet"/>
116
117 <!-- jni libraries and java wrappers go here -->
118 <property name="lib.jni" value="${basedir}/lib/jni"/>
119
120 <!-- other jar files needed for installation (but not runtime) go here -->
121 <property name="lib.java" value="${basedir}/lib/java"/>
122
123 <property name="javadocs" value="${basedir}/docs/javadoc"/>
124
125 <property name="app.name" value="greenstone3"/>
126 <property name="app.path" value="/${app.name}"/>
127
128 <property name="admin.dir" value="${basedir}/admin"/>
129
130 <!-- defaults - set these on the command line or in build.properties or they will take these default values-->
131 <property name="app.version" value="trunk"/>
132 <property name="branch.path" value="trunk"/>
133 <property name="branch.revision" value="HEAD"/>
134
135 <!--constants -->
136 <property name="svn.root" value="http://svn.greenstone.org"/>
137
138 <!-- catalina home is set to tomcat basedir if already installed, otherwise
139 use greenstone's tomcat -->
140 <condition property="catalina.home" value="${tomcat.installed.path}" else="${packages.home}/tomcat">
141 <and>
142 <isset property="tomcat.installed.path"/>
143 <not>
144 <equals arg1="" arg2="${tomcat.installed.path}"/>
145 </not>
146 </and>
147 </condition>
148
149 <property name="os.linux" value="Linux"/>
150 <property name="os.mac" value="Mac OS X"/>
151 <property name="os.solaris" value="SunOS"/>
152 <property name="os.unix" value="${os.linux},${os.mac},${os.solaris}"/>
153 <property name="os.windows" value="Windows 95,Windows 98,Windows 2000,Windows 2003,Windows XP,Windows NT,Windows ME,Windows Vista,Windows 7"/> <!-- check this!!!-->
154
155 <!-- this is true for linux and macs -->
156 <condition property="current.os.isunix">
157 <os family="unix"/>
158 </condition>
159
160 <condition property="current.os.isunixnotmac">
161 <and>
162 <os family="unix"/>
163 <not>
164 <os family="mac"/>
165 </not>
166 </and>
167 </condition>
168
169 <condition property="current.os.ismac">
170 <os family="mac"/>
171 </condition>
172
173 <condition property="current.os.iswindows">
174 <os family="windows"/>
175 </condition>
176
177 <!-- is there a better way to do this?? what about solaris?? -->
178 <condition property="os.bin.dir" value="${cross.os}">
179 <istrue value="${compile.cross}"/>
180 </condition>
181 <condition property="os.bin.dir" value="windows">
182 <os family="windows"/>
183 </condition>
184 <condition property="os.bin.dir" value="darwin">
185 <os family="mac"/>
186 </condition>
187 <condition property="os.bin.dir" value="linux">
188 <and>
189 <os family="unix"/>
190 <not>
191 <os family="mac"/>
192 </not>
193 </and>
194 </condition>
195
196
197 <condition property="collection.building.disabled">
198 <and>
199 <isset property="disable.collection.building"/>
200 <istrue value="${disable.collection.building}"/>
201 </and>
202 </condition>
203
204 <condition property="collection.building.enabled">
205 <not>
206 <istrue value="${disable.collection.building}"/>
207 </not>
208 </condition>
209
210 <condition property="collection.building.enabled.windows">
211 <and>
212 <istrue value="${collection.building.enabled}"/>
213 <isset property="current.os.iswindows"/>
214 </and>
215 </condition>
216
217 <condition property="collection.building.enabled.unix">
218 <and>
219 <istrue value="${collection.building.enabled}"/>
220 <isset property="current.os.isunix"/>
221 </and>
222 </condition>
223
224 <condition property="static.arg" value="LDFLAGS=-static" else=" ">
225 <isset property="compile.static"/>
226 </condition>
227
228 <!-- If building a release then we want to adjust environment variables so that the support library can be see during compilation -->
229 <if><bool><isset property="use.support.lib"/></bool>
230 <property name="gnome-lib-dir" value="${basedir}/ext/gnome-lib-minimal/${os.bin.dir}"/>
231
232 <if><bool><isset property="env.CFLAGS"/></bool>
233 <property name="cflags.arg" value="CFLAGS=&quot;-I${gnome-lib-dir}/include ${env.CFLAGS}&quot;"/>
234 <else>
235 <property name="cflags.arg" value="CFLAGS=&quot;-I${gnome-lib-dir}/include&quot;"/>
236 </else>
237 </if>
238
239 <if><bool><isset property="env.CPPFLAGS"/></bool>
240 <property name="cppflags.arg" value="CPPFLAGS=&quot;-I${gnome-lib-dir}/include ${env.CPPFLAGS}&quot;"/>
241 <else>
242 <property name="cppflags.arg" value="CPPFLAGS=&quot;-I${gnome-lib-dir}/include&quot;"/>
243 </else>
244 </if>
245
246 <if><bool><isset property="env.CXXFLAGS"/></bool>
247 <property name="cxxflags.arg" value="CXXFLAGS=&quot;-I${gnome-lib-dir}/include ${env.CXXFLAGS}&quot;"/>
248 <else>
249 <property name="cxxflags.arg" value="CXXFLAGS=&quot;-I${gnome-lib-dir}/include&quot;"/>
250 </else>
251 </if>
252
253 <if><bool><isset property="env.LDFLAGS"/></bool>
254 <property name="ldflags.arg" value="LDFLAGS=&quot;-L${gnome-lib-dir}/lib ${env.LDFLAGS}&quot;"/>
255 <else>
256 <property name="ldflags.arg" value="LDFLAGS=&quot;-L${gnome-lib-dir}/lib&quot;"/>
257 </else>
258 </if>
259
260 <if><bool><isset property="env.PATH"/></bool>
261 <property name="path.arg" value="PATH=&quot;${gnome-lib-dir}/bin:${env.PATH}&quot;"/>
262 <else>
263 <property name="path.arg" value="PATH=&quot;${gnome-lib-dir}/bin&quot;"/>
264 </else>
265 </if>
266
267 <if><bool><isset property="env.PKG_CONFIG_PATH"/></bool>
268 <property name="pcpath.arg" value="PKG_CONFIG_PATH=&quot;${gnome-lib-dir}/lib/pkgconfig:${env.PKG_CONFIG_PATH}&quot;"/>
269 <else>
270 <property name="pcpath.arg" value="PKG_CONFIG_PATH=&quot;${gnome-lib-dir}/lib/pkgconfig&quot;"/>
271 </else>
272 </if>
273
274 <if><bool><equals arg1="${os.bin.dir}" arg2="darwin"/></bool>
275 <if><bool><isset property="env.DYLD_LIBRARY_PATH"/></bool>
276 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib:${env.DYLD_LIBRARY_PATH}&quot;"/>
277 <else>
278 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib&quot;"/>
279 </else>
280 </if>
281 <else>
282 <if><bool><isset property="env.LD_LIBRARY_PATH"/></bool>
283 <property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib:${env.LD_LIBRARY_PATH}&quot;"/>
284 <else>
285 <property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${gnome-lib-dir}/lib&quot;"/>
286 </else>
287 </if>
288 </else>
289 </if>
290
291 <else>
292 <if><bool><isset property="env.CFLAGS"/></bool>
293 <property name="cflags.arg" value="CFLAGS=&quot;${env.CFLAGS}&quot;"/>
294 <else>
295 <property name="cflags.arg" value=" "/>
296 </else>
297 </if>
298
299 <if><bool><isset property="env.CPPFLAGS"/></bool>
300 <property name="cppflags.arg" value="CPPFLAGS=&quot;${env.CPPFLAGS}&quot;"/>
301 <else>
302 <property name="cppflags.arg" value=" "/>
303 </else>
304 </if>
305
306 <if><bool><isset property="env.CXXFLAGS"/></bool>
307 <property name="cxxflags.arg" value="CXXFLAGS=&quot;${env.CXXFLAGS}&quot;"/>
308 <else>
309 <property name="cxxflags.arg" value=" "/>
310 </else>
311 </if>
312
313 <if><bool><isset property="env.LDFLAGS"/></bool>
314 <property name="ldflags.arg" value="LDFLAGS=&quot;${env.LDFLAGS}&quot;"/>
315 <else>
316 <property name="ldflags.arg" value=" "/>
317 </else>
318 </if>
319
320 <if><bool><isset property="env.PATH"/></bool>
321 <property name="path.arg" value="PATH=&quot;${env.PATH}&quot;"/>
322 <else>
323 <property name="path.arg" value=" "/>
324 </else>
325 </if>
326
327 <if><bool><isset property="env.PKG_CONFIG_PATH"/></bool>
328 <property name="pcpath.arg" value="PKG_CONFIG_PATH=&quot;${env.PKG_CONFIG_PATH}&quot;"/>
329 <else>
330 <property name="pcpath.arg" value=" "/>
331 </else>
332 </if>
333
334 <if><bool><equals arg1="${os.bin.dir}" arg2="darwin"/></bool>
335 <if><bool><isset property="env.DYLD_LIBRARY_PATH"/></bool>
336 <property name="ldlpath.arg" value="DYLD_LIBRARY_PATH=&quot;${env.DYLD_LIBRARY_PATH}&quot;"/>
337 <else>
338 <property name="ldlpath.arg" value=" "/>
339 </else>
340 </if>
341 <else>
342 <if><bool><isset property="env.LD_LIBRARY_PATH"/></bool>
343 <property name="ldlpath.arg" value="LD_LIBRARY_PATH=&quot;${env.LD_LIBRARY_PATH}&quot;"/>
344 <else>
345 <property name="ldlpath.arg" value=" "/>
346 </else>
347 </if>
348 </else>
349 </if>
350 </else>
351 </if>
352 <property name="allargs" value="${cflags.arg} ${cxxflags.arg} ${cppflags.arg} ${ldflags.arg} ${path.arg} ${ldlpath.arg} ${pcpath.arg}"/>
353
354 <condition property="opt.cross.build"
355 value="--build=${cross.build}" else=" ">
356 <isset property="cross.build"/>
357 </condition>
358
359
360 <condition property="cross.configure.args"
361 value="--host=${cross.host} ${opt.cross.build} CPP=${cross.host}-cpp CC=${cross.host}-gcc CXX=${cross.host}-g++ LD=${cross.host}-ld AR=${cross.host}-ar RANLIB=${cross.host}-ranlib ${cross.configure.extraargs} crossOS=${cross.os}" else=" ">
362 <istrue value="${compile.cross}"/>
363 </condition>
364
365
366 <condition property="gs2.opt.args" value= " " else="--disable-mg --disable-mgpp --disable-accentfold --disable-gdbm --disable-sqlite">
367 <istrue value="${with.jni}"/>
368 </condition>
369 <condition property="gs2.compile.target" value="with-jni" else="without-jni">
370 <istrue value="${with.jni}"/>
371 </condition>
372 <condition property="gs2.install.target" value="install-with-jni" else="install-without-jni">
373 <istrue value="${with.jni}"/>
374 </condition>
375 <condition property="gs2.windows.enablejni" value="1" else="0">
376 <istrue value="${with.jni}"/>
377 </condition>
378 <condition property="gs2.windows.enablemg" value="1" else="0">
379 <istrue value="${with.jni}"/>
380 </condition>
381 <condition property="gs2.windows.enablemgpp" value="1" else="0">
382 <istrue value="${with.jni}"/>
383 </condition>
384 <!-- Should accent folding not also be set here ?? -->
385 <condition property="gs2.windows.usegdbm" value="1" else="0">
386 <istrue value="${with.jni}"/>
387 </condition>
388 <condition property="gs2.windows.usesqlite" value="1" else="0">
389 <istrue value="${with.jni}"/>
390 </condition>
391
392 <!-- where is search4j tool -->
393 <condition property="search4j.exec" value="bin/search4j.exe" else="bin/search4j">
394 <isset property="current.os.iswindows"/>
395 </condition>
396
397
398 <!-- ============= Base dirs for each package and component ============ -->
399 <property name="src.gsdl3.home" value="${src.home}/org/greenstone/gsdl3"/>
400 <property name="anttasks.home" value="${src.home}/org/greenstone/anttasks"/>
401 <property name="gli.home" value="${basedir}/gli"/>
402 <property name="javagdbm.home" value="${src.packages.home}/javagdbm"/>
403
404 <condition property="common.src.home" value="${basedir}/common-src" else="${gs2build.home}${file.separator}common-src">
405 <istrue value="${disable.collection.building}"/>
406 </condition>
407
408 <property name="build.src.home" value="${gs2build.home}/build-src"/>
409 <property name="gdbm.home" value="${common.src.home}/packages/gdbm"/>
410 <property name="mg.home" value="${common.src.home}/indexers/mg"/>
411 <property name="mgpp.home" value="${common.src.home}/indexers/mgpp"/>
412 <property name="lucene.home" value="${common.src.home}/indexers/lucene-gs"/>
413
414 <!-- ==================== Compilation Control Options ==================== -->
415
416 <!--
417
418 These properties control option settings on the Javac compiler when it
419 is invoked using the <javac> task.
420
421 compile.debug Should compilation include the debug option?
422
423 compile.deprecation Should compilation include the deprecation option?
424
425 compile.optimize Should compilation include the optimize option?
426
427 -->
428
429 <property name="compile.debug" value="true"/>
430 <property name="compile.deprecation" value="true"/>
431 <property name="compile.optimize" value="true"/>
432
433 <!--
434
435 Rather than relying on the CLASSPATH environment variable, Ant includes
436 features that makes it easy to dynamically construct the classpath you
437 need for each compilation. The example below constructs the compile
438 classpath to include the servlet.jar file, as well as the other components
439 that Tomcat makes available to web applications automatically, plus anything
440 that you explicitly added.
441
442 -->
443
444 <!-- All elements that Tomcat 5 exposes to applications -->
445 <path id="tomcat5">
446 <pathelement location="${catalina.home}/common/classes"/>
447 <fileset dir="${catalina.home}/common/endorsed">
448 <include name="*.jar"/>
449 </fileset>
450 <fileset dir="${catalina.home}/common/lib">
451 <include name="*.jar"/>
452 </fileset>
453 <!-- seems to be empty, but will leave in just in case some people make use of this to customise their install: -->
454 <pathelement location="${catalina.home}/shared/classes"/>
455 <fileset dir="${catalina.home}/shared/lib">
456 <include name="*.jar"/>
457 </fileset>
458 </path>
459
460 <!-- All elements that Tomcat 7 exposes to applications -->
461 <path id="tomcat7">
462 <fileset dir="${catalina.home}/lib">
463 <include name="*.jar"/>
464 </fileset>
465 </path>
466
467 <path id="compile.classpath">
468 <!-- Include all jar files and libraries in our jni lib directory -->
469 <pathelement location="${lib.jni}"/>
470 <fileset dir="${lib.jni}">
471 <include name="*.jar"/>
472 </fileset>
473 <!-- Include all jar files in our web lib directory -->
474 <pathelement location="${web.lib}"/>
475 <fileset dir="${web.lib}">
476 <include name="*.jar"/>
477 </fileset>
478
479 <pathelement location="${lib.java}"/>
480 <fileset dir="${lib.java}">
481 <include name="*.jar"/>
482 </fileset>
483
484 <!-- include the jar files from the source packages -->
485 <!-- mg and mgpp get installed into lib/jni but they may not be there yet
486 so we add them in by name -->
487 <!-- *** is there any way to make this optional, based on ${with.jni}? -->
488 <pathelement location="${lib.jni}/mg.jar"/>
489 <pathelement location="${lib.jni}/mgpp.jar"/>
490
491 <!-- Include all elements that Tomcat exposes to applications -->
492 <path refid="tomcat${tomcat.version.major}"/>
493
494 </path>
495
496 <path id="local.tomcat.classpath">
497 <!-- explicitly include the jni java wrappers in the classpath -->
498 <pathelement location="${lib.jni}"/>
499 <fileset dir="${lib.jni}">
500 <include name="*.jar"/>
501 </fileset>
502
503 <pathelement location="${web.lib}"/>
504 <fileset dir="${web.lib}">
505 <include name="derby.jar"/>
506 </fileset>
507 </path>
508
509 <path id="local.tomcat.path">
510 <pathelement location="${basedir}/bin/script"/>
511 <pathelement location="${basedir}/bin"/>
512 <pathelement location="${lib.jni}"/>
513 <pathelement path="${env.PATH}"/>
514 <pathelement path="${env.Path}"/>
515 <pathelement path="${wn.home}/bin"/>
516 </path>
517
518 <target name="test-setup">
519 <echo>ant java version=${ant.java.version}</echo>
520 <echo>is unix : ${current.os.isunix}</echo>
521 <echo>is mac : ${current.os.ismac}</echo>
522 <echo>is unixnotmac : ${current.os.isunixnotmac}</echo>
523 <echo>is windows : ${current.os.iswindows}</echo>
524 <echo>os.unix: ${os.unix}</echo>
525 </target>
526
527 <!-- ==================== Primary and Global Targets ============================= -->
528
529 <target name="prepare" depends="accept-properties,init,prepare-core,prepare-packages,prepare-common-src,prepare-collection-building,prepare-tomcat,prepare-axis,prepare-web,prepare-collections, prepare-flax"
530 description="Use this when you first checkout the code: 'ant prepare install'. This will do some additional subversion checkouts and downloads, so you need to be online to run this.">
531
532 <!-- make sure .sh files are executable -->
533 <chmod dir="${basedir}" perm="ugo+rx"
534 includes="*.sh"/>
535 <chmod dir="${basedir}/bin/script" perm="ugo+rx"
536 includes="*.sh,*.pl"/>
537 </target>
538
539 <!-- install-common-src and install-collection-building are mutually exclusive and either one or the other will be done depending on whether collection building is enabled or not -->
540 <target name="install" depends="init,install-common-src,install-collection-building,install-runtime"
541 description="Install Greenstone 3. Use this when you first checkout the code: 'ant prepare new-install'."/>
542
543 <target name="install-common-src" depends="init"
544 description="Install (configure, compile, install) only the common-src package (shared code from Greenstone 2). " >
545 <antcall target="configure-common-src"/>
546 <antcall target="compile-common-src"/>
547 <antcall target="install-auxiliary-jar-files"/>
548 <antcall target="install-jni-files"/>
549 </target>
550
551 <target name="install-collection-building" depends="init" if="collection.building.enabled"
552 description="Install (configure, compile, install) the Greenstone 2 collection building package." >
553 <antcall target="configure-collection-building"/>
554 <antcall target="tweak-makefiles" />
555 <antcall target="compile-collection-building"/>
556 </target>
557
558
559 <target name="install-runtime" depends="init,configure,configure-packages,configure-core,compile-web,compile-packages,compile-core,compile-classpath-jars"
560 description="Install (configure, compile, install) the runtime system. Needs either common-src or collection-building to have been installed first." />
561
562 <target name="svnupdate" depends="init,svnupdate-packages,svnupdate-core,svnupdate-common-src,svnupdate-collection-building,svnupdate-web"
563 description="Do a `svn update` for all sources. Doesn't recompile the code. You need to be online to run this."/>
564
565 <target name="configure" depends="init,configure-tomcat,configure-web"
566 description="Configure the installation (not the C++ code). Includes setting up config files. Should be re-run if you change the build.properties file, including if you change the port number."/>
567
568 <target name="clean" depends="init,clean-packages,clean-core,clean-common-src,clean-collection-building,clean-classpath-jars"
569 description="Remove all old compiled code. Includes runtime and collection-building if necessary"/>
570
571 <target name="distclean" depends="init,distclean-packages,clean-core,distclean-common-src,distclean-collection-building,clean-classpath-jars"
572 description="Remove all compiled code and also any Makefiles etc generated during configure-c++. Includes runtime and collection-building as necessary"/>
573
574 <target name="update" depends="init,svnupdate,clean,install"
575 description="Update (thru Subversion) all the source (including common-src or collection-building, and runtime), then clean, and re-install. To do this without any SVN updates, run it like 'ant -Dnosvn.mode=yes update'"/>
576
577
578 <target name="perl-for-building" depends="init">
579 <!-- uses perl.path if set in build.properties, otherwise try for
580 environment variable PERLPATH, and failing that assumes 'perl'
581 is on environment PATH -->
582 <!-- if, outside build.properties, we only set perl.path if we have gs2build/build-src (collection building), then we won't set perl.path in a (flax) binary, since it doesn't have build-src -->
583 <if><bool><available file="${gs2build.home}"/></bool>
584
585 <if><bool><not><isset property="perl.path"/></not></bool>
586
587 <if>
588 <bool>
589 <and>
590 <isset property="env.PERLPATH"/>
591 <not><equals arg1="${env.PERLPATH}" arg2=""/></not>
592 </and>
593 </bool>
594 <property name="perl.path" value="${env.PERLPATH}"/>
595 <else>
596 <echo>
597 Using PATH environment variable to locate Perl.
598 </echo>
599 <exec executable="which" os="${os.unix}" spawn="false" outputproperty="full.perl.path">
600 <arg value="perl" />
601 </exec>
602
603 <exec executable="${gs2build.home}/bin/windows/which" os="${os.windows}" spawn="false" outputproperty="full.perl.path">
604 <arg value="perl" />
605 </exec>
606
607 <stringutil string="${full.perl.path}" property="partial.perl.path">
608 <replace regex="\/[^\/]*$" replacement="/" />
609 </stringutil>
610 <stringutil string="${partial.perl.path}" property="perl.path">
611 <replace regex="\\[^\\]*$" replacement="\\" />
612 </stringutil>
613 <if><bool><istrue value="${current.os.isunix}"/></bool>
614
615 <if><bool><not><equals arg1="${full.perl.path}" arg2="/usr/bin/perl"/></not></bool>
616 <echo>
617 Non-standard location of Perl found: ${full.perl.path}
618 Set the environment variable PERLPATH or the perl.path property in
619 build.properties to explicitly control the version of Perl used.
620 </echo>
621 </if>
622 </if>
623 </else>
624 </if>
625 </if>
626
627 <!-- full.perl.path is for pretty-printing only, e.g. used in target "start" -->
628 <if><bool><isset property="perl.path"/></bool>
629 <property name="full.perl.path" value="${perl.path}${file.separator}perl"/>
630 <else>
631 <property name="full.perl.path" value="perl (will use the enviroment variable PATH to find this executable)"/>
632 </else>
633 </if>
634
635 <!-- gs2build not available, perl.path -->
636 <else>
637 <property name="perl.path" value=""/>
638 </else>
639 </if>
640 </target>
641
642 <target name="get-default-servlet-url">
643 <echo>http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet}</echo>
644 </target>
645
646 <target name="start" depends="init,configure-web,start-tomcat"
647 description="Startup the Tomcat server." >
648 <echo>${app.name} (${app.version}) server running using Apache Tomcat and Java</echo>
649 <echo>Tomcat: ${catalina.home}</echo>
650 <echo>Java : ${java.home}</echo>
651 <if><bool><available file="${build.src.home}"/></bool>
652 <echo>Perl : ${full.perl.path}</echo>
653 </if>
654 <if><bool><isset property="install.flax"/></bool>
655 <property name="url" value="http://${tomcat.server}:${tomcat.port}${app.path}/flax"/>
656 <else>
657 <property name="url" value="http://${tomcat.server}:${tomcat.port}${app.path}/"/>
658 </else>
659 </if>
660 <echo>URL : ${url}</echo>
661 <!-- assuming that index.html is not needed here -->
662
663 <!--Now write out the url with oaiserver suffix as the baseURL property in OAIConfig.xml-->
664 <available file="${web.classes}/OAIConfig.xml" property="oaiconfig.present"/>
665 <antcall target="init-oaiconfig">
666 <param name="url" value="${url}"/>
667 </antcall>
668 </target>
669
670 <target name="init-oaiconfig" if="oaiconfig.present">
671 <echo>Writing out baseURL ${url}oaiserver to ${web.classes}/OAIConfig.xml</echo>
672 <rsr file="${web.classes}/OAIConfig.xml" pattern="&lt;baseURL&gt;.*&lt;/baseURL&gt;" replacement="&lt;baseURL&gt;${url}oaiserver&lt;/baseURL&gt;" />
673 </target>
674
675 <target name="stop" depends="init,stop-tomcat"
676 description="Shutdown the Tomcat server."/>
677
678 <target name="restart" description="Shutdown and restart Tomcat" depends="init,stop,start"/>
679
680
681 <!-- =========== Help targets =================================== -->
682
683 <property name="install-command" value="ant [options] prepare install"/>
684
685 <target name="usage" description="Print a help message">
686 <echo message=" Execute 'ant -projecthelp' for a list of targets."/>
687 <echo message=" Execute 'ant -help' for Ant help."/>
688 <echo>
689 To install Greenstone3, run '${install-command}'.
690 There are properties defined in build.properties. The install
691 process will ask you if these properties are set correctly.
692 To avoid this prompt, use the '-Dproperties.accepted=yes'
693 option.
694 To log the output, use the '-logfile build.log' option.
695 The README.txt file has more information about the ant targets
696 and install process.
697 </echo>
698 </target>
699
700 <target name="help" depends="usage" description="Print a help message"/>
701
702 <target name="debug" depends="init" description="Display all the currently used properties">
703 <echoproperties/>
704 </target>
705
706 <!-- ====== initialization and setup targets ================== -->
707
708 <target name="accept-properties" unless="properties.accepted">
709 <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory:
710 tomcat.server=${tomcat.server}
711 tomcat.port=${tomcat.port}
712 tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed)
713 proxy.host=${proxy.host}
714 proxy.port=${proxy.port}
715 disable.collection.building=${disable.collection.building}
716 If these are not acceptable, please change them and rerun this target. Continue [y/n]?
717 </input>
718 <condition property="do.abort">
719 <equals arg1="n" arg2="${properties.ok}"/>
720 </condition>
721 <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail>
722 </target>
723
724 <!-- this sets up some initial properties -->
725 <target name="init">
726
727 <!-- has the gs3-setup script been run?? -->
728 <condition property="gs3-setup-not-done">
729 <not>
730 <isset property="env.GSDL3HOME"/>
731 </not>
732 </condition>
733
734 <!--<fail if="gs3-setup-not-done" message="please run 'gs3-setup' (Windows) or 'source gs3-setup.sh' (Linux/Mac) before running this target."/>-->
735
736 <condition property="java.too.old">
737 <or>
738 <equals arg1="1.1" arg2="${ant.java.version}"/>
739 <equals arg1="1.2" arg2="${ant.java.version}"/>
740 <equals arg1="1.3" arg2="${ant.java.version}"/>
741 </or>
742 </condition>
743 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/>
744
745 <available file="${basedir}/gli" property="gli.present"/>
746 <available file="${basedir}/common-src" property="common.src.present"/>
747 <available file="${basedir}/gs2build" property="gs2build.present"/>
748
749 <condition property="tomcat.islocal">
750 <or>
751 <not><isset property="tomcat.installed.path"/></not>
752 <equals arg1="" arg2="${tomcat.installed.path}"/>
753 </or>
754 </condition>
755
756 <echo>tomcat.port = ${tomcat.port}</echo>
757
758 <condition property="proxy.present">
759 <and>
760 <isset property="proxy.host"/>
761 <not><equals arg1="" arg2="${proxy.host}"/></not>
762 </and>
763 </condition>
764
765 <!--
766 the next block checks if the bundled tomcat is present in the 'packages' directory,
767 and checks for the lethal combination of tomcat 7 and java 1.4. Test for
768 tomcat6 is based on the presence of a file inserted by greenstone into the tomcat6
769 download, as there is no other surefire way to check tomcat version under java 1.4
770 -->
771 <condition property="packages.tomcat.ispresent" value="true" else="false">
772 <available file="packages/tomcat"/>
773 </condition>
774 <condition property="packages.tomcat.istomcat7" value="true" else="false">
775 <available file="packages/tomcat/tomcat7.txt"/>
776 </condition>
777 <if>
778 <bool>
779 <and>
780 <istrue value="${packages.tomcat.ispresent}"/>
781 <istrue value="${packages.tomcat.istomcat7}"/>
782 <equals arg1="1.4" arg2="${ant.java.version}"/>
783 </and>
784 </bool>
785 <fail>Your Java (version 1.4) is too old to work with the bundled Apache Tomcat (version 6). Please upgrade to Java version 1.5 or greater. Alternatively, you may remove the bundled Apache Tomcat from the 'packages' folder and then run 'ant prepare-tomcat'.</fail>
786 </if>
787
788 </target>
789
790 <target name="setup-proxy" depends="init" if="proxy.present">
791 <condition property="ask.user">
792 <or>
793 <equals arg1="" arg2="${proxy.user}"/>
794 <equals arg1="" arg2="${proxy.password}"/>
795 </or>
796 </condition>
797
798 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}" userproperty="proxy.username" pwordproperty="proxy.password"/>
799 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
800 </target>
801
802 <!-- ========== Web app Targets ================================ -->
803
804 <target name="prepare-web" depends="init">
805 <mkdir dir="${web.home}/applet"/>
806 <mkdir dir="${web.home}/logs"/>
807 <mkdir dir="${web.home}/logs/tmp"/>
808 </target>
809
810 <!-- if we are using java 1.5+, we need the xalan.jar file in web/WEB-INF/lib, but if we are using java 1.4, we can't have it there.
811 The test for whether we need it assumes we won't be trying to compile GS3 against Java versions less than 1.4. -->
812 <target name="configure-java-version" depends="init"
813 description="Activates or deactivates some jar libraries as needed depending on your java version">
814
815 <available property="have.xalan.jar" file="${web.lib}/xalan.jar"/>
816 <condition property="need.xalan.jar">
817 <or>
818 <not><equals arg1="1.4" arg2="${ant.java.version}"/></not>
819 </or>
820 </condition>
821
822 <!-- if they have xalan.jar but dont need it -->
823 <if>
824 <bool>
825 <and>
826 <isset property="have.xalan.jar"/>
827 <not><isset property="need.xalan.jar"/></not>
828 </and>
829 </bool>
830 <antcall target="deactivate-xalan-jar"/>
831 </if>
832
833 <!-- if they need xalan.jar but dont have it -->
834 <if>
835 <bool>
836 <and>
837 <not><isset property="have.xalan.jar"/></not>
838 <isset property="need.xalan.jar"/>
839 </and>
840 </bool>
841 <antcall target="activate-xalan-jar"/>
842 </if>
843
844 </target>
845
846 <target name="activate-xalan-jar">
847 <echo>activating xalan.jar</echo>
848 <copy file="${web.lib}/xalan.jar.tmp" tofile="${web.lib}/xalan.jar"/>
849 <if>
850 <bool>
851 <and>
852 <isset property="current.os.ismac"/>
853 <available file="${catalina.home}/common/endorsed" type="dir"/>
854 </and>
855 </bool>
856 <copy file="${web.lib}/xalan.jar.tmp" tofile="${catalina.home}/common/endorsed/xalan.jar"/>
857 </if>
858 </target>
859
860 <target name="deactivate-xalan-jar">
861 <echo>deactivating xalan.jar</echo>
862 <delete file="${web.lib}/xalan.jar"/>
863 <!-- should we be deleting common/endorsed/xalan.jar on mac?? -->
864 </target>
865
866
867 <target name="prepare-collections" depends="init"
868 description="Unpack all the collections from their svn zipped versions">
869 <property name="collect.dir" value="${web.home}/sites/localsite/collect"/>
870 <property name="index.zip" value="index.zip"/>
871
872 <echo message="installing collections..."/>
873 <antcall target="gs2mgdemo-install"/>
874 <antcall target="gs2mgppdemo-install"/>
875 <antcall target="gberg-install"/>
876 <antcall target="lucene-jdbm-demo-install"/>
877 </target>
878
879 <target name="gs2mgdemo-prepare" if="collect.dir">
880 <property name="gs2mgdemo.dir" value="${collect.dir}/gs2mgdemo"/>
881
882 <condition property="gs2mgdemo.present">
883 <and>
884 <available file="${gs2mgdemo.dir}/${index.zip}"/>
885 </and>
886 </condition>
887 </target>
888
889 <target name="gs2mgdemo-install" if="gs2mgdemo.present" depends="gs2mgdemo-prepare">
890 <unzip dest="${gs2mgdemo.dir}" src="${gs2mgdemo.dir}/${index.zip}" />
891 <echo>collection gs2mgdemo installed</echo>
892 </target>
893
894 <target name="gs2mgppdemo-prepare" if="collect.dir">
895 <property name="gs2mgppdemo.dir" value="${collect.dir}/gs2mgppdemo"/>
896
897 <condition property="gs2mgppdemo.present">
898 <and>
899 <available file="${gs2mgppdemo.dir}/${index.zip}"/>
900 </and>
901 </condition>
902 </target>
903
904 <target name="gs2mgppdemo-install" if="gs2mgppdemo.present" depends="gs2mgppdemo-prepare">
905 <unzip dest="${gs2mgppdemo.dir}" src="${gs2mgppdemo.dir}/${index.zip}" />
906 <echo>collection gs2mgppdemo installed</echo>
907 </target>
908
909 <target name="gberg-prepare" if="collect.dir">
910 <property name="gberg.dir" value="${collect.dir}/gberg"/>
911 <available file="${gberg.dir}/index/${index.zip}" property="gberg.present"/>
912 </target>
913
914 <target name="gberg-install" if="gberg.present" depends="gberg-prepare">
915 <unzip dest="${gberg.dir}/index" src="${gberg.dir}/index/${index.zip}"/>
916 <echo>collection gberg installed</echo>
917 </target>
918
919 <target name="lucene-jdbm-demo-prepare" if="collect.dir">
920 <property name="lucene-jdbm-demo.dir" value="${collect.dir}/lucene-jdbm-demo"/>
921 <available file="${lucene-jdbm-demo.dir}/${index.zip}" property="lucene-jdbm-demo.present"/>
922 </target>
923
924 <target name="lucene-jdbm-demo-install" if="lucene-jdbm-demo.present" depends="lucene-jdbm-demo-prepare">
925 <unzip dest="${lucene-jdbm-demo.dir}" src="${lucene-jdbm-demo.dir}/${index.zip}"/>
926 <echo>collection lucene-jdbm-demo installed</echo>
927 </target>
928
929 <target name="configure-web" depends="init,perl-for-building"
930 description="Configure only the web app config files">
931 <!-- we want a unix path in the global.properties file -->
932 <pathconvert targetos="unix" property="src.gsdl3.home.unix">
933 <path path="${web.home}"/>
934 </pathconvert>
935 <stringutil string="${perl.path}" property="escaped.perl.path">
936 <replace regex="\\" replacement="\\\\" />
937 </stringutil>
938
939 <filter token="gsdlhome" value="${gs2build.home}"/>
940 <filter token="gsdl3srchome" value="${basedir}"/>
941 <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
942 <filter token="gsdl3version" value="${app.version}"/>
943 <filter token="tomcat.server" value="${tomcat.server}"/>
944 <filter token="tomcat.port" value="${tomcat.port}"/>
945 <filter token="perlpath" value="${escaped.perl.path}"/>
946 <filter token="disable.collection.building" value="${disable.collection.building}"/>
947 <copy file="${basedir}/web/WEB-INF/cgi/gsdl3site.cfg.in" tofile="${basedir}/web/WEB-INF/cgi/gsdl3site.cfg" filtering="true" overwrite="true"/>
948 <copy file="${basedir}/resources/java/global.properties.in" tofile="${web.classes}/global.properties" filtering="true" overwrite="true"/>
949 <copy file="${basedir}/resources/java/log4j.properties.in" tofile="${web.classes}/log4j.properties" filtering="true" overwrite="true"/>
950 <chmod file="${web.classes}/global.properties" perm="600"/>
951 <chmod file="${web.classes}/log4j.properties" perm="600"/>
952 </target>
953
954 <target name="compile-web" depends="init">
955 <javac srcdir="${web.classes}"
956 destdir="${web.classes}"
957 debug="${compile.debug}"
958 deprecation="${compile.deprecation}"
959 optimize="${compile.optimize}">
960 <classpath><path refid="compile.classpath"/></classpath>
961 </javac>
962 </target>
963
964 <target name="compile-classpath-jars" depends="init">
965 <if><bool><available file="admin/cp.mf"/></bool>
966 <jar destfile="admin/cp.jar" manifest="admin/cp.mf"/>
967 </if>
968 <if><bool><available file="${lib.java}/cp.mf"/></bool>
969 <jar destfile="${lib.java}/cp.jar" manifest="${lib.java}/cp.mf"/>
970 </if>
971 <if><bool><available file="${lib.jni}/cp.mf"/></bool>
972 <jar destfile="${lib.jni}/cp.jar" manifest="${lib.jni}/cp.mf"/>
973 </if>
974 <if><bool><available file="${web.lib}/cp.mf"/></bool>
975 <jar destfile="${web.lib}/cp.jar" manifest="${web.lib}/cp.mf"/>
976 </if>
977 <jar destfile="cp.jar">
978 <manifest>
979 <attribute name="Class-Path" value="server.jar admin/cp.jar lib/java/cp.jar lib/jni/cp.jar web/WEB-INF/lib/cp.jar"/>
980 </manifest>
981 </jar>
982 </target>
983
984 <target name="clean-classpath-jars" depends="init">
985 <delete file="admin/cp.jar"/>
986 <delete file="${lib.java}/cp.jar"/>
987 <delete file="${lib.jni}/cp.jar"/>
988 <delete file="${web.lib}/cp.jar"/>
989 <delete file="cp.jar"/>
990 </target>
991
992
993 <target name="svnupdate-web" unless="nosvn.mode">
994 <exec executable="svn">
995 <arg value="update"/>
996 <arg value="${web.home}"/>
997 <arg value="-r"/><arg value="${branch.revision}"/>
998 </exec>
999 </target>
1000
1001 <target name="update-web" depends="init,svnupdate-web,configure-web"
1002 description="update only the web stuff (config files)"/>
1003
1004 <!-- ======================= Tomcat Targets ========================== -->
1005
1006 <!-- this target downloads and installs Tomcat -->
1007 <!-- we download tomcat (version 7 for Java 1.5 and later, version 5 for Java 1.4 plus the 1.4 compatibility package). -->
1008 <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal"
1009 description="downloads the appropriate version of Tomcat (Tomcat 5 if using Java 1.4, Tomcat 7 if using Java 1.5 or higher). If you want to change which version of Java you are using between 1.4 and 1.5/7 then you need to run prepare-tomcat">
1010 <if>
1011 <bool>
1012 <not><available file="${packages.home}/tomcat/.flagfile"/></not>
1013 </bool>
1014
1015 <!-- check that packages dir is there -->
1016 <mkdir dir="${packages.home}"/>
1017 <get src="http://www.greenstone.org/gs3files/${tomcat.version}.zip"
1018 dest="${packages.home}/${tomcat.version}.zip"
1019 usetimestamp="true"/>
1020 <unzip src="${packages.home}/${tomcat.version}.zip"
1021 dest="${packages.home}"/>
1022
1023 <!-- If we are using Java 1.4, we'd be using tomcat 5.5 in which case
1024 we would need to have the tomcat compat package to work with Java 1.4-->
1025 <if>
1026 <bool><equals arg1="1.4" arg2="${ant.java.version}"/></bool>
1027 <get src="http://www.greenstone.org/gs3files/${tomcat.version}-compat.zip"
1028 dest="${packages.home}/${tomcat.version}-compat.zip"
1029 usetimestamp="true"/>
1030 <unzip src="${packages.home}/${tomcat.version}-compat.zip"
1031 dest="${packages.home}"/>
1032 </if>
1033
1034 <!-- delete any existing tomcat -->
1035 <delete dir="${packages.home}/tomcat"/>
1036 <move todir="${packages.home}/tomcat">
1037 <fileset dir="${packages.home}/${tomcat.version}"/>
1038 </move>
1039 <!--
1040 <copy file="${basedir}/resources/tomcat/setclasspath.bat"
1041 tofile="${packages.home}/tomcat/bin/setclasspath.bat"
1042 overwrite="true"/>
1043 <copy file="${basedir}/resources/tomcat/setclasspath.sh"
1044 tofile="${packages.home}/tomcat/bin/setclasspath.sh"
1045 overwrite="true"/>
1046 -->
1047 <!-- make sure we have execute permission for the .sh files -->
1048 <chmod dir="${packages.home}/tomcat/bin" perm="ugo+rx"
1049 includes="*.sh"/>
1050
1051 <echo file="${packages.home}/tomcat/.flagfile">
1052 the timestamp of this file is the time that tomcat was extracted from the zip files.
1053 it is used to figure out whether the files need to be refreshed or not in `ant prepare-tomcat`
1054 </echo>
1055
1056 <!-- this is not strictly a prepare tomcat thing, but if one changes
1057 Java, then they need to change tomcat as well, so might as well call
1058 it here -->
1059 <antcall target="configure-java-version"/>
1060 <else>
1061 <echo>Tomcat has been prepared, will not prepare</echo>
1062 <echo>Delete ${packages.home}/tomcat/.flagfile to force refresh</echo>
1063 </else>
1064
1065 </if>
1066
1067 </target>
1068
1069 <target name="configure-tomcat" depends="init,configure-tomcat-local,configure-tomcat-external"/>
1070
1071 <target name="configure-tomcat-local" depends="init,perl-for-building" if="tomcat.islocal">
1072 <!-- re-setup the server.xml file -->
1073 <copy file="${basedir}/resources/tomcat/server_tomcat${tomcat.version.major}.xml"
1074 tofile="${packages.home}/tomcat/conf/server.xml" overwrite="true">
1075 <filterset>
1076 <filter token="port" value="${tomcat.port}"/>
1077 <filter token="shutdown-port" value="${tomcat.shutdown.port}"/>
1078 </filterset>
1079 </copy>
1080 <!-- set up the greenstone3 context -->
1081 <copy file="${basedir}/resources/tomcat/greenstone3.xml" tofile="${packages.home}/tomcat/conf/Catalina/localhost/greenstone3.xml" overwrite="true">
1082 <filterset>
1083 <filter token="gsdl3webhome" value="${web.home}"/>
1084 <filter token="privilegedattribute" value ="${privileged.attribute}"/>
1085 </filterset>
1086 </copy>
1087
1088 <!-- set up the greenstone3 web.xml file -->
1089 <copy file="${basedir}/resources/tomcat/web.xml" tofile="${packages.home}/tomcat/conf/web.xml" overwrite="true">
1090 <filterset>
1091 <filter token="perlpath" value="${perl.path}"/>
1092 </filterset>
1093 </copy>
1094 </target>
1095
1096 <target name="configure-tomcat-external" depends="init" unless="tomcat.islocal">
1097 <!-- re-setup the server.xml file -->
1098 <!-- need to edit the config file, or do we get the user to do this???-->
1099 </target>
1100
1101
1102 <!-- This target runs tomcat's "bin/catalina.bat(.sh) jpda start"
1103 to allow debugging the running GS3 server in Eclipse. See the instructions at
1104 http://www.wikijava.org/wiki/Debugging_a_servlet_with_tomcat_and_Eclipse_tutorial
1105 on how to use this with eclipse
1106 -->
1107 <target name="debug-start-tomcat" description="Startup Tomcat for debugger" depends="init" if="tomcat.islocal">
1108 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
1109 <property name="tomcat.path" refid="local.tomcat.path"/>
1110
1111 <if><bool>
1112 <isset property="fedora.maxpermsize"/></bool>
1113 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M ${fedora.maxpermsize}"/>
1114 <else>
1115 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
1116 </else>
1117 </if>
1118
1119 <echo file="${catalina.home}/bin/setenv.bat">set CLASSPATH=${tomcat.classpath}</echo>
1120 <echo file="${catalina.home}/bin/setenv.sh">export CLASSPATH=${tomcat.classpath}</echo>
1121
1122 <exec executable="${catalina.home}/bin/catalina.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
1123 <arg value="jpda" />
1124 <arg value="start" />
1125 <env key="JPDA_ADDRESS" value="8000"/> <!-- for debugging Tomcat in Eclipse -->
1126 <env key="JPDA_TRANSPORT" value="dt_socket"/> <!-- for debugging Tomcat in Eclipse -->
1127 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
1128 <env key="PATH" path="${tomcat.path}"/>
1129 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
1130 <env key="CATALINA_HOME" value="${catalina.home}"/>
1131 <env key="CLASSPATH" path="${tomcat.classpath}"/>
1132 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
1133 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.home}/lib"/> <!-- for mac os --> <!-- need gdbm here these days ??-->
1134 <env key="WNHOME" path="${wn.home}"/>
1135 <env key="FEDORA_HOME" path="${fedora.home}"/>
1136 </exec>
1137 <exec executable="${catalina.home}/bin/catalina.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
1138 <arg value="jpda" />
1139 <arg value="start" />
1140 <env key="JPDA_ADDRESS" value="8000"/> <!-- for debugging Tomcat in Eclipse -->
1141 <env key="JPDA_TRANSPORT" value="dt_socket"/> <!-- for debugging Tomcat in Eclipse -->
1142 <env key="GSDLOS" value="windows"/>
1143 <env key="GSDL3HOME" value="${basedir}"/>
1144 <env key="Path" path="${tomcat.path}"/>
1145 <env key="PATH" path="${tomcat.path}"/>
1146 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
1147 <env key="CATALINA_HOME" value="${catalina.home}"/>
1148 <env key="CLASSPATH" path="${tomcat.classpath}"/>
1149 <env key="FEDORA_HOME" path="${fedora.home}"/>
1150 </exec>
1151 <!-- wait for the server to startup in case other targets need it running -->
1152 <waitfor maxwait="5" maxwaitunit="second">
1153 <and>
1154 <socket server="${tomcat.server}" port="${tomcat.port}"/>
1155 <http url="http://${tomcat.server}:${tomcat.port}${app.path}/index.html"/>
1156 </and>
1157 </waitfor>
1158 </target>
1159
1160
1161<!-- Another way: http://ptrthomas.wordpress.com/2006/03/25/how-to-start-and-stop-tomcat-from-ant/ -->
1162 <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal">
1163 <property name="tomcat.classpath" refid="local.tomcat.classpath"/>
1164 <property name="tomcat.path" refid="local.tomcat.path"/>
1165
1166 <if><bool>
1167 <isset property="fedora.maxpermsize"/></bool>
1168 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M ${fedora.maxpermsize}"/>
1169 <else>
1170 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/>
1171 </else>
1172 </if>
1173
1174 <echo file="${catalina.home}/bin/setenv.bat">set CLASSPATH=${tomcat.classpath}</echo>
1175 <echo file="${catalina.home}/bin/setenv.sh">export CLASSPATH=${tomcat.classpath}</echo>
1176
1177 <exec executable="${catalina.home}/bin/startup.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
1178 <!--<env key="GSDLOS" value="linux"/> do we need this?? -->
1179 <env key="GSDL3HOME" value="${basedir}"/>
1180 <env key="PATH" path="${tomcat.path}"/>
1181 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
1182 <env key="CATALINA_HOME" value="${catalina.home}"/>
1183 <env key="CLASSPATH" path="${tomcat.classpath}"/>
1184 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${lib.jni}"/>
1185 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${lib.jni}:${gdbm.home}/lib"/> <!-- for mac os --> <!-- need gdbm here these days ??-->
1186 <env key="WNHOME" path="${wn.home}"/>
1187 <env key="FEDORA_HOME" path="${fedora.home}"/>
1188 </exec>
1189 <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true">
1190 <env key="GSDLOS" value="windows"/>
1191 <env key="GSDL3HOME" value="${basedir}"/>
1192 <env key="Path" path="${tomcat.path}"/>
1193 <env key="PATH" path="${tomcat.path}"/>
1194 <env key="CATALINA_OPTS" value="${catalina.opts}"/>
1195 <env key="CATALINA_HOME" value="${catalina.home}"/>
1196 <env key="CLASSPATH" path="${tomcat.classpath}"/>
1197 <env key="FEDORA_HOME" path="${fedora.home}"/>
1198 </exec>
1199 <!-- wait for the server to startup in case other targets need it running -->
1200 <waitfor maxwait="5" maxwaitunit="second">
1201 <and>
1202 <socket server="${tomcat.server}" port="${tomcat.port}"/>
1203 <http url="http://${tomcat.server}:${tomcat.port}${app.path}/index.html"/>
1204 </and>
1205 </waitfor>
1206 </target>
1207
1208 <!--ant task http: http://www.jajakarta.org/ant/ant-1.6.1/docs/ja/manual/api/org/apache/tools/ant/taskdefs/condition/Http.html-->
1209 <target name="reconfigure" description="Reconfigure the message router">
1210 <waitfor maxwait="5" maxwaitunit="second">
1211 <http url="http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet}?a=s&amp;sa=c"/>
1212 </waitfor>
1213 </target>
1214
1215 <!--Command-line args to Ant: http://www.jguru.com/faq/view.jsp?EID=471794-->
1216 <target name="reconfigure-collection" description="Reconfigure the collection">
1217 <waitfor maxwait="5" maxwaitunit="second">
1218 <http url="http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet}?a=s&amp;sa=c&amp;sc=${collection}"/>
1219 </waitfor>
1220 </target>
1221
1222 <!-- windows: do we want to launch a webrowser?? -->
1223 <!-- shouldn't this test whether anything is running first?
1224 It's safer to always attempt to stop tomcat: that way we won't be dependent on the right time
1225 to check whether the server is stopped or still running before attempting to start again.
1226 This target, which was recently called force-stop-tomcat for a while but is back to being
1227 called stop-tomcat, now hides the Java exception output that appears whenever tomcat is already
1228 stopped as happens when stop-tomcat is called consecutively. -->
1229 <target name="force-stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal">
1230 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.unix}" dir="${catalina.home}/bin" spawn="false">
1231 <env key="FEDORA_HOME" path="${fedora.home}"/>
1232 <env key="CATALINA_HOME" value="${catalina.home}"/>
1233 <arg line=">/dev/null 2>&amp;1"/>
1234 </exec>
1235 <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false">
1236 <env key="FEDORA_HOME" path="${fedora.home}"/>
1237 <env key="CATALINA_HOME" value="${catalina.home}"/>
1238 <arg line=">nul 2>&amp;1"/>
1239 </exec>
1240 </target>
1241
1242 <!-- Can also try the "socket" condition in place of the "http" condition
1243 And also use a <waitfor> in place of <condition>, such as:
1244 <waitfor maxwait="5" maxwaitunit="second" timeoutproperty="tomcat.isstopped"><http url="..."/></waitfor>
1245 The http URL resolves to host:port/greenstone3
1246 Condition uses <http/> rather than <socket/> for testing, since if the server was stopped, the socket
1247 might still be in use for some moments. We test the URL with the http condition since it's likelier to
1248 fail sooner if the server has indeed been stopped. -->
1249 <target name="check-tomcat-running">
1250 <condition property="tomcat.isrunning">
1251 <http url="http://${tomcat.server}:${tomcat.port}${app.path}"/>
1252 </condition>
1253 </target>
1254
1255 <!-- stop-tomcat checks if the tomcat server is already running. If it appears to be running
1256 (regardless of whether tomcat was just starting to shut down), this target calls force-stop-tomcat
1257 to issue the shutdown command to tomcat. Then it waits for at most 15 seconds for the server to
1258 actually stop by checking the socket at which tomcat listens every second, printing a warning
1259 at the end of the max wait time of 15 seconds if tomcat was still running. -->
1260 <target name="stop-tomcat" description="Shutdown only Tomcat if running" depends="check-tomcat-running" if="tomcat.isrunning">
1261 <antcall target="force-stop-tomcat"/>
1262
1263 <property name="wait.numchecks" value="15"/>
1264 <echo>Waiting for the server to shutdown... (${wait.numchecks} seconds max)</echo>
1265 <waitfor maxwait="${wait.numchecks}" maxwaitunit="second" checkevery="1" checkeveryunit="second" timeoutproperty="tomcat.timedout">
1266 <not><socket server="${tomcat.server}" port="${tomcat.port}"/></not>
1267 </waitfor>
1268
1269 <if>
1270 <bool>
1271 <isset property="${tomcat.timedout}"/>
1272 </bool>
1273 <property name="tomcat.isrunning" value="true"/>
1274 <echo>WARNING: Checked the socket ${wait.numchecks} times, but port ${tomcat.port} is still busy.</echo>
1275 <else>
1276 <echo>Tomcat is stopped.</echo>
1277 <property name="tomcat.isrunning" value="false"/>
1278 </else>
1279 </if>
1280 </target>
1281
1282 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/>
1283
1284 <target name="setup-catalina-ant-tasks">
1285 <!-- Configure the custom Ant tasks for the Tomcat Manager application -->
1286 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
1287 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1288 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"
1289 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1290 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
1291 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1292 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
1293 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1294 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
1295 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1296 <taskdef name="start" classname="org.apache.catalina.ant.StartTask"
1297 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1298 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
1299 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1300 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
1301 classpath="${catalina.home}/server/lib/catalina-ant.jar"/>
1302 </target>
1303
1304 <!-- http://blog.andrewbeacock.com/2007/11/how-to-truncate-log-file-using-ubuntu.html
1305 Doing "cat </dev/null > packages/tomcat/logs/catalina.out" doesn't work as an ant target.
1306 It seems to have a problem with cat or </dev/null, with or without the < sign. -->
1307 <target name="reset-logs" description="Empties catalina.out, greenstone.log and contents of web/logs/tmp">
1308 <echo>Truncating catalina.out, greenstone.log and server.log, and emptying ${web.home}/logs/tmp</echo>
1309 <exec executable="rm" os="${os.unix}" dir="${catalina.home}/logs" spawn="false">
1310 <arg value="-f"/>
1311 <arg value="catalina.out"/>
1312 </exec>
1313 <exec executable="rm" os="${os.unix}" dir="${web.home}/logs" spawn="false">
1314 <arg value="-f"/>
1315 <arg value="greenstone.log"/>
1316 </exec>
1317 <exec executable="rm" os="${os.unix}" dir="${web.home}/logs" spawn="false">
1318 <arg value="-f"/>
1319 <arg value="server.log"/>
1320 </exec>
1321
1322 <exec executable="touch" os="${os.unix}" dir="${catalina.home}/logs"
1323 spawn="false">
1324 <arg value="catalina.out"/>
1325 </exec>
1326 <exec executable="touch" os="${os.unix}" dir="${web.home}/logs"
1327 spawn="false">
1328 <arg value="greenstone.log"/>
1329 </exec>
1330 <exec executable="touch" os="${os.unix}" dir="${web.home}/logs"
1331 spawn="false">
1332 <arg value="server.log"/>
1333 </exec>
1334
1335 <exec executable="cmd" os="${os.windows}" dir="${catalina.home}/logs" spawn="false">
1336 <arg line="/c echo. > catalina.out"/>
1337 </exec>
1338 <exec executable="cmd" os="${os.windows}" dir="${web.home}/logs" spawn="false">
1339 <arg line="/c echo. > greenstone.log"/>
1340 </exec>
1341 <exec executable="cmd" os="${os.windows}" dir="${web.home}/logs" spawn="false">
1342 <arg line="/c echo. > server.log"/>
1343 </exec>
1344
1345 <if>
1346 <bool><available file="${web.home}/logs/tmp" type="dir"/></bool>
1347 <delete>
1348 <fileset dir="${web.home}/logs/tmp" includes="**/*"/>
1349 </delete>
1350 </if>
1351 </target>
1352
1353 <!-- ======================= ant Targets ============================ -->
1354 <target name="prepare-ant" depends="init">
1355 <if>
1356 <bool>
1357 <not><available file="${packages.home}/ant/.flagfile"/></not>
1358 </bool>
1359
1360 <get src="http://www.greenstone.org/gs3files/apache-ant-1.7.0-bin.zip"
1361 dest="${packages.home}/apache-ant-1.7.0-bin.zip"
1362 usetimestamp="true"/>
1363 <unzip src="${packages.home}/apache-ant-1.7.0-bin.zip"
1364 dest="${packages.home}"/>
1365 <move todir="${packages.home}/ant">
1366 <fileset dir="${packages.home}/apache-ant-1.7.0"/>
1367 </move>
1368 <echo file="${packages.home}/ant/.flagfile">
1369 the timestamp of this file is the time that ant was extracted from the zip files.
1370 it is used to figure out whether the files need to be refreshed or not in `ant prepare-ant`
1371 </echo>
1372
1373 <else>
1374 <echo>Ant has been prepared, will not prepare</echo>
1375 <echo>Delete ${packages.home}/ant/.flagfile to force refresh</echo>
1376 </else>
1377
1378 </if>
1379 </target>
1380
1381 <!-- ======================= Admin Targets ============================ -->
1382
1383 <!-- This target won't work with Eclipse because the SecureInputHandler used below conflicts with it.
1384 See http://www.dcepler.net/post.cfm/hiding-password-input-in-ant
1385 But you can do: echo mypassword | ant config-admin -->
1386 <target name="config-admin" description="Reset admin password">
1387 <input addproperty="admin.password" defaultvalue="admin" message="New admin password (3-8 characters):&gt;">
1388 <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> <!-- password won't be visible on screen -->
1389 </input>
1390 <!--<echo>PWD: ${admin.password}</echo>-->
1391 <antcall target="update-userdb">
1392 <param name="user.username" value="admin"/>
1393 <param name="user.password" value="${admin.password}"/>
1394 <param name="user.groups" value=""/>
1395 <param name="user.status" value=""/>
1396 <param name="user.comment" value="Password updated."/>
1397 <param name="user.email" value=""/>
1398 </antcall>
1399 </target>
1400
1401 <target name="config-user" description="Add or modify users" depends="get-user-data,update-userdb"/>
1402
1403 <target name="get-user-data" description="Get user details">
1404 <input addproperty="user.username" message="Username:&gt;"/>
1405 <input addproperty="user.password" defaultvalue="" message="Password (3-8 characters):&gt;">
1406 <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> <!-- password won't be visible on screen -->
1407 </input>
1408 <input addproperty="user.groups" defaultvalue="" message="Groups (comma-separated list):&gt;"/>
1409 <input addproperty="user.status" defaultvalue="true" message="Enabled (true/false):&gt;"/>
1410 <input addproperty="user.comment" defaultvalue="" message="Comment:&gt;"/>
1411 <input addproperty="user.email" defaultvalue="" message="Email:&gt;"/>
1412 </target>
1413
1414<!-- This target won't work with Eclipse because the SecureInputHandler used below conflicts with it.
1415 See http://www.dcepler.net/post.cfm/hiding-password-input-in-ant
1416 But you can do: echo mypassword | ant config-admin -->
1417 <target name="update-userdb" description="Add or modify users" depends="check-tomcat-running">
1418
1419 <!-- stop tomcat if running, since derby db is embedded and only allows connections from one jvm instance at a time
1420 See http://db.apache.org/derby/papers/DerbyTut/embedded_intro.html
1421 The ${tomcat.isrunning} property is set by the depends-target "check-tomcat-running" -->
1422 <if>
1423 <bool>
1424 <istrue value="${tomcat.isrunning}"/>
1425 </bool>
1426 <antcall target="stop-tomcat"/>
1427 </if>
1428
1429 <!--<echo>${admin.password}</echo>--> <!-- for testing -->
1430 <java classname="org.greenstone.gsdl3.util.ModifyUsersDB">
1431 <classpath refid="compile.classpath"/> <!--for ${web.lib}/gsdl3.jar and supporting files-->
1432 <arg file="${web.home}/sites/localsite/etc/usersDB"/>
1433 <arg value="${user.username}"/>
1434 <arg value="password=${user.password}"/>
1435 <arg value="groups=${user.groups}"/>
1436 <arg value="status=${user.status}"/>
1437 <arg value="comment=${user.comment}"/>
1438 <arg value="email=${user.email}"/>
1439 </java>
1440
1441 <!-- run tomcat again if it used to be running -->
1442 <if>
1443 <bool>
1444 <istrue value="${tomcat.isrunning}"/>
1445 </bool>
1446 <antcall target="start-tomcat"/>
1447 </if>
1448 </target>
1449
1450
1451 <!-- ======================= Axis Targets ============================ -->
1452
1453 <target name="prepare-axis" depends="init">
1454
1455 <if>
1456 <bool>
1457 <not><available file="${packages.home}/axis/.flagfile"/></not>
1458 </bool>
1459
1460 <get src="http://www.greenstone.org/gs3files/${axis.zip.version}"
1461 dest="${packages.home}/${axis.zip.version}"
1462 usetimestamp="true"/>
1463 <unzip src="${packages.home}/${axis.zip.version}"
1464 dest="${packages.home}"/>
1465 <move todir="${packages.home}/axis">
1466 <fileset dir="${packages.home}/${axis.dir.version}"/>
1467 </move>
1468 <!-- install axis into greenstone web app -->
1469 <copy todir="${web.lib}">
1470 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/lib">
1471 <include name="*.jar"/>
1472 </fileset>
1473 </copy>
1474 <copy todir="${web.home}">
1475 <fileset dir="${packages.home}/axis/webapps/axis/">
1476 <include name="*.jsp"/>
1477 <include name="*.jws"/>
1478 </fileset>
1479 </copy>
1480 <copy tofile="${web.home}/axis.html" file="${packages.home}/axis/webapps/axis/index.html"/>
1481 <copy todir="${web.classes}">
1482 <fileset dir="${packages.home}/axis/webapps/axis/WEB-INF/classes">
1483 <include name="*.properties"/>
1484 </fileset>
1485 </copy>
1486 <echo file="${packages.home}/axis/.flagfile">
1487 the timestamp of this file is the time that axis was extracted from the zip files.
1488 it is used to figure out whether the files need to be refreshed or not in `ant prepare-axis`
1489 </echo>
1490
1491 <else>
1492 <echo>Axis has been prepared, will not prepare</echo>
1493 <echo>Delete ${packages.home}/axis/.flagfile to force refresh</echo>
1494 </else>
1495
1496 </if>
1497 </target>
1498
1499 <target name="soap-deploy-site" depends="init,get-sitename,get-siteuri,get-webservices,create-deployment-files,deploy-site"
1500 description="Deploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work."/>
1501
1502 <target name="deploy-site">
1503 <java classname="org.apache.axis.client.AdminClient">
1504 <classpath refid="compile.classpath"/>
1505 <arg value="-l"/>
1506 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
1507 <arg file="${basedir}/resources/soap/deploy.wsdd"/>
1508 </java>
1509 <delete file="${basedir}/resources/soap/deploy.wsdd"/> <!--clean up, no longer used-->
1510 </target>
1511
1512 <target name="soap-undeploy-site" depends="get-undeploy-service-name"
1513 description="Undeploy a SOAP web service for a local Greenstone site. Tomcat must be running for this to work.">
1514 <filter token="servicesname" value="${axis.undeploy.servicename}"/>
1515 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template"
1516 tofile="${basedir}/resources/soap/undeploy.wsdd"
1517 filtering="true"
1518 overwrite="true"/>
1519 <java classname="org.apache.axis.client.AdminClient">
1520 <classpath refid="compile.classpath"/>
1521 <arg value="-l"/>
1522 <arg value="http://${tomcat.server}:${tomcat.port}${app.path}/servlet/AxisServlet"/>
1523 <arg file="${basedir}/resources/soap/undeploy.wsdd"/>
1524 </java>
1525 <delete file="${basedir}/resources/soap/undeploy.wsdd"/> <!--clean up, no longer used-->
1526 </target>
1527
1528 <!-- this target used to deploy the default web service SOAPServer (base.webservice.name) on the localsite server
1529 with the default servicename of localsite-->
1530 <target name="deploy-localsite" depends="init"
1531 description="Deploy the SOAP server for localsite. Will start and stop Tomcat.">
1532 <antcall target="start-tomcat"/>
1533 <echo>Deploying ${base.webservice.name} web services for localsite under service name: localsite</echo>
1534 <antcall target="create-deployment-files">
1535 <param name="axis.sitename" value="localsite"/>
1536 <param name="axis.servicesname" value="${base.webservice.name}"/>
1537 <param name="axis.siteuri" value="localsite"/>
1538 </antcall>
1539 <antcall target="deploy-site">
1540 <param name="axis.sitename" value="localsite"/>
1541 <param name="axis.servicesname" value="${base.webservice.name}"/>
1542 <param name="axis.siteuri" value="localsite"/>
1543 </antcall>
1544 <echo>The Greenstone server has been started up. If you do not want it running, please type: ant stop.</echo>
1545 </target>
1546
1547 <target name="get-sitename" unless="axis.sitename">
1548 <input addproperty="axis.sitename" defaultvalue="localsite">What site do you want to deploy services for?
1549Press Enter for default:localsite</input>
1550 </target>
1551
1552 <target name="get-undeploy-service-name" unless="axis.undeploy.servicename">
1553 <input addproperty="axis.undeploy.servicename" defaultvalue="localsite">Please enter the full name of the service you wish to undeploy.
1554To find out which web services you've got deployed, point your browser to http://HOST:PORT/greenstone3/services
1555Or press Enter for undeploying the default:localsite /&gt;</input>
1556 <echo>Name of service to undeploy: ${axis.undeploy.servicename}</echo>
1557 </target>
1558
1559 <target name="get-webservices" unless="axis.servicesname">
1560 <input addproperty="axis.servicesname" defaultvalue="${base.webservice.name}">Which set of web services do you want to deploy?
1561Choose from: ${web.services.list}
1562Or press Enter for default:${base.webservice.name} /&gt;</input>
1563 <echo>${axis.servicesname}</echo>
1564 </target>
1565
1566 <target name="get-siteuri" depends="get-sitename,get-webservices" unless="axis.siteuri">
1567 <input addproperty="axis.siteuri" defaultvalue="${axis.servicesname}${axis.sitename}">What name do you want the service to have? (Press Enter for default:${axis.servicesname}${axis.sitename})</input>
1568 <echo>Site: ${axis.sitename}, services: ${axis.servicesname}, servicesname: ${axis.siteuri}</echo>
1569 </target>
1570
1571 <target name="set-soapmethod" description="Determines whether the service in the wsdd should have the style attribute set to message or the provider attribute set to java:RPC" if="axis.servicesname">
1572 <condition property="soap.method" value="provider='java:MSG' style='message' use='literal'">
1573 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
1574 </condition>
1575
1576 <!--everything else defaults to java:RPC at present-->
1577 <condition property="soap.method" value="provider='java:RPC'">
1578 <not>
1579 <equals arg1="${axis.servicesname}" arg2="${base.webservice.name}"/>
1580 </not>
1581 </condition>
1582 </target>
1583
1584 <target name="create-deployment-files" depends="set-soapmethod" if="axis.sitename">
1585 <filter token="sitename" value="${axis.sitename}"/>
1586 <filter token="siteuri" value="${axis.siteuri}"/>
1587 <filter token="servicesname" value="${axis.servicesname}"/>
1588 <filter token="soapmethod" value="${soap.method}"/>
1589 <copy file="${basedir}/resources/soap/site.wsdd.template"
1590 tofile="${basedir}/resources/soap/deploy.wsdd"
1591 filtering="true"
1592 overwrite="true"/>
1593 <!-- create the java files and compile them -->
1594 <copy file="${basedir}/resources/java/${axis.servicesname}.java.in"
1595 tofile="${src.gsdl3.home}/${axis.servicesname}${axis.sitename}.java"
1596 filtering="true"
1597 overwrite="true"/>
1598 <mkdir dir="${build.home}"/>
1599 <javac srcdir="${src.home}"
1600 destdir="${build.home}"
1601 debug="${compile.debug}"
1602 deprecation="${compile.deprecation}"
1603 optimize="${compile.optimize}">
1604 <classpath refid="compile.classpath"/>
1605 <include name="org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.java" />
1606 </javac>
1607 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/>
1608 <copy file="${build.home}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1609 tofile="${web.classes}/org/greenstone/gsdl3/${axis.servicesname}${axis.sitename}.class"
1610 overwrite="true" />
1611 </target>
1612
1613
1614 <!-- ====================== Core targets ============================== -->
1615 <!-- core targets refer to the core gsdl3 java src -->
1616
1617 <target name="prepare-core"/>
1618
1619 <target name="configure-core"/>
1620
1621 <target name="update-core" depends="init,svnupdate-core,clean-core,compile-core"
1622 description="Update only the Greenstone core" />
1623
1624 <target name="svnupdate-core" unless="nosvn.mode">
1625 <exec executable="svn">
1626 <arg value="update"/>
1627 <arg value="${basedir}"/>
1628 <arg value="-r"/><arg value="${branch.revision}"/>
1629 </exec>
1630 </target>
1631
1632 <target name="clean-core"
1633 description="Clean only the Greenstone core">
1634 <!-- should this delete the gsdl3.jar from web/WEB-INF?? -->
1635 <delete dir="${build.home}"/>
1636 </target>
1637
1638 <target name="compile-core" depends="init"
1639 description="Compile only the Greenstone core">
1640 <mkdir dir="${build.home}"/>
1641
1642 <if><bool><isset property="with.jni"/></bool>
1643 <javac srcdir="${src.home}"
1644 destdir="${build.home}"
1645 debug="${compile.debug}"
1646 deprecation="${compile.deprecation}"
1647 optimize="${compile.optimize}">
1648 <classpath>
1649 <path refid="compile.classpath"/>
1650 </classpath>
1651 </javac>
1652 <else>
1653 <property name="gsprefix" value=""/>
1654 <javac srcdir="${src.home}"
1655 destdir="${build.home}"
1656 debug="${compile.debug}"
1657 deprecation="${compile.deprecation}"
1658 optimize="${compile.optimize}">
1659 <classpath>
1660 <path refid="compile.classpath"/>
1661 </classpath>
1662 <exclude name="org/greenstone/gsdl3/service/GS2MGPPRetrieve.java"/>
1663 <exclude name="org/greenstone/gsdl3/service/GS2MGPPSearch.java"/>
1664 <exclude name="org/greenstone/gsdl3/service/GS2MGSearch.java"/>
1665 <exclude name="org/greenstone/gsdl3/service/GS2MGRetrieve.java"/>
1666 <exclude name="org/greenstone/gsdl3/service/GoogleNgramMGPPSearch.java"/>
1667 <exclude name="org/greenstone/gsdl3/service/PhindPhraseBrowse.java"/>
1668 <exclude name="org/greenstone/gsdl3/util/GDBMWrapper.java"/>
1669 </javac>
1670 </else>
1671 </if>
1672 <jar destfile="${build.home}/gsdl3.jar">
1673 <fileset dir="${build.home}">
1674 <include name="org/greenstone/gsdl3/**"/>
1675 <include name="org/flax/**"/>
1676 <exclude name="**/Test.class"/>
1677 </fileset>
1678 <manifest>
1679 <attribute name="Built-By" value="${user.name}" />
1680 </manifest>
1681 </jar>
1682 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/>
1683
1684 <jar destfile="${build.home}/gutil.jar">
1685 <fileset dir="${build.home}">
1686 <include name="org/greenstone/util/**"/>
1687 </fileset>
1688 <manifest>
1689 <attribute name="Built-By" value="${user.name}" />
1690 </manifest>
1691 </jar>
1692 <copy file="${build.home}/gutil.jar" todir="${web.lib}"/>
1693
1694 <!-- copy the localsite server in case we need it -->
1695 <copy file="${build.home}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" tofile="${web.classes}/org/greenstone/gsdl3/${base.webservice.name}localsite.class" />
1696
1697 <!-- Greenstone Administrator Interface -->
1698 <jar destfile="${build.home}/GAI.jar">
1699 <fileset dir="${build.home}">
1700 <include name="org/greenstone/admin/**"/>
1701 </fileset>
1702 <manifest>
1703 <attribute name="Built-By" value="${user.name}" />
1704 </manifest>
1705 </jar>
1706 <copy file="${build.home}/GAI.jar" todir="${web.lib}"/>
1707 <copy file="${build.home}/GAI.jar" todir="${admin.dir}"/>
1708 <jar destfile="${build.home}/phind.jar">
1709 <fileset dir="${build.home}">
1710 <include name="org/greenstone/applet/phind/**"/>
1711 </fileset>
1712 <manifest>
1713 <attribute name="Built-By" value="${user.name}" />
1714 </manifest>
1715 </jar>
1716 <mkdir dir="${web.applet}"/>
1717 <copy file="${build.home}/phind.jar" todir="${web.applet}"/>
1718 <!-- phind also needs xercesImpl.jar and xml-apis.jar to be in web/applet -->
1719 <if>
1720 <bool><istrue value="${tomcat.islocal}"/></bool>
1721 <copy file="${web.lib}/xercesImpl.jar" todir="${web.applet}"/>
1722 <copy file="${web.lib}/xml-apis.jar" todir="${web.applet}"/>
1723 </if>
1724
1725
1726 <!-- skip anttasks for now
1727 <jar destfile="${build.home}/anttasks.jar">
1728 <fileset dir="${build.home}">
1729 <include name="org/greenstone/anttasks/**"/>
1730 </fileset>
1731 <manifest>
1732 <attribute name="Built-By" value="${user.name}" />
1733 </manifest>
1734 </jar>
1735 <copy file="${build.home}/anttasks.jar" todir="${basedir}/lib/java"/>-->
1736 <jar destfile="${build.home}/gsdl3test.jar">
1737 <fileset dir="${build.home}">
1738 <include name="org/greenstone/gsdl3/**/*Test.class"/>
1739 <include name="org/greenstone/testing/**"/>
1740 </fileset>
1741 <manifest>
1742 <attribute name="Built-By" value="${user.name}" />
1743 </manifest>
1744 </jar>
1745 <jar destfile="${build.home}/server.jar">
1746 <fileset dir="${build.home}">
1747 <include name="org/greenstone/server/**"/>
1748 <include name="org/greenstone/util/**"/>
1749 </fileset>
1750 <fileset file="${basedir}/resources/java/server.properties"/>
1751 <manifest>
1752 <attribute name="Built-By" value="${user.name}"/>
1753 </manifest>
1754 </jar>
1755 <copy file="${build.home}/server.jar" todir="${basedir}"/>
1756 </target>
1757
1758 <!-- ================== Packages targets ================================ -->
1759 <!-- these targets refer to the greenstone source packages - these need
1760 updating less often, so are in separate targets to the core -->
1761 <target name="prepare-packages" depends="init"/>
1762
1763 <target name="update-packages" depends="init,svnupdate-packages,configure-packages,clean-packages,compile-packages"
1764 description="Update only the source packages"/>
1765
1766 <target name="svnupdate-packages" unless="nosvn.mode">
1767 <exec executable="svn">
1768 <arg value="update"/>
1769 <arg value="${src.packages.home}"/>
1770 <arg value="-r"/><arg value="${branch.revision}"/>
1771 </exec>
1772 </target>
1773
1774
1775 <target name="configure-packages" depends="init,configure-javagdbm"
1776 description="Configure only the packages."/>
1777
1778 <target name="configure-javagdbm" if="with.jni">
1779 <echo>
1780 Configuring JavaGDBM
1781 </echo>
1782
1783 <exec executable="${javagdbm.home}/configure" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
1784 <arg value="--prefix=${basedir}"/>
1785 <arg value="--libdir=${lib.jni}"/>
1786 <arg value="--with-gdbm=${gdbm.home}"/>
1787 <arg line="${cross.configure.args}"/>
1788 </exec>
1789 </target>
1790
1791 <target name="clean-packages" depends="init,clean-javagdbm" description="Clean only the packages"/>
1792
1793 <target name="clean-javagdbm" depends="init">
1794 <if><bool><available file="${javagdbm.home}/Makefile"/></bool>
1795 <exec executable="make" os="${os.unix}"
1796 dir="${javagdbm.home}" failonerror="true">
1797 <arg value="clean"/>
1798 </exec>
1799 </if>
1800 </target>
1801
1802 <target name="distclean-packages" depends="init,distclean-javagdbm" description="Distclean only the packages"/>
1803
1804 <target name="distclean-javagdbm" depends="init">
1805 <if><bool><available file="${javagdbm.home}/Makefile"/></bool>
1806 <exec executable="make" os="${os.unix}"
1807 dir="${javagdbm.home}" failonerror="true">
1808 <arg value="distclean"/>
1809 </exec>
1810 </if>
1811 </target>
1812
1813 <target name="compile-packages" description="Compile only the source packages">
1814 <!-- javagdbm -->
1815 <antcall target="compile-javagdbm"/>
1816 <!-- Search4j -->
1817 <antcall target="compile-search4j"/>
1818 </target>
1819
1820 <target name="compile-javagdbm" description="Compile JavaGDBM" if="with.jni">
1821
1822 <!-- unix: -->
1823 <echo>compile javagdbm</echo>
1824 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true"/>
1825 <exec executable="make" os="${os.unix}" dir="${javagdbm.home}" failonerror="true">
1826 <arg value="install"/>
1827 </exec>
1828
1829 <!-- windows: Calling without the "compile" argument first will run winMake.bat with
1830 "all" which will then perform both the compile AND link targets in jni/win32.mak
1831 (thereby also generating gdbmjava.dll). Then we run the same command with
1832 the "install" argument to copy the gdbmjava.dll into the correct location. -->
1833 <echo>Windows: compile javagdbm</echo>
1834 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
1835 <env key="GSDL3SRCHOME" path="${basedir}"/>
1836 </exec>
1837 <exec executable="${javagdbm.home}/winMake.bat" os="${os.windows}" dir="${javagdbm.home}" failonerror="true">
1838 <env key="GSDL3SRCHOME" path="${basedir}"/>
1839 <arg value="install"/>
1840 </exec>
1841
1842 <!-- install the jar file -->
1843 <echo>Install the javagdbm jar file ${javagdbm.home}/javagdbm.jar ${lib.jni}</echo>
1844 <copy file="${javagdbm.home}/javagdbm.jar" todir="${lib.jni}"/>
1845 </target>
1846
1847 <target name="compile-search4j">
1848
1849 <!-- windows -->
1850 <if><bool><istrue value="${current.os.iswindows}"/></bool>
1851 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1852 <arg value="/f"/>
1853 <arg value="win32.mak"/>
1854 <arg value='BINDIR="${basedir}\bin"'/>
1855 </exec>
1856 <exec executable="nmake" dir="${src.packages.home}/search4j" failonerror="true">
1857 <arg value="/f"/>
1858 <arg value="win32.mak"/>
1859 <arg value="install"/>
1860 <arg value='BINDIR="${basedir}\bin"'/>
1861 </exec>
1862
1863 <!-- unix -->
1864 <else><if><bool><istrue value="${current.os.isunix}"/></bool>
1865 <exec executable="${src.packages.home}/search4j/configure" dir="${src.packages.home}/search4j" failonerror="true">
1866 <arg value="--bindir=${basedir}/bin"/>
1867 <arg value="${static.arg}"/>
1868 <arg line="${cross.configure.args}"/>
1869 </exec>
1870 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true"/>
1871 <exec executable="make" dir="${src.packages.home}/search4j" failonerror="true">
1872 <arg value="install"/>
1873 </exec>
1874
1875 <!-- else warn -->
1876 <else>
1877 <fail>this target does not support the current os</fail>
1878
1879 </else></if></else></if>
1880
1881 </target>
1882
1883 <target name="install-auxiliary-jar-files" depends="init">
1884
1885 <if>
1886 <bool><available file="${mg.home}/mg.jar"/></bool>
1887 <copy file="${mg.home}/mg.jar" todir="${lib.jni}"/>
1888 </if>
1889
1890 <if>
1891 <bool><available file="${mgpp.home}/mgpp.jar"/></bool>
1892 <copy file="${mgpp.home}/mgpp.jar" todir="${lib.jni}"/>
1893 </if>
1894
1895 <copy file="${lucene.home}/LuceneWrapper3.jar" todir="${web.lib}"/>
1896 </target>
1897
1898 <target name="install-jni-files" depends="init" if="with.jni">
1899 <antcall target="install-jni-files-linux"/>
1900 <antcall target="install-jni-files-windows"/>
1901 <antcall target="install-jni-files-macos"/>
1902 </target>
1903
1904 <target name="install-jni-files-linux" depends="init" if="current.os.isunixnotmac">
1905
1906 <if>
1907
1908 <bool><equals arg1="${os.bin.dir}" arg2="windows"/></bool>
1909 <!-- cross compiling to windows -->
1910 <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
1911 <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
1912 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
1913 <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
1914 <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
1915 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
1916
1917 <else>
1918 <!-- otherwise do the usual Unix copies -->
1919 <copy file="${mg.home}/jni/libmgretrievejni.so" todir="${lib.jni}"/>
1920 <copy file="${mg.home}/jni/libmgsearchjni.so" todir="${lib.jni}"/>
1921 <copy file="${mg.home}/jni/libmgpassjni.so" todir="${lib.jni}"/>
1922 <copy file="${mgpp.home}/jni/libmgppretrievejni.so" todir="${lib.jni}"/>
1923 <copy file="${mgpp.home}/jni/libmgppsearchjni.so" todir="${lib.jni}"/>
1924 <copy file="${mgpp.home}/jni/libmgpppassjni.so" todir="${lib.jni}"/>
1925 </else>
1926 </if>
1927
1928
1929 </target>
1930 <target name="install-jni-files-windows" depends="init" if="current.os.iswindows">
1931 <copy file="${mg.home}/jni/mgretrievejni.dll" todir="${lib.jni}"/>
1932 <copy file="${mg.home}/jni/mgsearchjni.dll" todir="${lib.jni}"/>
1933 <copy file="${mg.home}/jni/mgpassjni.dll" todir="${lib.jni}"/>
1934 <copy file="${mgpp.home}/jni/mgppretrievejni.dll" todir="${lib.jni}"/>
1935 <copy file="${mgpp.home}/jni/mgppsearchjni.dll" todir="${lib.jni}"/>
1936 <copy file="${mgpp.home}/jni/mgpppassjni.dll" todir="${lib.jni}"/>
1937 </target>
1938 <target name="install-jni-files-macos" depends="init" if="current.os.ismac">
1939 <copy file="${mg.home}/jni/libmgretrievejni.jnilib" todir="${lib.jni}"/>
1940 <copy file="${mg.home}/jni/libmgsearchjni.jnilib" todir="${lib.jni}"/>
1941 <copy file="${mg.home}/jni/libmgpassjni.jnilib" todir="${lib.jni}"/>
1942 <copy file="${mgpp.home}/jni/libmgppretrievejni.jnilib" todir="${lib.jni}"/>
1943 <copy file="${mgpp.home}/jni/libmgppsearchjni.jnilib" todir="${lib.jni}"/>
1944 <copy file="${mgpp.home}/jni/libmgpppassjni.jnilib" todir="${lib.jni}"/>
1945 </target>
1946
1947 <!-- ========common-src targets =================================-->
1948 <!-- these are used to get common-src (for indexers, gdbm, sqlite etc) when
1949 collection building is not enabled -->
1950
1951 <target name="update-common-src" depends="init" if="collection.building.disabled">
1952 </target>
1953
1954 <target name="svnupdate-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1955 <exec executable="svn">
1956 <arg value="update"/>
1957 <arg value="${common.src.home}"/>
1958 <arg value="-r"/><arg value="${branch.revision}"/>
1959 </exec>
1960 </target>
1961
1962 <target name="prepare-common-src" depends="init" if="collection.building.disabled" unless="common.src.present">
1963 <antcall target="checkout-common-src"/>
1964 <antcall target="unzip-windows-packages"/>
1965 </target>
1966
1967 <target name="checkout-common-src" depends="init" if="collection.building.disabled" unless="nosvn.mode">
1968 <echo>checking out common-src</echo>
1969 <exec executable="svn">
1970 <arg value="checkout"/>
1971 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src"/>
1972 <arg value="common-src"/>
1973 <arg value="-r"/><arg value="${branch.revision}"/>
1974 </exec>
1975 </target>
1976
1977 <target name="configure-common-src" depends="init">
1978<!--
1979 <echo>cross configure args: ${cross.configure.args}</echo>
1980-->
1981 <exec executable="${common.src.home}/configure" os="${os.unix}"
1982 dir="${common.src.home}" failonerror="true">
1983 <arg value="--prefix=${gs2build.home}"/> <!-- what value to use?? -->
1984 <arg value="--bindir=${gs2build.home}/bin/${os.bin.dir}"/> <!-- what value to use?? -->
1985 <arg line="${gs2.opt.args}"/>
1986 <arg line="${static.arg}"/>
1987 <arg line="${cross.configure.args}"/>
1988 <arg line="${allargs}"/>
1989 </exec>
1990 </target>
1991
1992 <target name="clean-common-src" depends="init">
1993 <!-- unix: -->
1994 <if><bool><available file="${common.src.home}/Makefile"/></bool>
1995 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
1996 <arg value="clean"/>
1997 </exec>
1998 </if>
1999 <!-- windows: -->
2000 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
2001 <arg value="/f"/>
2002 <arg value="win32.mak"/>
2003 <arg value="clean"/>
2004 <arg value="GSDLHOME=${gs2build.home}"/>
2005 </exec>
2006 </target>
2007 <target name="distclean-common-src" depends="init">
2008 <!-- unix: -->
2009 <if><bool><available file="${common.src.home}/Makefile"/></bool>
2010 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
2011 <arg value="distclean"/>
2012 </exec>
2013 </if>
2014 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
2015 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
2016 <arg value="/f"/>
2017 <arg value="win32.mak"/>
2018 <arg value="clean"/>
2019 <arg value="GSDLHOME=${gs2build.home}"/>
2020 </exec>
2021 </target>
2022 <target name="compile-common-src" depends="init">
2023 <!-- unix: -->
2024 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
2025 <arg value="${gs2.compile.target}"/>
2026 </exec>
2027 <!-- windows: -->
2028 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
2029 <arg value="/f"/>
2030 <arg value="win32.mak"/>
2031 <arg value="GSDLHOME=${gs2build.home}"/>
2032 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
2033 <arg value="ENABLE_MG=${gs2.windows.enablemg}"/>
2034 <arg value="ENABLE_MGPP=${gs2.windows.enablemgpp}"/>
2035 <arg value="USE_GDBM=${gs2.windows.usegdbm}"/>
2036 <arg value="USE_SQLITE=${gs2.windows.usesqlite}"/>
2037 </exec>
2038 </target>
2039
2040 <!-- ======= collection-building targets ===========================-->
2041
2042 <target name="update-collection-building" if="collection.building.enabled"
2043 depends="init,svnupdate-collection-building,gs2build-edit-setup-bat,configure-common-src,clean-common-src,compile-common-src,configure-collection-building,clean-collection-building,compile-collection-building"
2044 description="Update (SVN update, configure, compile etc) only the collection building components"/>
2045
2046 <target name="svnupdate-collection-building" if="collection.building.enabled" depends="init,svnupdate-gs2build,svnupdate-gli" unless="nosvn.mode"
2047 description="SVN update the collection building components">
2048 </target>
2049
2050 <target name="prepare-collection-building" depends="init,prepare-gs2build,prepare-gli" if="collection.building.enabled">
2051 </target>
2052
2053 <target name="configure-collection-building" depends="init,configure-build-src" if="collection.building.enabled"
2054 description="Configure the collection building components">
2055 </target>
2056
2057 <target name="clean-collection-building" depends="init,clean-gli,clean-build-src"
2058 description="Clean only the collection building components"
2059 if="collection.building.enabled"/>
2060
2061 <target name="distclean-collection-building" depends="init,clean-build-src,distclean-build-src"
2062 description="Distclean only the collection building components"
2063 if="collection.building.enabled"/>
2064
2065 <target name="compile-collection-building" depends="init,compile-build-src,compile-gli" if="collection.building.enabled"
2066 description="Compile only the collection building components">
2067 <!-- make install for common-src -->
2068 <!-- unix: -->
2069 <exec executable="make" os="${os.unix}" dir="${common.src.home}" failonerror="true">
2070 <arg value="${gs2.install.target}"/>
2071 </exec>
2072
2073 <!-- windows: -->
2074 <exec executable="nmake" dir="${common.src.home}" os="${os.windows}" failonerror="true">
2075 <arg value="/f"/>
2076 <arg value="win32.mak"/>
2077 <arg value="install"/>
2078 <arg value="GSDLHOME=${gs2build.home}"/>
2079 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
2080 <arg value="ENABLE_MG=${gs2.windows.enablemg}"/>
2081 <arg value="ENABLE_MGPP=${gs2.windows.enablemgpp}"/>
2082 <arg value="USE_GDBM=${gs2.windows.usegdbm}"/>
2083 <arg value="USE_SQLITE=${gs2.windows.usesqlite}"/>
2084 <!--
2085 <arg value="ENABLE_JNI=${gs2.windows.enablejni}"/>
2086 <arg value="USE_SQLITE=0"/>--> <!-- why is this not on by default? -->
2087 </exec>
2088
2089 <!-- install gs2build indexers for windows -->
2090 <if>
2091 <bool><istrue value="${current.os.iswindows}"/></bool>
2092 <copy todir="${gs2build.home}/bin/windows">
2093 <fileset dir="${gs2build.home}/common-src/indexers/bin">
2094 <include name="*.*"/>
2095 </fileset>
2096 </copy>
2097 </if>
2098
2099 <!-- LuceneWrapper jar file not installed by default -->
2100 <mkdir dir="${gs2build.home}/bin/java"/>
2101 <copy file="${lucene.home}/LuceneWrapper3.jar" todir="${gs2build.home}/bin/java"/>
2102
2103 </target>
2104
2105 <!-- ============== gli targets ================================= -->
2106 <target name="svnupdate-gli" if="collection.building.enabled" depends="init" unless="nosvn.mode">
2107
2108 <exec executable="svn">
2109 <arg value="update"/>
2110 <arg value="${gli.home}"/>
2111 <arg value="-r"/><arg value="${branch.revision}"/>
2112 </exec>
2113
2114 <exec executable="svn" dir="web/WEB-INF/cgi">
2115 <arg value="export"/>
2116 <arg value="-r"/><arg value="${branch.revision}"/>
2117 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gliserver.pl"/>
2118 </exec>
2119 <exec executable="svn" dir="web/WEB-INF/cgi">
2120 <arg value="export"/>
2121 <arg value="-r"/><arg value="${branch.revision}"/>
2122 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gsdlCGI.pm"/>
2123 </exec>
2124
2125 </target>
2126
2127 <target name="prepare-gli" depends="init" if="collection.building.enabled" unless="gli.present">
2128 <!-- checkout -->
2129 <if><bool><and><not><istrue value="${nosvn.mode}"/></not><isset property="with.gli.and.gems"/></and></bool>
2130
2131 <exec executable="svn">
2132 <arg value="checkout"/>
2133 <arg value="${svn.root}/main/${branch.path}/gli"/>
2134 <arg value="-r"/><arg value="${branch.revision}"/>
2135 </exec>
2136
2137 <exec executable="svn" dir="web/WEB-INF/cgi">
2138 <arg value="export"/>
2139 <arg value="-r"/><arg value="${branch.revision}"/>
2140 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gliserver.pl"/>
2141 </exec>
2142 <exec executable="svn" dir="web/WEB-INF/cgi">
2143 <arg value="export"/>
2144 <arg value="-r"/><arg value="${branch.revision}"/>
2145 <arg value="${svn.root}/main/${branch.path}/greenstone2/common-src/cgi-bin/gsdlCGI.pm"/>
2146 </exec>
2147
2148 </if>
2149 </target>
2150
2151 <target name="clean-gli" depends="init" if="collection.building.enabled">
2152 <!-- gli -->
2153 <property name="gli.home" value="${basedir}/gli"/>
2154 <!-- linux -->
2155 <exec executable="clean.sh" os="${os.unix}" dir="${gli.home}"
2156 resolveExecutable="true" failonerror="true"/>
2157 <!-- windows -->
2158 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}"
2159 resolveExecutable="true" failonerror="true"/>
2160 </target>
2161
2162 <target name="compile-gli" depends="init" if="collection.building.enabled">
2163 <if><bool><isset property="with.gli.and.gems"/></bool>
2164 <!-- gli -->
2165 <property name="gli.home" value="${basedir}/gli"/>
2166
2167 <!-- linux -->
2168 <exec executable="makegli.sh" os="${os.unix}" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
2169 <!--remote gli-->
2170 <exec executable="makejar.sh" os="${os.unix}" dir="${gli.home}"
2171 resolveExecutable="true" failonerror="true"/>
2172 <!-- windows -->
2173 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}" resolveExecutable="true" failonerror="true"/>
2174 <!--remote gli-->
2175 <exec executable="makejar.bat" os="${os.windows}" dir="${gli.home}"
2176 resolveExecutable="true" failonerror="true"/>
2177 <copy file="${gli.home}/GLIServer.jar" todir="${gs2build.home}/bin/java" />
2178 </if>
2179 </target>
2180
2181 <target name="gli" description="Run the Greenstone Librarian Interface" depends="init" if="collection.building.enabled">
2182 <exec executable="${basedir}/gli/gli.sh" os="${os.linux},${os.solaris}" dir="${basedir}/gli" spawn="true">
2183 <env key="gsdl3path" path="${basedir}"/>
2184 <env key="gsdlpath" path="${gs2build.home}"/>
2185 </exec>
2186 <exec executable="${basedir}/gli/gli.sh" os="${os.mac}" dir="${basedir}/gli" spawn="true">
2187 <env key="gsdl3path" path="${basedir}"/>
2188 <env key="gsdlpath" path="${gs2build.home}"/>
2189 <env key="DYLD_LIBRARY_PATH" path="${env.DYLD_LIBRARY_PATH}:${gdbm.home}/lib"/>
2190 </exec>
2191 <exec executable="${basedir}/gli/gli.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true">
2192 <env key="GSDL3PATH" path="${basedir}"/>
2193 <env key="GSDLPATH" path="${gs2build.home}"/>
2194 </exec>
2195 <echo>Running GLI from Ant means that you don't get to see any of the terminal output. If you have problems with GLI and want to see the output, please run the script gli.sh/bat from the greenstone3/gli directory.
2196 </echo>
2197 </target>
2198
2199 <!-- ================ gs2build targets =========================== -->
2200
2201 <target name="svnupdate-gs2build" if="collection.building.enabled" depends="init" unless="nosvn.mode">
2202 <echo>svn updating gs2build</echo>
2203 <exec executable="svn">
2204 <arg value="update"/>
2205 <arg value="${gs2build.home}"/>
2206 <arg value="-r"/><arg value="${branch.revision}"/>
2207 </exec>
2208 </target>
2209
2210 <target name="prepare-gs2build" depends="init" if="collection.building.enabled" unless="gs2build.present">
2211 <antcall target="checkout-gs2build"/>
2212 <antcall target="unzip-windows-packages"/>
2213 <antcall target="checkout-winbin"/>
2214 <antcall target="get-windows-binaries"/>
2215 <antcall target="delete-winbin"/>
2216 </target>
2217
2218 <target name="checkout-gs2build" depends="init" if="collection.building.enabled" unless="nosvn.mode">
2219 <echo>checking out gs2build</echo>
2220 <exec executable="svn">
2221 <arg value="checkout"/>
2222 <arg value="${svn.root}/main/${branch.path}/gs2build"/>
2223 <arg value="-r"/><arg value="${branch.revision}"/>
2224 </exec>
2225
2226
2227 </target>
2228
2229 <target name="checkout-winbin" depends="init" if="current.os.iswindows"
2230 unless="nosvn.mode">
2231
2232 <exec executable="svn">
2233 <arg value="checkout"/>
2234 <arg value="${svn.root}/main/${branch.path}/binaries/windows"/>
2235 <arg value="-r"/><arg value="${branch.revision}"/>
2236 <arg value="winbin"/>
2237 </exec>
2238
2239 </target>
2240
2241 <target name="update-winbin" depends="init" if="current.os.iswindows" unless="nosvn.mode">
2242 <exec executable="svn">
2243 <arg value="update"/>
2244 <arg value="winbin"/>
2245 <arg value="-r"/><arg value="${branch.revision}"/>
2246 </exec>
2247
2248 </target>
2249
2250 <target name="get-windows-binaries" depends="init" if="collection.building.enabled.windows">
2251 <move todir="${gs2build.home}/bin/windows" failonerror="false">
2252 <fileset dir="${basedir}/winbin/bin"/>
2253 </move>
2254 </target>
2255
2256 <target name="delete-winbin" depends="init" if="collection.building.enabled.windows">
2257 <delete dir="${basedir}/winbin"/>
2258 </target>
2259
2260 <target name="unzip-windows-packages" depends="init" if="current.os.iswindows">
2261 <unzip src="${common.src.home}/packages/windows/crypt/crypt.zip"
2262 dest="${common.src.home}/packages/windows/crypt"/>
2263 <untar compression="gzip"
2264 src="${common.src.home}/packages/sqlite/${sqlite.targz.version}"
2265 dest="${common.src.home}/packages/sqlite"/>
2266 <unzip src="${common.src.home}/indexers/packages/windows/iconv/iconv.zip"
2267 dest="${common.src.home}/indexers/packages/windows/iconv"/>
2268 </target>
2269
2270 <target name="gs2build-edit-setup-bat" if="collection.building.enabled.windows">
2271 <!-- we want a windows path in the setup.bat file -->
2272 <pathconvert targetos="windows" property="gs2build.home.windows">
2273 <path path="${gs2build.home}"/>
2274 </pathconvert>
2275 <move file="${gs2build.home}/setup.bat" tofile="${gs2build.home}/setup-tmp.bat">
2276 <filterset>
2277 <filter token="gsdlhome" value="${gs2build.home.windows}"/>
2278 </filterset>
2279 </move>
2280 <move file="${gs2build.home}/setup-tmp.bat" tofile="${gs2build.home}/setup.bat" />
2281 </target>
2282
2283
2284 <target name="clean-build-src" depends="init" if="collection.building.enabled">
2285 <!-- unix: -->
2286 <if><bool><available file="${build.src.home}/Makefile"/></bool>
2287 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
2288 <arg value="clean"/>
2289 </exec>
2290 </if>
2291 <!-- windows: -->
2292 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
2293 <arg value="/f"/>
2294 <arg value="win32.mak"/>
2295 <arg value="clean"/>
2296 <arg value="GSDLHOME=${gs2build.home}"/>
2297 </exec>
2298 </target>
2299
2300
2301 <target name="distclean-build-src" depends="init,clean-build-src" if="collection.building.enabled">
2302 <!-- unix: -->
2303 <if><bool><available file="${build.src.home}/Makefile"/></bool>
2304 <exec executable="make" os="${os.unix}" dir="${build.src.home}" failonerror="true">
2305 <arg value="distclean"/>
2306 </exec>
2307 </if>
2308 <!-- windows: distclean = clean + remove configure products (remove makefiles). But on Windows there is no removing makefiles, so we just call clean -->
2309 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
2310 <arg value="/f"/>
2311 <arg value="win32.mak"/>
2312 <arg value="clean"/>
2313 <arg value="GSDLHOME=${gs2build.home}"/>
2314 </exec>
2315 </target>
2316
2317 <target name="configure-build-src" depends="init" if="collection.building.enabled"
2318 description="Configure the build-src component">
2319 <exec executable="${build.src.home}/configure" os="${os.unix}"
2320 dir="${build.src.home}" failonerror="true">
2321 <arg value="--prefix=${gs2build.home}"/>
2322 <arg line="${gs2.opt.args} ${static.arg} ${cross.configure.args} ${allargs}"/>
2323 </exec>
2324 </target>
2325
2326 <!-- common-src is done separately and needs to be compiled first -->
2327 <target name="compile-build-src" depends="init" if="collection.building.enabled">
2328
2329 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
2330 <arg line="${ldlpath.arg}"/>
2331 </exec>
2332
2333 <exec executable="make" dir="${build.src.home}" os="${os.unix}" failonerror="true">
2334 <arg value="install"/>
2335 </exec>
2336
2337 <!-- run the setup script -->
2338 <!-- <exec executable="${compile.windows.c++.setup}" os="${os.windows}" failonerror="true"/>-->
2339 <!--Above does not work: even though vcvars.bat executes, the env changes it makes don't get saved. Need user to run vcvars.bat first before calling ant-->
2340 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
2341 <arg value="/f"/>
2342 <arg value="win32.mak"/>
2343 <arg value="GSDLHOME=${gs2build.home}"/>
2344 </exec>
2345 <exec executable="nmake" dir="${build.src.home}" os="${os.windows}" failonerror="true">
2346 <arg value="/f"/>
2347 <arg value="win32.mak"/>
2348 <arg value="install"/>
2349 <arg value="GSDLHOME=${gs2build.home}"/>
2350 </exec>
2351 </target>
2352
2353
2354 <!-- ======================== TESTING Targets ========================= -->
2355
2356 <target name="test" description="Run the (incomplete) JUnit test suite "
2357 depends="init">
2358 <mkdir dir="${basedir}/test"/>
2359 <junit printsummary="withOutAndErr"
2360 errorproperty="test.failed"
2361 failureproperty="test.failed"
2362 fork="${junit.fork}">
2363 <formatter type="plain"/>
2364 <classpath>
2365 <pathelement location="${build.home}/gsdl3test.jar"/>
2366 <path refid="compile.classpath"/>
2367 </classpath>
2368 <test name="${testcase}" if="testcase"/>
2369 <batchtest todir="${basedir}/test" unless="testcase">
2370 <fileset dir="${build.home}" includes="**/*Test.class" />
2371 </batchtest>
2372 </junit>
2373 <echo>
2374 *********************************************
2375 Test output can be found in directory 'test'
2376 *********************************************
2377 </echo>
2378 </target>
2379
2380 <!-- ======================== FLAX Targets ========================= -->
2381 <target name="prepare-flax" description="check out flax source code from another repository" if="install.flax">
2382 <echo>checking out flax ...</echo>
2383 <mkdir dir="${basedir}/src/java/org/flax"/>
2384 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/flax"/>
2385 <mkdir dir="${basedir}/src/java/org/greenstone/gsdl3/action/flax"/>
2386 <mkdir dir="${web.home}/WEB-INF/classes/flax"/>
2387 <mkdir dir="${web.home}/interfaces/flax"/>
2388 <mkdir dir="${web.home}/sites/flax"/>
2389 <mkdir dir="${basedir}/flax-resources"/>
2390 <mkdir dir="${basedir}/flax-lib"/>
2391 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/flax"/>
2392 <arg value="src/java/org/flax"/></exec>
2393 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/flax"/>
2394 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
2395 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/src/java/org/greenstone/gsdl3/action/flax"/>
2396 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
2397 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/WEB-INF/classes/flax"/>
2398 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
2399 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/interfaces/flax"/>
2400 <arg value="${web.home}/interfaces/flax"/></exec>
2401 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/web/sites/flax"/>
2402 <arg value="${web.home}/sites/flax"/></exec>
2403 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/flax-resources"/>
2404 <arg value="flax-resources"/></exec>
2405 <exec executable="svn"><arg value="checkout"/><arg value="${flax.checkout.path}/lib"/>
2406 <arg value="flax-lib"/></exec>
2407 <antcall target="flax-copy-del-files" />
2408 </target>
2409
2410 <target name="flax-copy-del-files" description="copy some flax files into the appropriate greenstone3 directories and delete some unwanted greenstone stuff">
2411 <copy file="${web.home}/WEB-INF/classes/flax/web.xml" todir="${web.home}/WEB-INF" overwrite="true" />
2412 <copy todir="${web.home}/WEB-INF/lib">
2413 <fileset dir="${basedir}/flax-lib">
2414 <include name="*.jar"/>
2415 </fileset>
2416 </copy>
2417 <!--<delete dir="${web.home}/sites/gateway"/>
2418 <delete dir="${web.home}/sites/localsite"/>-->
2419 </target>
2420
2421 <target name="update-flax" description="update flax from repository">
2422 <echo>updating flax ...</echo>
2423 <exec executable="svn"><arg value="update"/>
2424 <arg value="src/java/org/flax"/></exec>
2425 <exec executable="svn"><arg value="update"/>
2426 <arg value="src/java/org/greenstone/gsdl3/action/flax"/></exec>
2427 <exec executable="svn"><arg value="update"/>
2428 <arg value="src/java/org/greenstone/gsdl3/flax"/></exec>
2429 <exec executable="svn"><arg value="update"/>
2430 <arg value="${web.home}/WEB-INF/classes/flax"/></exec>
2431 <exec executable="svn"><arg value="update"/>
2432 <arg value="${web.home}/interfaces/flax"/></exec>
2433 <exec executable="svn"><arg value="update"/>
2434 <arg value="${web.home}/web/sites/flax"/></exec>
2435 <exec executable="svn"><arg value="update"/>
2436 <arg value="flax-resources"/></exec>
2437 <exec executable="svn"><arg value="update"/>
2438 <arg value="flax-lib"/></exec>
2439 <antcall target="compile-core" />
2440 </target>
2441
2442 <!-- ========================End of FLAX Targets ========================= -->
2443
2444 <target name="compile-javadocs">
2445 <javadoc packagenames="org.greenstone.*"
2446 sourcepath="src/java"
2447 defaultexcludes="yes"
2448 destdir="docs/javadoc"
2449 author="true"
2450 version="true"
2451 use="true"
2452 windowtitle="Greenstone3 API">
2453 <doctitle><![CDATA[<h1>Greenstone3 API</h1>]]></doctitle>
2454 </javadoc>
2455 </target>
2456
2457<!-- ========== Some distribution targets ======================== -->
2458 <target name="remove-source">
2459 <if><bool><isset property="with.gli.and.gems"/></bool>
2460 <delete includeEmptyDirs="true">
2461 <fileset dir="." defaultexcludes="false">
2462 <patternset refid="greenstone3.source.component"/>
2463 </fileset>
2464 </delete>
2465
2466 <else>
2467 <delete includeEmptyDirs="true">
2468 <fileset dir="." defaultexcludes="false">
2469 <patternset refid="greenstone3.source.no.gli.component"/>
2470 </fileset>
2471 </delete>
2472 </else>
2473 </if>
2474 </target>
2475
2476 <target name="dist-tidy"
2477 description="'tidies-up' a greenstone3 installation for distribution.">
2478
2479 <!-- delete unneeded things -->
2480 <delete dir="${packages.home}/axis"/>
2481 <delete><fileset dir="${packages.home}" includes="*.zip"/></delete>
2482 <delete file="README-SVN.txt"/>
2483 <delete file="build.properties.in"/>
2484
2485 <!-- delete source files -->
2486 <antcall target="remove-source"/>
2487
2488 <!-- create empty directories -->
2489 <mkdir dir="${web.home}/applet"/>
2490 <mkdir dir="${web.home}/logs"/>
2491 <mkdir dir="${web.home}/logs/tmp"/>
2492
2493 <!-- os specific tidy-ups -->
2494 <!-- linux, mac -->
2495 <if><bool><istrue value="${current.os.isunix}"/></bool>
2496 <delete><fileset dir="." includes="*.bat"/></delete>
2497 <if><bool><isset property="with.gli.and.gems"/></bool>
2498 <delete><fileset dir="gli" includes="*.bat"/></delete>
2499 </if>
2500 <delete><fileset dir="gs2build" includes="*.bat"/></delete>
2501 <delete><fileset dir="bin/script" includes="*.bat"/></delete>
2502 <delete file="${basedir}/gs2build/win32cfg.h"/>
2503 <delete file="${basedir}/gs2build/win32.mak"/>
2504 <delete dir="${basedir}/winutil"/>
2505 <delete failonerror="false"><fileset dir="${lib.jni}" includes="*.dll"/></delete>
2506
2507 <!-- windows -->
2508 <else><if><bool><istrue value="${current.os.iswindows}"/></bool>
2509 <delete><fileset dir="." includes="*.sh,*.bash,*.csh"/></delete>
2510 <if><bool><isset property="with.gli.and.gems"/></bool>
2511 <delete><fileset dir="gli" includes="*.sh,*.bash,*.csh"/></delete>
2512 </if>
2513 <delete><fileset dir="gs2build" includes="*.sh,*.bash,*.csh"/></delete>
2514 <delete><fileset dir="bin/script" includes="*.sh,*.bash,*.csh"/></delete>
2515 </if></else></if>
2516
2517 </target>
2518
2519 <!-- fix up executable permissions for binary release -->
2520 <target name="fix-execute-permissions">
2521 <echo>Setting binaries to executable</echo>
2522 <chmod perm="775">
2523 <fileset dir="."><patternset refid="greenstone3.executables"/></fileset>
2524 </chmod>
2525 </target>
2526
2527 <!-- fix up executable permissions for source code release -->
2528 <target name="fix-execute-permissions-source">
2529 <chmod perm="775">
2530 <fileset dir="."><patternset refid="greenstone3.source.executables"/></fileset>
2531 </chmod>
2532 </target>
2533
2534
2535 <!-- ============= tweaks for making compilation static ========== -->
2536 <target name="tweak-makefiles" depends="init" if="compile.static">
2537 <antcall target="rtftohtml-add-static" />
2538 </target>
2539
2540 <target name="rtftohtml-add-static" depends="init" if="collection.building.enabled">
2541 <rsr file="${gs2build.home}/build-src/packages/rtftohtml/rtftohtml_src/Makefile" pattern="-o rtftohtml(.{2})EXEEXT(.{1})" replacement="-o rtftohtml$1EXEEXT$2 -static" />
2542 </target>
2543
2544 <target name="run-collection-tests">
2545 <if><bool><not><available file="${basedir}/ext/testing" type="dir"/></not></bool>
2546 <fail>The testing extension is not available. This is required to perform the tests. It can be acquired from SVN by running the command "svn co http://svn.greenstone.org/gs3-extensions/testing/trunk/src testing" in the ext directory of your Greenstone 3 installation. </fail>
2547 </if>
2548 <for param="testjar">
2549 <path>
2550 <fileset dir="${basedir}" includes="web/sites/*/collect/*/tests/tests.jar"/>
2551 </path>
2552 <sequential>
2553 <echo>Testing @{testjar}</echo>
2554 <java classname="org.junit.runner.JUnitCore" fork="true">
2555 <arg value="gstests.TestClass"/>
2556 <jvmarg value="-DSERVERURL=http://${tomcat.server}:${tomcat.port}${app.path}${server.default.servlet} "/>
2557 <classpath>
2558 <fileset dir="${basedir}/ext/testing/lib/java">
2559 <include name="*.jar"/>
2560 </fileset>
2561 <files includes="@{testjar}"/>
2562 </classpath>
2563 </java>
2564 </sequential>
2565 </for>
2566 </target>
2567
2568 <target name="build-collection-tests">
2569 <if><bool><not><available file="${basedir}/ext/testing" type="dir"/></not></bool>
2570 <fail>The testing extension is not available. This is required to perform the tests. It can be acquired from SVN by running the command "svn co http://svn.greenstone.org/gs3-extensions/testing/trunk/src testing" in the ext directory of your Greenstone 3 installation. </fail>
2571 </if>
2572 <for param="compiledir">
2573 <path>
2574 <dirset dir="${basedir}" includes="web/sites/*/collect/*/tests/src"/>
2575 </path>
2576 <sequential>
2577 <echo>Compiling @{compiledir}</echo>
2578 <if><bool><not><available file="@{compiledir}/../build" type="dir"/></not></bool>
2579 <mkdir dir="@{compiledir}/../build"/>
2580 </if>
2581 <javac
2582 srcdir="@{compiledir}"
2583 destdir="@{compiledir}/../build"
2584 debug="${compile.debug}"
2585 deprecation="${compile.deprecation}"
2586 optimize="${compile.optimize}">
2587 <classpath>
2588 <fileset dir="${basedir}/ext/testing/lib/java">
2589 <include name="*.jar"/>
2590 </fileset>
2591 </classpath>
2592 <include name="gstests/*.java"/>
2593 </javac>
2594 <jar destfile="@{compiledir}/../tests.jar">
2595 <fileset dir="@{compiledir}/../build">
2596 <include name="gstests/**"/>
2597 </fileset>
2598 <manifest>
2599 <attribute name="Built-By" value="${user.name}" />
2600 </manifest>
2601 </jar>
2602 </sequential>
2603 </for>
2604 </target>
2605</project>
Note: See TracBrowser for help on using the repository browser.