source: trunk/build.xml @ 3284

Last change on this file since 3284 was 3284, checked in by Martin Svensson, 16 years ago

Would hopefully solve the problems to generate the documentation when not able to open DTD files over internet.
Re-organized in build/docbook/

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 37.8 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3    $Id: build.xml 3284 2007-05-02 12:56:18Z martin $
4
5    Copyright (C) 2005-2006
6    Samuel Andersson, Jari H&auml;kkinen, Nicklas Nordborg, Gregory Vincic
7
8    This file is part of BASE - BioArray Software Environment.
9    Available at http://base.thep.lu.se/
10
11    BASE is free software; you can redistribute it and/or modify it
12    under the terms of the GNU General Public License as published by
13    the Free Software Foundation; either version 2 of the License, or
14    (at your option) any later version.
15
16    BASE is distributed in the hope that it will be useful, but
17    WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19    General Public License for more details.
20
21    You should have received a copy of the GNU General Public License
22    along with this program; if not, write to the Free Software
23    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24    02111-1307, USA.
25-->
26
27<project
28  name="BASE2"
29  default="dev"
30  basedir="."
31  >
32  <description>
33    Build file for BASE 2. The main targets are ('dev' is default):
34
35    Clean up:
36    clean:        Remove all generated files
37
38    Compiling code
39    core:         Build core for local use
40    coreplugins:  Build core plugins for local use
41    dev:          Build everything for local use
42    dist:         Build everything (except test) for distribution (put in 'dist'
43                  subdirectory)
44    installprg:   Build installation programs for local use
45    jobagent:     Build jobagent for local use
46    migrate:      Build migration tool for local use
47    test:         Build test programs
48    web:          Build web client application for local use
49
50    Documentation:
51    doc:          Build documentation for local use
52    docbook:      Build html and pdf from docbook (to be included in 'ant doc')
53    helptext:     Generate help text import file from the docbook documentation
54
55    Packaging:
56    package:      Create *.tar.gz files with binary and source distributions
57  </description>
58
59  <!-- set BASE version
60    Use numerical versions for bugix (maintenance) releases starting
61    with "1". Use "0" for the first release of a new trunk version.  Add
62    "pre" to unreleased versions.  Examples: 2.1.1pre, 2.1.1,
63    2.1.2pre, 2.2.2, 2.2.0pre, 2.2.0, 2.2.1pre, 2.2.1
64  -->
65  <property name="base.majorversion" value="2" />
66  <property name="base.minorversion" value="3" />
67  <property name="base.maintenanceversion" value="0pre" />
68  <property name="base.version" 
69    value="${base.majorversion}.${base.minorversion}.${base.maintenanceversion}" />
70 
71  <!-- set other global properties for this build -->
72  <property name="javac.arg" value="-Xlint:unchecked" 
73    description="Extra arguments sent to Java compiler" />
74  <property name="src" location="src" description="Location of source files" />
75  <property name="build" location="build" description="Location of compiled files" />
76  <property name="dist" location="dist" description="Directory where distribution should be created" />
77  <property name="lib" location="lib" description="Location of 3rd-party JAR files" />
78  <property name="config.dist" location="config/dist" 
79    description="Location of default configuration files" />
80  <property name="config.local" location="config/local" 
81    description="Location of local configuration files" />
82 
83  <!-- main class path for compilation -->
84  <path id="core.classpath" 
85    description="Main classpath to all 3rd-party JAR files required for compilation">
86    <fileset dir="${lib}/dist">
87      <include name="**/*.jar"/>
88    </fileset>
89  </path>
90
91  <!-- pattern for configuration files use by copy.config -->
92  <patternset id="config.files">
93    <include name="*.*" />
94    <exclude name="web.xml" />
95    <exclude name="readme.txt" />
96  </patternset>
97 
98  <!-- task definitions -->
99  <taskdef
100    name="hibernatedoclet"
101    classname="xdoclet.modules.hibernate.HibernateDocletTask"
102    description="Task for generating Hibernate mapping files from XDoclet tags"
103    >
104    <classpath>
105      <fileset dir="${lib}/hibernatedoclet">
106        <include name="**/*.jar"/>
107      </fileset>
108    </classpath>
109  </taskdef>
110
111  <taskdef
112    name="svn"
113    classname="org.tigris.subversion.svnant.SvnTask"
114    description="Task for interacting with subversion"
115    >
116    <classpath>
117      <fileset dir="${lib}/svn">
118        <include name="**/*.jar"/>
119      </fileset>
120    </classpath>
121  </taskdef>
122 
123  <!-- main targets -->
124  <target
125    name="clean"
126    description="Remove all generated files and backup files" >
127    <delete failonerror="false" includeemptydirs="true">
128      <fileset dir="${build}" defaultexcludes="no" />
129      <fileset dir="${dist}" defaultexcludes="no" />
130      <fileset dir="bin/jar" defaultexcludes="no" />
131      <fileset dir="www/WEB-INF/lib" defaultexcludes="no" />
132      <fileset dir="www/WEB-INF/classes" defaultexcludes="no" />
133      <fileset dir="www/WEB-INF" includes="web.xml" defaultexcludes="no" />
134      <fileset dir="doc/api" defaultexcludes="no" />
135      <fileset dir="doc/docbook" defaultexcludes="no" />
136      <fileset file="doc/development/plugins/exampleplugins.tar.gz" />
137    </delete>
138  </target>
139 
140  <target
141    name="dist"
142    depends="clean,dist.init,core.jar,coreplugins.jar,web.jar,installprg.jar,
143      jobagent.jar,migrate.jar,copy.config,copy.jar,doc,doc.dist"
144    description="Create everything needed for distribution"
145    >
146    <copy file="${config.dist}/web.xml" todir="${config}/.." description="Default web.xml" />
147    <copy todir="${dist}/www" description="JSP files, etc.">
148      <fileset dir="www" />
149    </copy>
150    <copy todir="${dist}/data" description="Additional data files">
151      <fileset dir="data" />
152    </copy>
153    <copy todir="${dist}/bin" description="Scripts, etc.">
154      <fileset dir="bin" />
155    </copy>
156    <copy todir="${dist}/misc" description="Other files">
157      <fileset dir="misc">
158        <include name="sql/**/*" />
159        <include name="config/**/*" />
160      </fileset>
161    </copy>
162    <copy todir="${dist}" description="License and creadits">
163      <fileset file="base2.license.txt" />
164      <fileset file="credits.txt" />
165    </copy>
166    <chmod dir="." includes="**/*.sh" perm="a+x" description="Make all scripts executable" />
167  </target>
168
169  <target
170    name="package"
171    depends="package.bin,package.src"
172    description="Generate tar.gz files for the binary and source distribution"
173    >
174  </target>
175 
176  <target
177    name="dev"
178    depends="dev.init,core,coreplugins,web,installprg,jobagent,migrate,test"
179    description="Create a runnable local installation"
180  />
181 
182  <target
183    name="core"
184    depends="dev.init,core.jar"
185    description="Build the core for local use"
186  />
187
188  <target
189    name="coreplugins"
190    depends="core,coreplugins.jar"
191    description="Build the core plugins for local use"
192  />
193 
194  <target
195    name="exampleplugins"
196    depends="core,exampleplugins.jar"
197    description="Build the example plugins for local use"
198  />
199 
200  <target
201    name="test"
202    depends="test.jar,core.hibernate"
203    description="Compile the test programs for local use"
204    >
205    <mkdir dir="${test.build}/data" />
206    <copy todir="${test.build}/data" description="Test-data files">
207      <fileset dir="${test.src}/data">
208        <include name="**/*" />
209      </fileset>
210    </copy>
211    <copy todir="${test.build}" description="Script files, etc.">
212      <fileset dir="${test.src}">
213        <include name="**/*" />
214        <exclude name="**/*.java" />
215      </fileset>
216    </copy>
217    <chmod dir="${test.build}" includes="*.sh" perm="a+x"/>
218  </target>
219 
220  <target
221    name="web"
222    depends="core,coreplugins,web.jar,copy.config,copy.jar"
223    description="Build web client application for local use"
224    >
225  </target>
226 
227  <target
228    name="installprg"
229    depends="web,installprg.jar"
230    description="Build installation programs for local use"
231  />
232 
233  <target
234    name="jobagent"
235    depends="web,jobagent.jar"
236    description="Build job agent for local use"
237  />
238 
239  <target
240    name="migrate"
241    depends="web,migrate.jar"
242    description="Build migration tool for local use"
243  />
244 
245  <target
246    name="doc"
247    depends="doc.javadoc,exampleplugins.tar,doc.docbook"
248    description="Generate documentation for local use"
249  />
250 
251  <target
252    name="docbook"
253    depends="dev.init,doc.docbook"
254    description="Generate docbook documentation. This target is temporary.
255      It will be included in the 'doc' target in the future."
256  />
257 
258  <!-- init targets -->
259  <target
260    name="init"
261    depends="svn.revision"
262    description="Initialise things"
263    >
264  </target>
265 
266  <target
267    name="dist.init"
268    depends="init"
269    unless="isDev"
270    >
271    <property name="isDist" value="1" />
272    <property name="jar" location="${dist}/www/WEB-INF/lib" />
273    <property name="config" location="${dist}/www/WEB-INF/classes" />
274    <property name="bin" location="${dist}/bin" />
275    <property name="doc" location="${dist}/doc" />
276    <mkdir dir="${jar}" />
277    <mkdir dir="${config}" />
278    <mkdir dir="${bin}" />
279    <mkdir dir="${bin}/jar" />
280    <mkdir dir="${dist}/data" />
281    <mkdir dir="${dist}/doc" />
282    <mkdir dir="${dist}/misc" />
283  </target>
284 
285  <target
286    name="dev.init"
287    depends="init"
288    unless="isDist"
289    >
290    <property name="isDev" value="1" />
291    <property name="jar" location="www/WEB-INF/lib" />
292    <property name="config" location="www/WEB-INF/classes" />
293    <property name="bin" location="bin" />
294    <property name="doc" location="doc" />
295    <mkdir dir="${bin}/jar" />
296    <mkdir dir="${jar}" />
297    <mkdir dir="${config}" />
298  </target>
299 
300  <target 
301    name="svn.revision"
302    description="Get the current revision number in the subversion and put the
303      value into the base.build property; replaced by constant expression in source distributions"
304    >
305    <svn>
306      <status path="." lastChangedRevisionProperty="base.build" />
307    </svn>
308    <echo message="Build #${base.build}" />
309  </target>
310 
311  <!-- configuration targets -->
312  <target
313    name="copy.config"
314    depends="copy.config.local,copy.config.dist"
315    description="Copies configuration files to the appropriate folder"
316    >
317  </target>
318   
319  <target
320    name="copy.config.dist"
321    >
322    <copy todir="${config}" description="Default configuration files">
323      <fileset dir="${config.dist}">
324        <patternset refid="config.files" />
325        <present present="srconly" targetdir="${config}" />
326      </fileset>
327    </copy>
328    <copy todir="${config}/.."  description="Default web.xml">
329      <fileset dir="${config.dist}">
330        <include name="web.xml" />
331        <present present="srconly" targetdir="${config}/.." />
332      </fileset>
333    </copy>
334  </target>
335 
336  <target
337    name="copy.config.local"
338    if="isDev"
339    unless="isDist"
340    >
341    <copy todir="${config}" description="Local configuration files">
342      <fileset dir="${config.local}">
343        <patternset refid="config.files" />
344      </fileset>
345    </copy>
346    <copy todir="${config}/.."  description="Local web.xml">
347      <fileset dir="${config.local}">
348        <include name="web.xml" />
349      </fileset>
350    </copy>
351  </target>
352 
353  <target
354    name="copy.jar"
355    description="Copy required jar files to the appropriate folder"
356    >
357    <copy todir="${jar}" description="3rd-party JAR files">
358      <fileset dir="${lib}/dist">
359        <include name="**/*" />
360      </fileset>
361    </copy>
362  </target>
363 
364  <!-- core targets -->
365  <target
366    name="core.init"
367    depends="dev.init"
368    >
369    <property name="core.src" location="${src}/core" 
370      description="Location of core source files" />
371    <property name="core.build" location="${build}/core" 
372      description="Location of compiled core files" />
373  </target>
374 
375  <target
376    name="core.compile"
377    depends="core.init"
378    description="Compile the core"
379    >
380    <mkdir dir="${core.build}"/>
381    <javac
382      srcdir="${core.src}"
383      destdir="${core.build}"
384      classpathref="core.classpath"
385      encoding="ISO-8859-1"
386      debug="true"
387      deprecation="true"
388      >
389      <compilerarg value="${javac.arg}" />
390    </javac>
391    <copy todir="${core.build}" 
392      description="Resource files needed by the core; excludes documentation and source files">
393      <fileset dir="${core.src}">
394        <include name="**/*" />
395        <exclude name="**/*.java" />
396        <exclude name="**/doc-files/" />
397        <exclude name="**/package.html" />
398      </fileset>
399    </copy>
400    <replace file="${core.build}/base.version">
401      <replacefilter 
402        token="@MAJOR@"
403        value="${base.majorversion}"
404      />
405      <replacefilter 
406        token="@MINOR@"
407        value="${base.minorversion}"
408      />
409      <replacefilter 
410        token="@MAINTENANCE@"
411        value="${base.maintenanceversion}"
412      />
413      <replacefilter 
414        token="@BUILD@"
415        value="${base.build}"
416      />
417    </replace>
418  </target>
419
420  <target
421    name="check.hibernate"
422    depends="core.init"
423    >
424    <uptodate
425      property="nohibernate"
426      >
427      <srcfiles dir="${core.src}/net/sf/basedb/core/data" includes="**/*.java">
428        <contains text="@hibernate.class" />
429      </srcfiles>
430      <mapper type="glob" from="*.java" to="${core.build}/net/sf/basedb/core/data/*.hbm.xml" />
431    </uptodate>
432    <condition property="hibernate.message" 
433      value="up to date; skipping" 
434      >
435      <istrue value="${nohibernate}" />
436    </condition>
437    <condition property="hibernate.message" 
438      value="not up to date; generating new" 
439      >
440      <isfalse value="${nohibernate}" />
441    </condition>
442    <echo>Hibernate mapping files are ${hibernate.message}</echo>
443  </target>
444 
445  <target
446    name="core.hibernate"
447    depends="core.init,core.compile,check.hibernate"
448    description="Generates Hibernate mapping files from the source code"
449    unless="nohibernate"
450    >
451    <delete>
452      <fileset dir="${core.build}" includes="**/*.hbm.xml" />
453    </delete>
454    <copy todir="${core.build}" 
455      description="Hardcoded *.hbm.xml files">
456      <fileset dir="${core.src}" includes="**/*.hbm.xml" />
457    </copy>
458    <hibernatedoclet
459      destdir="${core.build}"
460      excludedtags="@version,@author,@todo"
461      mergedir="${core.build}"
462      verbose="${xdoclet.verbose}">
463      <fileset dir="${core.src}">
464        <include name="**/*.java"/>
465      </fileset>
466      <hibernate version="2.0"/>
467    </hibernatedoclet>
468   
469    <replace
470      dir="${core.build}"
471      >
472      <include name="**/*.hbm.xml"/>
473      <replacefilter 
474        token="2.0//EN"
475        value="3.0//EN"
476      />
477      <replacefilter 
478        token="2.0.dtd"
479        value="3.0.dtd"
480      />
481      <replacefilter
482        token="outer-join=&#34;false&#34;"
483        value="fetch=&#34;select&#34;"
484      />
485      <replacefilter
486        token="outer-join=&#34;true&#34;"
487        value="fetch=&#34;join&#34;"
488      />
489      <replacefilter
490        token="index-many-to-many"
491        value="map-key-many-to-many"
492      />
493      <replacefilter
494        token="&lt;index&gt;"
495        value="&lt;list-index&gt;"
496      />
497      <replacefilter
498        token="&lt;/index&gt;"
499        value="&lt;/list-index&gt;"
500      />
501      <replacefilter
502        token="composite-index"
503        value="composite-map-key"
504      />
505    </replace>
506  </target>
507 
508  <target
509    name="core.jar"
510    depends="core.init,core.compile,core.hibernate"
511    description="Create the core jar file: BASE2Core.jar"
512    >
513    <jar
514      basedir="${core.build}"
515      jarfile="${jar}/BASE2Core.jar"
516    />
517  </target>
518
519  <!-- core plugin targets -->
520  <target
521    name="coreplugins.init"
522    depends="core.init"
523    >
524    <property name="coreplugins.src" location="${src}/plugins/core" 
525      description="Location of source files" />
526    <property name="coreplugins.build" location="${build}/plugins/core" 
527      description="Location of compiled files" />
528    <path id="coreplugins.classpath" description="Class path for compiling plugins">
529      <path refid="core.classpath"/>
530      <pathelement location="${core.build}"/>
531    </path>
532  </target>
533 
534  <target
535    name="coreplugins.compile"
536    depends="core.compile,coreplugins.init"
537    description="Compile the core plugins"
538    >
539    <mkdir dir="${coreplugins.build}" />
540    <javac
541      srcdir="${coreplugins.src}"
542      destdir="${coreplugins.build}"
543      classpathref="coreplugins.classpath"
544      encoding="ISO-8859-1"
545      debug="true"
546      deprecation="true"
547      >
548      <compilerarg value="${javac.arg}" />
549    </javac>
550  </target>
551 
552  <target
553    name="coreplugins.jar"
554    depends="coreplugins.compile"
555    description="Create the plugin jar file: BASE2CorePlugins.jar"
556    >
557    <jar
558      basedir="${coreplugins.build}"
559      jarfile="${jar}/BASE2CorePlugins.jar"
560    />
561  </target>
562 
563  <!-- example plugin targets -->
564  <target
565    name="exampleplugins.init"
566    depends="core.init"
567    >
568    <property name="exampledir" location="${src}/examples/plugins" />
569    <property name="exampleplugins.src" location="${exampledir}/src" 
570      description="Location of source files" />
571    <property name="exampleplugins.build" location="${build}/plugins/example" 
572      description="Location of compiled files" />
573    <path id="exampleplugins.classpath" description="Class path for compiling plugins">
574      <path refid="core.classpath"/>
575      <pathelement location="${core.build}"/>
576    </path>
577  </target>
578 
579  <target
580    name="exampleplugins.compile"
581    depends="core.compile,exampleplugins.init"
582    description="Compile the example plugins"
583    >
584    <mkdir dir="${exampleplugins.build}" />
585    <javac
586      srcdir="${exampleplugins.src}"
587      destdir="${exampleplugins.build}"
588      classpathref="exampleplugins.classpath"
589      encoding="ISO-8859-1"
590      debug="true"
591      deprecation="true"
592      >
593      <compilerarg value="${javac.arg}" />
594    </javac>
595  </target>
596 
597  <target
598    name="exampleplugins.jar"
599    depends="exampleplugins.compile"
600    description="Create the example plugins jar file: ExamplePlugins.jar"
601    >
602    <jar
603      basedir="${exampleplugins.build}"
604      jarfile="${jar}/ExamplePlugins.jar"
605      manifest="${exampledir}/MANIFEST.MF"
606    />
607  </target>
608
609  <target
610    name="exampleplugins.tar"
611    depends="exampleplugins.jar"
612    description="Create a downloadable tar file with the example plugins"
613    >
614    <mkdir dir="${doc}/development/plugins" />
615    <tar
616      destfile="${doc}/development/plugins/exampleplugins.tar.gz"
617      compression="gzip"
618      >
619      <tarfileset
620        dir="${exampledir}"
621        preserveLeadingSlashes="true"
622      />
623      <tarfileset
624        dir="${exampleplugins.build}"
625        prefix="bin"
626        preserveLeadingSlashes="true"
627      />
628    </tar>
629  </target>
630 
631  <!-- test targets -->
632  <target
633    name="test.init"
634    depends="core.init,coreplugins.init,jobagent.init"
635    >
636    <property name="test.src" location="${src}/test" 
637      description="Location of source files" />
638    <property name="test.build" location="${build}/test" 
639      description="Location of compiled files" />
640    <path id="test.classpath" description="Class path for compiling">
641      <path refid="core.classpath"/>
642      <pathelement location="${core.build}" />
643      <pathelement location="${coreplugins.build}" />
644      <pathelement location="${jobagent.build}" />
645    </path>
646  </target>
647 
648  <target
649    name="test.compile"
650    depends="test.init,core.compile,coreplugins.compile,jobagent.compile"
651    description="Compile the test programs"
652    >
653    <mkdir dir="${test.build}" />
654    <javac
655      srcdir="${test.src}"
656      destdir="${test.build}"
657      classpathref="test.classpath"
658      encoding="ISO-8859-1"
659      debug="true"
660      deprecation="true"
661      >
662      <compilerarg value="${javac.arg}" />
663    </javac>
664  </target>
665 
666  <target
667    name="test.jar"
668    depends="test.compile"
669    description="Create a JAR file used by the test programs; Delete corresponding .class files"
670    >
671    <jar 
672      jarfile="${test.build}/JarPluginAbout.jar" 
673      basedir="${test.build}" 
674      includes="JarPluginAbout.class" 
675    />
676    <jar 
677      jarfile="${test.build}/JarPlugin.jar" 
678      basedir="${test.build}" 
679      includes="JarPlugin*,NullPlugin*"
680      excludes="JarPlugin.jar,JarPluginAbout.*"
681      manifest="${test.src}/data/JarPluginManifest.txt"
682    />
683    <delete>
684      <fileset dir="${test.build}" includes="JarPlugin*.class" />
685    </delete>
686  </target>
687
688  <!-- web targets -->
689  <target
690    name="web.init"
691    depends="core.init,coreplugins.init"
692    >
693    <property name="web.src" location="${src}/clients/web" 
694      description="Location of source files" />
695    <property name="web.build" location="${build}/clients/web" 
696      description="Location of compiled files" />
697    <property name="web.inf" location="www/WEB-INF" 
698      description="Location of the WEB-INF folder" />
699    <path id="web.classpath" description="Class path for compiling web client">
700      <path refid="core.classpath"/>
701      <pathelement location="${core.build}"/>
702      <pathelement location="${coreplugins.build}" />
703      <fileset dir="${lib}/servlet">
704        <include name="**/*.jar"/>
705      </fileset>
706    </path>
707  </target>
708 
709  <target
710    name="web.compile"
711    depends="web.init,core.compile"
712    description="Compile the web client application"
713    >
714    <mkdir dir="${web.build}" />
715    <javac
716      srcdir="${web.src}"
717      destdir="${web.build}"
718      classpathref="web.classpath"
719      encoding="ISO-8859-1"
720      debug="true"
721      deprecation="true"
722      >
723      <compilerarg value="${javac.arg}" />
724    </javac>
725  </target>
726 
727  <target
728    name="web.jar"
729    depends="web.compile"
730    description="Create the web client jar file: BASE2Webclient.jar"
731    >
732    <jar
733      basedir="${web.build}"
734      jarfile="${jar}/BASE2Webclient.jar"
735    />
736  </target>
737 
738  <target 
739    name="web.jsp"
740    depends="web"
741    description="Compile all JSP pages to a temporary directory; used for checking only"
742    >
743    <property name="jsp.build" location="${build}/jsp" />
744    <property environment="env" />
745    <mkdir dir="${jsp.build}/src" />
746    <mkdir dir="${jsp.build}/classes" />
747   
748    <path id="jsp.precompile.classpath">
749      <pathelement location="${java.home}/../lib/tools.jar" />
750      <fileset dir="${env.CATALINA_HOME}/server/lib">
751        <include name="*.jar" />
752      </fileset>
753      <fileset dir="${env.CATALINA_HOME}/common/lib">
754        <include name="*.jar" />
755      </fileset>
756      <fileset dir="${env.CATALINA_HOME}/bin">
757        <include name="*.jar" />
758      </fileset>
759    </path>
760   
761    <path id="jsp.compile.classpath">
762      <path refid="web.classpath" />
763      <pathelement location="${java.home}/../lib/tools.jar" />
764      <fileset dir="${env.CATALINA_HOME}/common/lib">
765        <include name="*.jar" />
766      </fileset>
767      <fileset dir="${env.CATALINA_HOME}/shared/lib">
768        <include name="*.jar" />
769      </fileset>
770      <fileset dir="${web.inf}/lib">
771        <include name="*.jar" />
772      </fileset>
773    </path>
774
775    <taskdef
776      classname="org.apache.jasper.JspC" 
777      name="jasper2"
778      classpathref="jsp.precompile.classpath"
779    />
780    <jasper2
781      validateXml="false"
782      uriroot="www"
783      webXmlFragment="${jsp.build}/generated_web.xml"
784      outputdir="${jsp.build}/src"
785    />
786    <javac
787      destdir="${jsp.build}/classes"
788      srcdir="${jsp.build}/src"
789      debug="true"
790      classpathref="jsp.compile.classpath"
791      memoryinitialsize="256m"
792      memorymaximumsize="512m"
793      fork="true"
794      >
795    </javac>
796  </target>
797 
798  <!-- installprg targets -->
799  <target
800    name="installprg.init"
801    depends="core.init,coreplugins.init,web.init"
802    >
803    <property name="installprg.src" location="${src}/install" 
804      description="Location of source files" />
805    <property name="installprg.build" location="${build}/install" 
806      description="Location of compiled files" />
807    <path id="installprg.classpath" description="Class path for compiling installation programs">
808      <path refid="core.classpath"/>
809      <pathelement location="${core.build}"/>
810      <pathelement location="${coreplugins.build}"/>
811      <pathelement location="${web.build}"/>
812    </path>
813  </target>
814  <target
815    name="installprg.compile"
816    depends="installprg.init,core.compile"
817    description="Compile the installation programs"
818    >
819    <mkdir dir="${installprg.build}" />
820    <javac
821      srcdir="${installprg.src}"
822      destdir="${installprg.build}"
823      classpathref="installprg.classpath"
824      encoding="ISO-8859-1"
825      debug="true"
826      deprecation="true"
827      >
828      <compilerarg value="${javac.arg}" />
829    </javac>
830  </target>
831 
832  <target
833    name="installprg.jar"
834    depends="installprg.compile"
835    description="Create the installation jar file: BASE2Install.jar"
836    >
837    <jar
838      basedir="${installprg.build}"
839      jarfile="${bin}/jar/BASE2Install.jar"
840    />
841  </target>
842
843  <!-- jobagent targets -->
844  <target
845    name="jobagent.init"
846    depends="core.init,coreplugins.init,web.init"
847    >
848    <property name="jobagent.src" location="${src}/clients/jobagent" 
849      description="Location of source files" />
850    <property name="jobagent.build" location="${build}/clients/jobagent" 
851      description="Location of compiled files" />
852    <path id="jobagent.classpath" description="Class path for compiling jobagent">
853      <path refid="core.classpath"/>
854      <pathelement location="${core.build}"/>
855    </path>
856  </target>
857  <target
858    name="jobagent.compile"
859    depends="jobagent.init,core.compile"
860    description="Compile the job agent application"
861    >
862    <mkdir dir="${jobagent.build}" />
863    <javac
864      srcdir="${jobagent.src}"
865      destdir="${jobagent.build}"
866      classpathref="jobagent.classpath"
867      encoding="ISO-8859-1"
868      debug="true"
869      deprecation="true"
870      >
871      <compilerarg value="${javac.arg}" />
872    </javac>
873  </target>
874 
875  <target
876    name="jobagent.jar"
877    depends="jobagent.compile"
878    description="Create the job agent jar file: JobAgent.jar"
879    >
880    <jar
881      basedir="${jobagent.build}"
882      jarfile="${bin}/jar/JobAgent.jar"
883    />
884  </target>
885
886  <!-- migrate targets -->
887  <target
888    name="migrate.init"
889    depends="core.init,coreplugins.init,web.init"
890    >
891    <property name="migrate.src" location="${src}/clients/migrate" 
892      description="Location of source files" />
893    <property name="migrate.build" location="${build}/clients/migrate" 
894      description="Location of compiled files" />
895    <path id="migrate.classpath" description="Class path for compiling migration tool">
896      <path refid="core.classpath"/>
897      <pathelement location="${core.build}"/>
898    </path>
899  </target>
900  <target
901    name="migrate.compile"
902    depends="migrate.init,core.compile"
903    description="Compile the migration tool"
904    >
905    <mkdir dir="${migrate.build}" />
906    <javac
907      srcdir="${migrate.src}"
908      destdir="${migrate.build}"
909      classpathref="migrate.classpath"
910      encoding="ISO-8859-1"
911      debug="true"
912      deprecation="true"
913      >
914      <compilerarg value="${javac.arg}" />
915    </javac>
916  </target>
917 
918  <target
919    name="migrate.jar"
920    depends="migrate.compile"
921    description="Create the migration tool jar file: Migrate.jar"
922    >
923    <jar
924      basedir="${migrate.build}"
925      jarfile="${bin}/jar/Migrate.jar"
926    />
927  </target>
928 
929  <!-- documentation targets -->
930  <target
931    name="doc.init"
932    >
933    <property name="docbook.src" location="doc/src/docbook" 
934      description="Location of docbook source XML files" />
935    <path id="javadoc.classpath" description="Class path for generating javadoc">
936      <path refid="core.classpath" />
937      <fileset dir="${lib}/servlet">
938        <include name="**/*.jar"/>
939      </fileset>
940    </path>
941  </target>
942 
943  <target
944    name="doc.javadoc"
945    depends="doc.init,core.init,coreplugins.init,web.init,migrate.init,jobagent.init"
946    description="Generate JavaDoc of entire API"
947    >
948    <!-- Create the time stamp -->
949    <tstamp>
950      <format property="TODAY" pattern="yyyy-MM-dd"/>
951    </tstamp>
952    <delete dir="${doc}/api" />
953    <mkdir dir="${doc}/api"/>
954
955    <javadoc
956      packagenames="net.sf.basedb.*"
957      sourcepath="${core.src}:${coreplugins.src}:${web.src}:${migrate.src}:${jobagent.src}"
958      destdir="${doc}/api"
959      author="true"
960      version="true"
961      use="false"
962      private="true"
963      windowtitle="BASE ${base.version} API documentation"
964      stylesheetfile="doc/javadoc.css"
965      classpathref="javadoc.classpath"
966      linksource="false"
967      breakiterator="yes"
968      encoding="iso-8859-1"
969      >
970      <header><![CDATA[${base.version}: ${TODAY}]]></header>
971      <link href="http://java.sun.com/j2se/1.5/docs/api"/>
972      <link href="http://www.hibernate.org/hib_docs/v3/api"/>
973      <link href="http://www.jdom.org/docs/apidocs/" />
974      <link href="http://java.sun.com/products/servlet/2.2/javadoc/" />
975      <link href="http://www.singularsys.com/jep/doc/javadoc/" />
976      <link href="http://www.jfree.org/jfreechart/api/gjdoc/" />
977      <link href="http://logging.apache.org/log4j/docs/api/" />
978      <link href="http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/" />
979      <tag name="base.internal" description="Developer info" />
980      <tag name="base.modified" description="Last modified" />
981      <tag name="hibernate.class" description="Hibernate: class" scope="types" />
982      <tag name="hibernate.subclass" description="Hibernate: subclass" scope="types" />
983      <tag name="hibernate.discriminator" description="Hibernate: discriminator" scope="types" />
984      <tag name="hibernate.id" description="Hibernate: id" scope="methods" />
985      <tag name="hibernate.generator-param" description="Hibernate: generator-param" scope="methods" />
986      <tag name="hibernate.version" description="Hibernate: version" scope="methods" />
987      <tag name="hibernate.property" description="Hibernate: property" scope="methods" />
988      <tag name="hibernate.column" description="Hibernate: column" scope="methods" />
989      <tag name="hibernate.map" description="Hibernate: map" scope="methods" />
990      <tag name="hibernate.set" description="Hibernate: set" scope="methods" />
991      <tag name="hibernate.list" description="Hibernate: list" scope="methods" />
992      <tag name="hibernate.array" description="Hibernate: array" scope="methods" />
993      <tag name="hibernate.one-to-one" description="Hibernate: one-to-one" scope="methods" />
994      <tag name="hibernate.many-to-one" description="Hibernate: many-to-one" scope="methods" />
995      <tag name="hibernate.many-to-many" description="Hibernate: many-to-many" scope="methods" />
996      <tag name="hibernate.index-many-to-many" description="Hibernate: index-many-to-many" scope="methods" />
997      <tag name="hibernate.collection-key" description="Hibernate: collection-key" scope="methods" />
998      <tag name="hibernate.collection-index" description="Hibernate: collection-index" scope="methods" />
999      <tag name="hibernate.collection-composite-index" description="Hibernate: collection-composite-index" scope="methods" />
1000      <tag name="hibernate.collection-element" description="Hibernate: collection-element" scope="methods" />
1001      <tag name="hibernate.collection-composite-element" description="Hibernate: collection-composite-element" scope="methods" />
1002      <tag name="hibernate.collection-one-to-many" description="Hibernate: collection-one-to-many" scope="methods" />
1003      <tag name="hibernate.collection-many-to-many" description="Hibernate: collection-many-to-many" scope="methods" />
1004      <tag name="hibernate.bag" description="Hibernate: bag" scope="methods" />
1005      <tag name="hibernate.many-to-any" description="Hibernate: many-to-any" scope="methods" />
1006      <tag name="hibernate.many-to-any-column" description="Hibernate: many-to-any-column" scope="methods" />
1007      <tag name="hibernate.component" description="Hibernate: component" scope="methods" />
1008    </javadoc>
1009  </target>
1010 
1011  <target
1012    name="doc.docbook"
1013    depends="doc.init,doc.docbook.html,doc.docbook.pdf"
1014    description="Generate docbook user and admin documentation."
1015    >
1016  </target>
1017   
1018  <target 
1019    name="doc.docbook.html"
1020    depends="dev.init,doc.init,xsltprocessor"
1021    >
1022    <mkdir dir="${doc}/docbook/html" />
1023    <!--Create subdirectories to store the chunked files in-->
1024    <mkdir dir="${doc}/docbook/html/admindoc"/>
1025    <mkdir dir="${doc}/docbook/html/admindoc/adding_user_group_roles"/>
1026    <mkdir dir="${doc}/docbook/html/admindoc/installation_upgrade"/>
1027    <mkdir dir="${doc}/docbook/html/admindoc/plugin_installation"/>
1028    <mkdir dir="${doc}/docbook/html/developerdoc"/>
1029    <mkdir dir="${doc}/docbook/html/developerdoc/api"/>
1030    <mkdir dir="${doc}/docbook/html/developerdoc/develop_overview"/>
1031    <mkdir dir="${doc}/docbook/html/developerdoc/core_ref"/>
1032    <mkdir dir="${doc}/docbook/html/developerdoc/javadoc"/>
1033    <mkdir dir="${doc}/docbook/html/developerdoc/plugin_developer"/>
1034    <mkdir dir="${doc}/docbook/html/developerdoc/write_doc"/>
1035    <mkdir dir="${doc}/docbook/html/overviewdoc/overview"/>
1036    <mkdir dir="${doc}/docbook/html/overviewdoc"/>
1037    <mkdir dir="${doc}/docbook/html/overviewdoc/why_base"/>
1038    <mkdir dir="${doc}/docbook/html/userdoc"/>
1039    <mkdir dir="${doc}/docbook/html/userdoc/about"/>
1040    <mkdir dir="${doc}/docbook/html/userdoc/annotations"/>
1041    <mkdir dir="${doc}/docbook/html/userdoc/array_lims"/>
1042    <mkdir dir="${doc}/docbook/html/userdoc/biomaterials"/>
1043    <mkdir dir="${doc}/docbook/html/userdoc/analysis"/>
1044    <mkdir dir="${doc}/docbook/html/userdoc/filesystem"/>
1045    <mkdir dir="${doc}/docbook/html/userdoc/hardware"/>
1046    <mkdir dir="${doc}/docbook/html/userdoc/import_export"/>
1047    <mkdir dir="${doc}/docbook/html/userdoc/jobs"/>
1048    <mkdir dir="${doc}/docbook/html/userdoc/project_permission"/>
1049    <mkdir dir="${doc}/docbook/html/userdoc/protocols"/>
1050    <mkdir dir="${doc}/docbook/html/userdoc/reporter"/>
1051    <mkdir dir="${doc}/docbook/html/userdoc/software"/>
1052    <mkdir dir="${doc}/docbook/html/userdoc/trashcan"/>
1053    <mkdir dir="${doc}/docbook/html/userdoc/webclient"/>
1054   
1055    <mkdir dir="${build}/docbook/html" />
1056    <delete description="Delete existing documents">
1057      <fileset dir="${build}/docbook" defaultexcludes="no" />
1058      <fileset dir="${doc}/docbook/html" defaultexcludes="no" />
1059    </delete>
1060    <delete file="data/helptexts.xml" />
1061  <ant antfile="${lib}/docbook/ant-build-docbook.xml" inheritall="false" target="html.chunked">
1062      <property name="ant.docbook.styler.dir" location="${lib}/docbook" />
1063      <property name="docbook.xml.dir" location="${docbook.src}" />
1064      <property name="docbook.resources.dir" location="${docbook.src}/figures" />
1065      <property name="distribution.dir" location="${doc}/docbook/html" />
1066      <property name="build.dir" location="${build}/docbook/html" />
1067      <property name="base.version" value="${base.version}"/>
1068    </ant>
1069   
1070    <property name="catalog.location" location="${lib}/docbook/preprocess/catalog.xml" />
1071    <path id="ant-extensions">
1072        <fileset dir="${lib}/docbook/ant-extensions" includes="**/*.jar" />
1073        <pathelement path="${lib}/docbook/ant-extensions" />
1074      </path>
1075   
1076    <xmlcatalog id="dtdcatalog">
1077          <catalogpath>
1078              <fileset file="${catalog.location}"/>
1079          </catalogpath>
1080      </xmlcatalog>
1081
1082      <style
1083          in      = "${build}/docbook/html/docbook-ready-file.tmp"
1084          style   = "${lib}/docbook/preprocess/webclient_helptext.xsl"
1085          out     = "data/helptexts.xml"
1086          processor = "${xslt.processor}"
1087          >
1088          <xmlcatalog refid="dtdcatalog"/>
1089          <classpath refid="ant-extensions" />
1090
1091          <param name="xsltproc.catalog" expression="${catalog.location}" />
1092          <param name="xsltproc.option.--nonet"  expression="" />
1093      </style>
1094
1095    <replaceregexp 
1096      file="data/helptexts.xml"
1097      match="&lt;(?!/?name|/?description|/?helpitem|/?helptexts)(/?([a-z]+)[^>]*)&gt;"
1098      replace="&amp;lt;\$1&amp;gt;"
1099      flags="sg"
1100    />
1101  </target>
1102 
1103  <target 
1104    name="doc.docbook.pdf"
1105    depends="dev.init,doc.init"
1106    >
1107    <!-- Generate a pdf file from the documentation source -->
1108    <mkdir dir="${build}/docbook/pdf" />
1109    <echo>Generate pdf file</echo>
1110    <ant antfile="${lib}/docbook/ant-build-docbook.xml" inheritall="false" target="pdf.fop">
1111      <property name="ant.docbook.styler.dir" location="${lib}/docbook" />
1112      <property name="docbook.xml.dir" location="${docbook.src}" />
1113      <property name="docbook.resources.dir" location="${docbook.src}/figures" />
1114      <property name="distribution.dir" location="${doc}/docbook" />
1115      <property name="build.dir" location="${build}/docbook/pdf" />
1116      <property name="base.version" value="${base.version}"/>
1117    </ant>
1118  </target>
1119 
1120  <target 
1121    name="doc.dist"
1122    description="Copy documentation to the binary distribution"
1123    >
1124    <mkdir dir="dist/doc" />
1125    <copy todir="dist/doc">
1126      <fileset dir="doc" includes="admin/**/*" />
1127      <fileset dir="doc" includes="development/**/*" />
1128      <fileset dir="doc" includes="licenses/**/*" />
1129      <fileset dir="doc" includes="specifications/**/*" />
1130      <fileset dir="doc" includes="user/**/*" />
1131      <fileset dir="doc" includes="*.*" />
1132    </copy>
1133  </target>
1134
1135  <target name="xsltprocessor">
1136      <property environment="env"/>
1137
1138      <condition  property="executable.file.extension"
1139                  value=".exe">
1140              <os family="windows"/>
1141      </condition>
1142      <condition  property="executable.file.extension"
1143                  value="">
1144              <os family="unix"/>
1145      </condition>
1146     
1147      <condition  property="tmp:xsltproc.available"
1148                  value="xsltproc${executable.file.extension}">
1149          <or>
1150              <and>
1151                  <os family="windows"/>
1152                  <available file="xsltproc${executable.file.extension}" filepath="${env.Path}" />
1153              </and>
1154              <and>
1155                  <os family="unix"/>
1156                  <available file="xsltproc${executable.file.extension}" filepath="${env.PATH}" />
1157              </and>
1158          </or>
1159      </condition>
1160     
1161      <condition property="xslt.processor" value="com.dawidweiss.ant.taskdefs.XsltProcLiaison">
1162          <and>
1163              <isset property="tmp:xsltproc.available" />
1164              <not>
1165                  <isset property="disable.xsltproc" />
1166              </not>
1167          </and>
1168      </condition>
1169     
1170      <condition property="xslt.processor" value="com.dawidweiss.ant.taskdefs.SaxonLiaison">
1171          <not>
1172              <isset property="disable.saxon" />
1173          </not>
1174      </condition>
1175
1176      <condition property="xslt.processor" value="trax">
1177          <not>
1178          <and>
1179                  <isset property="tmp:xsltproc.available" />
1180                  <not>
1181                      <isset property="disable.xsltproc" />
1182                  </not>
1183          </and>
1184          </not>
1185      </condition>
1186
1187    </target>
1188 
1189  <!--package targets -->
1190  <target
1191    name="package.bin"
1192    depends="dist"
1193    description="Create binary distribution package"
1194    >
1195    <tar
1196      destfile="base-${base.version}.tar.gz"
1197      longfile="gnu"
1198      compression="gzip"
1199      >
1200      <tarfileset
1201        dir="${dist}"
1202        mode="755"
1203        prefix="base-${base.version}"
1204        preserveLeadingSlashes="true"
1205        >
1206        <include name="**/*.sh" />
1207      </tarfileset>
1208      <tarfileset
1209        dir="${dist}"
1210        prefix="base-${base.version}"
1211        preserveLeadingSlashes="true"
1212        >
1213        <exclude name="**/*.sh" />
1214      </tarfileset>
1215    </tar>
1216    <checksum file="base-${base.version}.tar.gz" />
1217  </target>
1218 
1219  <target
1220    name="package.src"
1221    depends="svn.revision"
1222    description="Create source distribution package"
1223    >
1224    <property name="tempdir" location="base-${base.version}-src" />
1225    <delete dir="${tempdir}" failonerror="false"/>
1226    <svn>
1227      <export srcPath="." destPath="${tempdir}" />
1228    </svn>
1229    <replaceregexp 
1230      file="${tempdir}/build.xml"
1231      match="&lt;svn&gt;.*&lt;status.*?&lt;/svn&gt;"
1232      replace="&lt;property name=&#34;base.build&#34; value=&#34;${base.build}&#34; /&gt;"
1233      flags="s"
1234    />
1235    <replace file="${tempdir}/build.xml"
1236      description="Remove references to package.src">
1237      <replacefilter 
1238        token="package.bin,package.src"
1239        value="package.bin"
1240      />
1241    </replace>
1242    <replaceregexp 
1243      file="${tempdir}/build.xml"
1244      match="&lt;target\s*?name=&#34;package.src&#34;.*?&lt;/target&gt;"
1245      replace=""
1246      flags="s"
1247      description="Remove package.src target"
1248    />
1249      <tar
1250      destfile="base-${base.version}-src.tar.gz"
1251      longfile="gnu"
1252      compression="gzip"
1253      >
1254      <tarfileset
1255        dir="${tempdir}"
1256        mode="755"
1257        prefix="base-${base.version}-src"
1258        preserveLeadingSlashes="true"
1259        >
1260        <include name="**/*.sh" />
1261      </tarfileset>
1262      <tarfileset
1263        dir="${tempdir}"
1264        prefix="base-${base.version}-src"
1265        preserveLeadingSlashes="true"
1266        >
1267        <exclude name="**/*.sh" />
1268      </tarfileset>
1269    </tar>
1270    <checksum file="base-${base.version}-src.tar.gz"/>
1271    <delete dir="${tempdir}" />
1272  </target>
1273 
1274</project>
Note: See TracBrowser for help on using the repository browser.