source: trunk/build.xml @ 3247

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

The output subdirectories will be created before running the xsltproc

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 38.1 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3    $Id: build.xml 3247 2007-04-17 07:45:17Z 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"
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  <target 
259    name="helptext"
260    depends="dev.init, doc.helptext"
261    description="Generate import file with helptexts from the docbook documentation."
262  />
263
264 
265  <!-- init targets -->
266  <target
267    name="init"
268    depends="svn.revision"
269    description="Initialise things"
270    >
271  </target>
272 
273  <target
274    name="dist.init"
275    depends="init"
276    unless="isDev"
277    >
278    <property name="isDist" value="1" />
279    <property name="jar" location="${dist}/www/WEB-INF/lib" />
280    <property name="config" location="${dist}/www/WEB-INF/classes" />
281    <property name="bin" location="${dist}/bin" />
282    <property name="doc" location="${dist}/doc" />
283    <mkdir dir="${jar}" />
284    <mkdir dir="${config}" />
285    <mkdir dir="${bin}" />
286    <mkdir dir="${bin}/jar" />
287    <mkdir dir="${dist}/data" />
288    <mkdir dir="${dist}/doc" />
289    <mkdir dir="${dist}/misc" />
290  </target>
291 
292  <target
293    name="dev.init"
294    depends="init"
295    unless="isDist"
296    >
297    <property name="isDev" value="1" />
298    <property name="jar" location="www/WEB-INF/lib" />
299    <property name="config" location="www/WEB-INF/classes" />
300    <property name="bin" location="bin" />
301    <property name="doc" location="doc" />
302    <mkdir dir="${bin}/jar" />
303    <mkdir dir="${jar}" />
304    <mkdir dir="${config}" />
305  </target>
306 
307  <target 
308    name="svn.revision"
309    description="Get the current revision number in the subversion and put the
310      value into the base.build property; replaced by constant expression in source distributions"
311    >
312    <svn>
313      <status path="." lastChangedRevisionProperty="base.build" />
314    </svn>
315    <echo message="Build #${base.build}" />
316  </target>
317 
318  <!-- configuration targets -->
319  <target
320    name="copy.config"
321    depends="copy.config.local,copy.config.dist"
322    description="Copies configuration files to the appropriate folder"
323    >
324  </target>
325   
326  <target
327    name="copy.config.dist"
328    >
329    <copy todir="${config}" description="Default configuration files">
330      <fileset dir="${config.dist}">
331        <patternset refid="config.files" />
332        <present present="srconly" targetdir="${config}" />
333      </fileset>
334    </copy>
335    <copy todir="${config}/.."  description="Default web.xml">
336      <fileset dir="${config.dist}">
337        <include name="web.xml" />
338        <present present="srconly" targetdir="${config}/.." />
339      </fileset>
340    </copy>
341  </target>
342 
343  <target
344    name="copy.config.local"
345    if="isDev"
346    unless="isDist"
347    >
348    <copy todir="${config}" description="Local configuration files">
349      <fileset dir="${config.local}">
350        <patternset refid="config.files" />
351      </fileset>
352    </copy>
353    <copy todir="${config}/.."  description="Local web.xml">
354      <fileset dir="${config.local}">
355        <include name="web.xml" />
356      </fileset>
357    </copy>
358  </target>
359 
360  <target
361    name="copy.jar"
362    description="Copy required jar files to the appropriate folder"
363    >
364    <copy todir="${jar}" description="3rd-party JAR files">
365      <fileset dir="${lib}/dist">
366        <include name="**/*" />
367      </fileset>
368    </copy>
369  </target>
370 
371  <!-- core targets -->
372  <target
373    name="core.init"
374    depends="dev.init"
375    >
376    <property name="core.src" location="${src}/core" 
377      description="Location of core source files" />
378    <property name="core.build" location="${build}/core" 
379      description="Location of compiled core files" />
380  </target>
381 
382  <target
383    name="core.compile"
384    depends="core.init"
385    description="Compile the core"
386    >
387    <mkdir dir="${core.build}"/>
388    <javac
389      srcdir="${core.src}"
390      destdir="${core.build}"
391      classpathref="core.classpath"
392      encoding="ISO-8859-1"
393      debug="true"
394      deprecation="true"
395      >
396      <compilerarg value="${javac.arg}" />
397    </javac>
398    <copy todir="${core.build}" 
399      description="Resource files needed by the core; excludes documentation and source files">
400      <fileset dir="${core.src}">
401        <include name="**/*" />
402        <exclude name="**/*.java" />
403        <exclude name="**/doc-files/" />
404        <exclude name="**/package.html" />
405      </fileset>
406    </copy>
407    <replace file="${core.build}/base.version">
408      <replacefilter 
409        token="@MAJOR@"
410        value="${base.majorversion}"
411      />
412      <replacefilter 
413        token="@MINOR@"
414        value="${base.minorversion}"
415      />
416      <replacefilter 
417        token="@MAINTENANCE@"
418        value="${base.maintenanceversion}"
419      />
420      <replacefilter 
421        token="@BUILD@"
422        value="${base.build}"
423      />
424    </replace>
425  </target>
426
427  <target
428    name="check.hibernate"
429    depends="core.init"
430    >
431    <uptodate
432      property="nohibernate"
433      >
434      <srcfiles dir="${core.src}/net/sf/basedb/core/data" includes="**/*.java">
435        <contains text="@hibernate.class" />
436      </srcfiles>
437      <mapper type="glob" from="*.java" to="${core.build}/net/sf/basedb/core/data/*.hbm.xml" />
438    </uptodate>
439    <condition property="hibernate.message" 
440      value="up to date; skipping" 
441      >
442      <istrue value="${nohibernate}" />
443    </condition>
444    <condition property="hibernate.message" 
445      value="not up to date; generating new" 
446      >
447      <isfalse value="${nohibernate}" />
448    </condition>
449    <echo>Hibernate mapping files are ${hibernate.message}</echo>
450  </target>
451 
452  <target
453    name="core.hibernate"
454    depends="core.init,core.compile,check.hibernate"
455    description="Generates Hibernate mapping files from the source code"
456    unless="nohibernate"
457    >
458    <delete>
459      <fileset dir="${core.build}" includes="**/*.hbm.xml" />
460    </delete>
461    <copy todir="${core.build}" 
462      description="Hardcoded *.hbm.xml files">
463      <fileset dir="${core.src}" includes="**/*.hbm.xml" />
464    </copy>
465    <hibernatedoclet
466      destdir="${core.build}"
467      excludedtags="@version,@author,@todo"
468      mergedir="${core.build}"
469      verbose="${xdoclet.verbose}">
470      <fileset dir="${core.src}">
471        <include name="**/*.java"/>
472      </fileset>
473      <hibernate version="2.0"/>
474    </hibernatedoclet>
475   
476    <replace
477      dir="${core.build}"
478      >
479      <include name="**/*.hbm.xml"/>
480      <replacefilter 
481        token="2.0//EN"
482        value="3.0//EN"
483      />
484      <replacefilter 
485        token="2.0.dtd"
486        value="3.0.dtd"
487      />
488      <replacefilter
489        token="outer-join=&#34;false&#34;"
490        value="fetch=&#34;select&#34;"
491      />
492      <replacefilter
493        token="outer-join=&#34;true&#34;"
494        value="fetch=&#34;join&#34;"
495      />
496      <replacefilter
497        token="index-many-to-many"
498        value="map-key-many-to-many"
499      />
500      <replacefilter
501        token="&lt;index&gt;"
502        value="&lt;list-index&gt;"
503      />
504      <replacefilter
505        token="&lt;/index&gt;"
506        value="&lt;/list-index&gt;"
507      />
508      <replacefilter
509        token="composite-index"
510        value="composite-map-key"
511      />
512    </replace>
513  </target>
514 
515  <target
516    name="core.jar"
517    depends="core.init,core.compile,core.hibernate"
518    description="Create the core jar file: BASE2Core.jar"
519    >
520    <jar
521      basedir="${core.build}"
522      jarfile="${jar}/BASE2Core.jar"
523    />
524  </target>
525
526  <!-- core plugin targets -->
527  <target
528    name="coreplugins.init"
529    depends="core.init"
530    >
531    <property name="coreplugins.src" location="${src}/plugins/core" 
532      description="Location of source files" />
533    <property name="coreplugins.build" location="${build}/plugins/core" 
534      description="Location of compiled files" />
535    <path id="coreplugins.classpath" description="Class path for compiling plugins">
536      <path refid="core.classpath"/>
537      <pathelement location="${core.build}"/>
538    </path>
539  </target>
540 
541  <target
542    name="coreplugins.compile"
543    depends="core.compile,coreplugins.init"
544    description="Compile the core plugins"
545    >
546    <mkdir dir="${coreplugins.build}" />
547    <javac
548      srcdir="${coreplugins.src}"
549      destdir="${coreplugins.build}"
550      classpathref="coreplugins.classpath"
551      encoding="ISO-8859-1"
552      debug="true"
553      deprecation="true"
554      >
555      <compilerarg value="${javac.arg}" />
556    </javac>
557  </target>
558 
559  <target
560    name="coreplugins.jar"
561    depends="coreplugins.compile"
562    description="Create the plugin jar file: BASE2CorePlugins.jar"
563    >
564    <jar
565      basedir="${coreplugins.build}"
566      jarfile="${jar}/BASE2CorePlugins.jar"
567    />
568  </target>
569 
570  <!-- example plugin targets -->
571  <target
572    name="exampleplugins.init"
573    depends="core.init"
574    >
575    <property name="exampledir" location="${src}/examples/plugins" />
576    <property name="exampleplugins.src" location="${exampledir}/src" 
577      description="Location of source files" />
578    <property name="exampleplugins.build" location="${build}/plugins/example" 
579      description="Location of compiled files" />
580    <path id="exampleplugins.classpath" description="Class path for compiling plugins">
581      <path refid="core.classpath"/>
582      <pathelement location="${core.build}"/>
583    </path>
584  </target>
585 
586  <target
587    name="exampleplugins.compile"
588    depends="core.compile,exampleplugins.init"
589    description="Compile the example plugins"
590    >
591    <mkdir dir="${exampleplugins.build}" />
592    <javac
593      srcdir="${exampleplugins.src}"
594      destdir="${exampleplugins.build}"
595      classpathref="exampleplugins.classpath"
596      encoding="ISO-8859-1"
597      debug="true"
598      deprecation="true"
599      >
600      <compilerarg value="${javac.arg}" />
601    </javac>
602  </target>
603 
604  <target
605    name="exampleplugins.jar"
606    depends="exampleplugins.compile"
607    description="Create the example plugins jar file: ExamplePlugins.jar"
608    >
609    <jar
610      basedir="${exampleplugins.build}"
611      jarfile="${jar}/ExamplePlugins.jar"
612      manifest="${exampledir}/MANIFEST.MF"
613    />
614  </target>
615
616  <target
617    name="exampleplugins.tar"
618    depends="exampleplugins.jar"
619    description="Create a downloadable tar file with the example plugins"
620    >
621    <mkdir dir="${doc}/development/plugins" />
622    <tar
623      destfile="${doc}/development/plugins/exampleplugins.tar.gz"
624      compression="gzip"
625      >
626      <tarfileset
627        dir="${exampledir}"
628        preserveLeadingSlashes="true"
629      />
630      <tarfileset
631        dir="${exampleplugins.build}"
632        prefix="bin"
633        preserveLeadingSlashes="true"
634      />
635    </tar>
636  </target>
637 
638  <!-- test targets -->
639  <target
640    name="test.init"
641    depends="core.init,coreplugins.init,jobagent.init"
642    >
643    <property name="test.src" location="${src}/test" 
644      description="Location of source files" />
645    <property name="test.build" location="${build}/test" 
646      description="Location of compiled files" />
647    <path id="test.classpath" description="Class path for compiling">
648      <path refid="core.classpath"/>
649      <pathelement location="${core.build}" />
650      <pathelement location="${coreplugins.build}" />
651      <pathelement location="${jobagent.build}" />
652    </path>
653  </target>
654 
655  <target
656    name="test.compile"
657    depends="test.init,core.compile,coreplugins.compile,jobagent.compile"
658    description="Compile the test programs"
659    >
660    <mkdir dir="${test.build}" />
661    <javac
662      srcdir="${test.src}"
663      destdir="${test.build}"
664      classpathref="test.classpath"
665      encoding="ISO-8859-1"
666      debug="true"
667      deprecation="true"
668      >
669      <compilerarg value="${javac.arg}" />
670    </javac>
671  </target>
672 
673  <target
674    name="test.jar"
675    depends="test.compile"
676    description="Create a JAR file used by the test programs; Delete corresponding .class files"
677    >
678    <jar 
679      jarfile="${test.build}/JarPluginAbout.jar" 
680      basedir="${test.build}" 
681      includes="JarPluginAbout.class" 
682    />
683    <jar 
684      jarfile="${test.build}/JarPlugin.jar" 
685      basedir="${test.build}" 
686      includes="JarPlugin*,NullPlugin*"
687      excludes="JarPlugin.jar,JarPluginAbout.*"
688      manifest="${test.src}/data/JarPluginManifest.txt"
689    />
690    <delete>
691      <fileset dir="${test.build}" includes="JarPlugin*.class" />
692    </delete>
693  </target>
694
695  <!-- web targets -->
696  <target
697    name="web.init"
698    depends="core.init,coreplugins.init"
699    >
700    <property name="web.src" location="${src}/clients/web" 
701      description="Location of source files" />
702    <property name="web.build" location="${build}/clients/web" 
703      description="Location of compiled files" />
704    <property name="web.inf" location="www/WEB-INF" 
705      description="Location of the WEB-INF folder" />
706    <path id="web.classpath" description="Class path for compiling web client">
707      <path refid="core.classpath"/>
708      <pathelement location="${core.build}"/>
709      <pathelement location="${coreplugins.build}" />
710      <fileset dir="${lib}/servlet">
711        <include name="**/*.jar"/>
712      </fileset>
713    </path>
714  </target>
715 
716  <target
717    name="web.compile"
718    depends="web.init,core.compile"
719    description="Compile the web client application"
720    >
721    <mkdir dir="${web.build}" />
722    <javac
723      srcdir="${web.src}"
724      destdir="${web.build}"
725      classpathref="web.classpath"
726      encoding="ISO-8859-1"
727      debug="true"
728      deprecation="true"
729      >
730      <compilerarg value="${javac.arg}" />
731    </javac>
732  </target>
733 
734  <target
735    name="web.jar"
736    depends="web.compile"
737    description="Create the web client jar file: BASE2Webclient.jar"
738    >
739    <jar
740      basedir="${web.build}"
741      jarfile="${jar}/BASE2Webclient.jar"
742    />
743  </target>
744 
745  <target 
746    name="web.jsp"
747    depends="web"
748    description="Compile all JSP pages to a temporary directory; used for checking only"
749    >
750    <property name="jsp.build" location="${build}/jsp" />
751    <property environment="env" />
752    <mkdir dir="${jsp.build}/src" />
753    <mkdir dir="${jsp.build}/classes" />
754   
755    <path id="jsp.precompile.classpath">
756      <pathelement location="${java.home}/../lib/tools.jar" />
757      <fileset dir="${env.CATALINA_HOME}/server/lib">
758        <include name="*.jar" />
759      </fileset>
760      <fileset dir="${env.CATALINA_HOME}/common/lib">
761        <include name="*.jar" />
762      </fileset>
763      <fileset dir="${env.CATALINA_HOME}/bin">
764        <include name="*.jar" />
765      </fileset>
766    </path>
767   
768    <path id="jsp.compile.classpath">
769      <path refid="web.classpath" />
770      <pathelement location="${java.home}/../lib/tools.jar" />
771      <fileset dir="${env.CATALINA_HOME}/common/lib">
772        <include name="*.jar" />
773      </fileset>
774      <fileset dir="${env.CATALINA_HOME}/shared/lib">
775        <include name="*.jar" />
776      </fileset>
777      <fileset dir="${web.inf}/lib">
778        <include name="*.jar" />
779      </fileset>
780    </path>
781
782    <taskdef
783      classname="org.apache.jasper.JspC" 
784      name="jasper2"
785      classpathref="jsp.precompile.classpath"
786    />
787    <jasper2
788      validateXml="false"
789      uriroot="www"
790      webXmlFragment="${jsp.build}/generated_web.xml"
791      outputdir="${jsp.build}/src"
792    />
793    <javac
794      destdir="${jsp.build}/classes"
795      srcdir="${jsp.build}/src"
796      debug="true"
797      classpathref="jsp.compile.classpath"
798      memoryinitialsize="256m"
799      memorymaximumsize="512m"
800      fork="true"
801      >
802    </javac>
803  </target>
804 
805  <!-- installprg targets -->
806  <target
807    name="installprg.init"
808    depends="core.init,coreplugins.init,web.init"
809    >
810    <property name="installprg.src" location="${src}/install" 
811      description="Location of source files" />
812    <property name="installprg.build" location="${build}/install" 
813      description="Location of compiled files" />
814    <path id="installprg.classpath" description="Class path for compiling installation programs">
815      <path refid="core.classpath"/>
816      <pathelement location="${core.build}"/>
817      <pathelement location="${coreplugins.build}"/>
818      <pathelement location="${web.build}"/>
819    </path>
820  </target>
821  <target
822    name="installprg.compile"
823    depends="installprg.init,core.compile"
824    description="Compile the installation programs"
825    >
826    <mkdir dir="${installprg.build}" />
827    <javac
828      srcdir="${installprg.src}"
829      destdir="${installprg.build}"
830      classpathref="installprg.classpath"
831      encoding="ISO-8859-1"
832      debug="true"
833      deprecation="true"
834      >
835      <compilerarg value="${javac.arg}" />
836    </javac>
837  </target>
838 
839  <target
840    name="installprg.jar"
841    depends="installprg.compile"
842    description="Create the installation jar file: BASE2Install.jar"
843    >
844    <jar
845      basedir="${installprg.build}"
846      jarfile="${bin}/jar/BASE2Install.jar"
847    />
848  </target>
849
850  <!-- jobagent targets -->
851  <target
852    name="jobagent.init"
853    depends="core.init,coreplugins.init,web.init"
854    >
855    <property name="jobagent.src" location="${src}/clients/jobagent" 
856      description="Location of source files" />
857    <property name="jobagent.build" location="${build}/clients/jobagent" 
858      description="Location of compiled files" />
859    <path id="jobagent.classpath" description="Class path for compiling jobagent">
860      <path refid="core.classpath"/>
861      <pathelement location="${core.build}"/>
862    </path>
863  </target>
864  <target
865    name="jobagent.compile"
866    depends="jobagent.init,core.compile"
867    description="Compile the job agent application"
868    >
869    <mkdir dir="${jobagent.build}" />
870    <javac
871      srcdir="${jobagent.src}"
872      destdir="${jobagent.build}"
873      classpathref="jobagent.classpath"
874      encoding="ISO-8859-1"
875      debug="true"
876      deprecation="true"
877      >
878      <compilerarg value="${javac.arg}" />
879    </javac>
880  </target>
881 
882  <target
883    name="jobagent.jar"
884    depends="jobagent.compile"
885    description="Create the job agent jar file: JobAgent.jar"
886    >
887    <jar
888      basedir="${jobagent.build}"
889      jarfile="${bin}/jar/JobAgent.jar"
890    />
891  </target>
892
893  <!-- migrate targets -->
894  <target
895    name="migrate.init"
896    depends="core.init,coreplugins.init,web.init"
897    >
898    <property name="migrate.src" location="${src}/clients/migrate" 
899      description="Location of source files" />
900    <property name="migrate.build" location="${build}/clients/migrate" 
901      description="Location of compiled files" />
902    <path id="migrate.classpath" description="Class path for compiling migration tool">
903      <path refid="core.classpath"/>
904      <pathelement location="${core.build}"/>
905    </path>
906  </target>
907  <target
908    name="migrate.compile"
909    depends="migrate.init,core.compile"
910    description="Compile the migration tool"
911    >
912    <mkdir dir="${migrate.build}" />
913    <javac
914      srcdir="${migrate.src}"
915      destdir="${migrate.build}"
916      classpathref="migrate.classpath"
917      encoding="ISO-8859-1"
918      debug="true"
919      deprecation="true"
920      >
921      <compilerarg value="${javac.arg}" />
922    </javac>
923  </target>
924 
925  <target
926    name="migrate.jar"
927    depends="migrate.compile"
928    description="Create the migration tool jar file: Migrate.jar"
929    >
930    <jar
931      basedir="${migrate.build}"
932      jarfile="${bin}/jar/Migrate.jar"
933    />
934  </target>
935 
936  <!-- documentation targets -->
937  <target
938    name="doc.init"
939    >
940    <property name="docbook.src" location="doc/src/docbook" 
941      description="Location of docbook source XML files" />
942    <path id="javadoc.classpath" description="Class path for generating javadoc">
943      <path refid="core.classpath" />
944      <fileset dir="${lib}/servlet">
945        <include name="**/*.jar"/>
946      </fileset>
947    </path>
948  </target>
949 
950  <target
951    name="doc.javadoc"
952    depends="doc.init,core.init,coreplugins.init,web.init,migrate.init,jobagent.init"
953    description="Generate JavaDoc of entire API"
954    >
955    <!-- Create the time stamp -->
956    <tstamp>
957      <format property="TODAY" pattern="yyyy-MM-dd"/>
958    </tstamp>
959    <delete dir="${doc}/api" />
960    <mkdir dir="${doc}/api"/>
961
962    <javadoc
963      packagenames="net.sf.basedb.*"
964      sourcepath="${core.src}:${coreplugins.src}:${web.src}:${migrate.src}:${jobagent.src}"
965      destdir="${doc}/api"
966      author="true"
967      version="true"
968      use="false"
969      private="true"
970      windowtitle="BASE ${base.version} API documentation"
971      stylesheetfile="doc/javadoc.css"
972      classpathref="javadoc.classpath"
973      linksource="false"
974      breakiterator="yes"
975      encoding="iso-8859-1"
976      >
977      <header><![CDATA[${base.version}: ${TODAY}]]></header>
978      <link href="http://java.sun.com/j2se/1.5/docs/api"/>
979      <link href="http://www.hibernate.org/hib_docs/v3/api"/>
980      <link href="http://www.jdom.org/docs/apidocs/" />
981      <link href="http://java.sun.com/products/servlet/2.2/javadoc/" />
982      <link href="http://www.singularsys.com/jep/doc/javadoc/" />
983      <link href="http://www.jfree.org/jfreechart/api/gjdoc/" />
984      <link href="http://logging.apache.org/log4j/docs/api/" />
985      <link href="http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/" />
986      <tag name="base.internal" description="Developer info" />
987      <tag name="base.modified" description="Last modified" />
988      <tag name="hibernate.class" description="Hibernate: class" scope="types" />
989      <tag name="hibernate.subclass" description="Hibernate: subclass" scope="types" />
990      <tag name="hibernate.discriminator" description="Hibernate: discriminator" scope="types" />
991      <tag name="hibernate.id" description="Hibernate: id" scope="methods" />
992      <tag name="hibernate.generator-param" description="Hibernate: generator-param" scope="methods" />
993      <tag name="hibernate.version" description="Hibernate: version" scope="methods" />
994      <tag name="hibernate.property" description="Hibernate: property" scope="methods" />
995      <tag name="hibernate.column" description="Hibernate: column" scope="methods" />
996      <tag name="hibernate.map" description="Hibernate: map" scope="methods" />
997      <tag name="hibernate.set" description="Hibernate: set" scope="methods" />
998      <tag name="hibernate.list" description="Hibernate: list" scope="methods" />
999      <tag name="hibernate.array" description="Hibernate: array" scope="methods" />
1000      <tag name="hibernate.one-to-one" description="Hibernate: one-to-one" scope="methods" />
1001      <tag name="hibernate.many-to-one" description="Hibernate: many-to-one" scope="methods" />
1002      <tag name="hibernate.many-to-many" description="Hibernate: many-to-many" scope="methods" />
1003      <tag name="hibernate.index-many-to-many" description="Hibernate: index-many-to-many" scope="methods" />
1004      <tag name="hibernate.collection-key" description="Hibernate: collection-key" scope="methods" />
1005      <tag name="hibernate.collection-index" description="Hibernate: collection-index" scope="methods" />
1006      <tag name="hibernate.collection-composite-index" description="Hibernate: collection-composite-index" scope="methods" />
1007      <tag name="hibernate.collection-element" description="Hibernate: collection-element" scope="methods" />
1008      <tag name="hibernate.collection-composite-element" description="Hibernate: collection-composite-element" scope="methods" />
1009      <tag name="hibernate.collection-one-to-many" description="Hibernate: collection-one-to-many" scope="methods" />
1010      <tag name="hibernate.collection-many-to-many" description="Hibernate: collection-many-to-many" scope="methods" />
1011      <tag name="hibernate.bag" description="Hibernate: bag" scope="methods" />
1012      <tag name="hibernate.many-to-any" description="Hibernate: many-to-any" scope="methods" />
1013      <tag name="hibernate.many-to-any-column" description="Hibernate: many-to-any-column" scope="methods" />
1014      <tag name="hibernate.component" description="Hibernate: component" scope="methods" />
1015    </javadoc>
1016  </target>
1017 
1018  <target
1019    name="doc.docbook"
1020    depends="doc.init,doc.docbook.html,doc.docbook.pdf"
1021    description="Generate docbook user and admin documentation."
1022    >
1023  </target>
1024   
1025  <target 
1026    name="doc.docbook.html"
1027    depends="dev.init,doc.init"
1028    >
1029    <mkdir dir="${doc}/docbook/html" />
1030    <!--Create subdirectories to store the chunked files in-->
1031    <mkdir dir="${doc}/docbook/html/admindoc"/>
1032    <mkdir dir="${doc}/docbook/html/admindoc/adding_user_group_roles"/>
1033    <mkdir dir="${doc}/docbook/html/admindoc/installation_upgrade"/>
1034    <mkdir dir="${doc}/docbook/html/admindoc/plugin_installation"/>
1035    <mkdir dir="${doc}/docbook/html/developerdoc"/>
1036    <mkdir dir="${doc}/docbook/html/developerdoc/api"/>
1037    <mkdir dir="${doc}/docbook/html/developerdoc/develop_overview"/>
1038    <mkdir dir="${doc}/docbook/html/developerdoc/core_ref"/>
1039    <mkdir dir="${doc}/docbook/html/developerdoc/javadoc"/>
1040    <mkdir dir="${doc}/docbook/html/developerdoc/plugin_developer"/>
1041    <mkdir dir="${doc}/docbook/html/developerdoc/write_doc"/>
1042    <mkdir dir="${doc}/docbook/html/overviewdoc/overview"/>
1043    <mkdir dir="${doc}/docbook/html/overviewdoc"/>
1044    <mkdir dir="${doc}/docbook/html/overviewdoc/why_base"/>
1045    <mkdir dir="${doc}/docbook/html/userdoc"/>
1046    <mkdir dir="${doc}/docbook/html/userdoc/about"/>
1047    <mkdir dir="${doc}/docbook/html/userdoc/annotations"/>
1048    <mkdir dir="${doc}/docbook/html/userdoc/array_lims"/>
1049    <mkdir dir="${doc}/docbook/html/userdoc/biomaterials"/>
1050    <mkdir dir="${doc}/docbook/html/userdoc/analysis"/>
1051    <mkdir dir="${doc}/docbook/html/userdoc/filesystem"/>
1052    <mkdir dir="${doc}/docbook/html/userdoc/hardware"/>
1053    <mkdir dir="${doc}/docbook/html/userdoc/import_export"/>
1054    <mkdir dir="${doc}/docbook/html/userdoc/jobs"/>
1055    <mkdir dir="${doc}/docbook/html/userdoc/project_permission"/>
1056    <mkdir dir="${doc}/docbook/html/userdoc/protocols"/>
1057    <mkdir dir="${doc}/docbook/html/userdoc/reporter"/>
1058    <mkdir dir="${doc}/docbook/html/userdoc/software"/>
1059    <mkdir dir="${doc}/docbook/html/userdoc/trashcan"/>
1060    <mkdir dir="${doc}/docbook/html/userdoc/webclient"/>
1061   
1062    <mkdir dir="${build}/docbook/" />
1063    <delete description="Delete existing documents">
1064      <fileset dir="${build}/docbook" defaultexcludes="no" />
1065      <fileset dir="${doc}/docbook/html" defaultexcludes="no" />
1066    </delete>
1067  <ant antfile="${lib}/docbook/ant-build-docbook.xml" inheritall="false" target="html.chunked">
1068      <property name="ant.docbook.styler.dir" location="${lib}/docbook" />
1069      <property name="docbook.xml.dir" location="${docbook.src}" />
1070      <property name="docbook.resources.dir" location="${docbook.src}/figures" />
1071      <property name="distribution.dir" location="${doc}/docbook/html" />
1072      <property name="build.dir" location="${build}/docbook" />
1073      <property name="base.version" value="${base.version}"/>
1074    </ant>
1075  </target>
1076 
1077  <target 
1078    name="doc.docbook.pdf"
1079    depends="dev.init,doc.init"
1080    >
1081    <!-- Generate a pdf file from the documentation source -->
1082    <mkdir dir="${doc}/docbook" />
1083    <echo>Generate pdf file</echo>
1084    <ant antfile="${lib}/docbook/ant-build-docbook.xml" inheritall="false" target="pdf.fop">
1085      <property name="ant.docbook.styler.dir" location="${lib}/docbook" />
1086      <property name="docbook.xml.dir" location="${docbook.src}" />
1087      <property name="docbook.resources.dir" location="${docbook.src}/figures" />
1088      <property name="distribution.dir" location="${doc}/docbook" />
1089      <property name="build.dir" location="${build}/docbook" />
1090      <property name="base.version" value="${base.version}"/>
1091    </ant>
1092  </target>
1093 
1094  <target 
1095    name="doc.dist"
1096    description="Copy documentation to the binary distribution"
1097    >
1098    <mkdir dir="dist/doc" />
1099    <copy todir="dist/doc">
1100      <fileset dir="doc" includes="admin/**/*" />
1101      <fileset dir="doc" includes="development/**/*" />
1102      <fileset dir="doc" includes="licenses/**/*" />
1103      <fileset dir="doc" includes="specifications/**/*" />
1104      <fileset dir="doc" includes="user/**/*" />
1105      <fileset dir="doc" includes="*.*" />
1106    </copy>
1107  </target>
1108 
1109  <target 
1110    name="doc.helptext"
1111    depends="doc.docbook.html, xsltprocessor"
1112    description="Generate a import file with helptexts for the webclient"
1113    >   
1114    <delete file="${build}/docbook/helptext_docbook.xml"/> 
1115    <property name="catalog.location" location="${lib}/docbook/preprocess/catalog.xml" />
1116    <path id="ant-extensions">
1117        <fileset dir="${lib}/docbook/ant-extensions" includes="**/*.jar" />
1118        <pathelement path="${lib}/docbook/ant-extensions" />
1119      </path>
1120   
1121    <xmlcatalog id="dtdcatalog">
1122          <catalogpath>
1123              <fileset file="${catalog.location}"/>
1124          </catalogpath>
1125      </xmlcatalog>
1126
1127      <style
1128          in      = "${build}/docbook/docbook-ready-file.tmp"
1129          style   = "${lib}/docbook/preprocess/webclient_helptext.xsl"
1130          out     = "${build}/docbook/helptext_docbook.xml"
1131          processor = "${xslt.processor}"
1132          >
1133          <xmlcatalog refid="dtdcatalog"/>
1134          <classpath refid="ant-extensions" />
1135
1136          <param name="xsltproc.catalog" expression="${catalog.location}" />
1137          <param name="xsltproc.option.--nonet"  expression="" />
1138      </style>
1139
1140    <replaceregexp 
1141      file="${build}/docbook/helptext_docbook.xml"
1142      match="&lt;(?!/?name|/?description|/?helpitem|/?helptexts)(/?([a-z]+)[^>]*)&gt;"
1143      replace="&amp;lt;\$1&amp;gt;"
1144      flags="sg"
1145    />
1146   
1147  </target>
1148 
1149  <target name="xsltprocessor">
1150      <property environment="env"/>
1151
1152      <condition  property="executable.file.extension"
1153                  value=".exe">
1154              <os family="windows"/>
1155      </condition>
1156      <condition  property="executable.file.extension"
1157                  value="">
1158              <os family="unix"/>
1159      </condition>
1160     
1161      <condition  property="tmp:xsltproc.available"
1162                  value="xsltproc${executable.file.extension}">
1163          <or>
1164              <and>
1165                  <os family="windows"/>
1166                  <available file="xsltproc${executable.file.extension}" filepath="${env.Path}" />
1167              </and>
1168              <and>
1169                  <os family="unix"/>
1170                  <available file="xsltproc${executable.file.extension}" filepath="${env.PATH}" />
1171              </and>
1172          </or>
1173      </condition>
1174     
1175      <condition property="xslt.processor" value="com.dawidweiss.ant.taskdefs.XsltProcLiaison">
1176          <and>
1177              <isset property="tmp:xsltproc.available" />
1178              <not>
1179                  <isset property="disable.xsltproc" />
1180              </not>
1181          </and>
1182      </condition>
1183     
1184      <condition property="xslt.processor" value="com.dawidweiss.ant.taskdefs.SaxonLiaison">
1185          <not>
1186              <isset property="disable.saxon" />
1187          </not>
1188      </condition>
1189
1190      <condition property="xslt.processor" value="trax">
1191          <not>
1192          <and>
1193                  <isset property="tmp:xsltproc.available" />
1194                  <not>
1195                      <isset property="disable.xsltproc" />
1196                  </not>
1197          </and>
1198          </not>
1199      </condition>
1200
1201    </target>
1202 
1203  <!--package targets -->
1204  <target
1205    name="package.bin"
1206    depends="dist"
1207    description="Create binary distribution package"
1208    >
1209    <tar
1210      destfile="base-${base.version}.tar.gz"
1211      longfile="gnu"
1212      compression="gzip"
1213      >
1214      <tarfileset
1215        dir="${dist}"
1216        mode="755"
1217        prefix="base-${base.version}"
1218        preserveLeadingSlashes="true"
1219        >
1220        <include name="**/*.sh" />
1221      </tarfileset>
1222      <tarfileset
1223        dir="${dist}"
1224        prefix="base-${base.version}"
1225        preserveLeadingSlashes="true"
1226        >
1227        <exclude name="**/*.sh" />
1228      </tarfileset>
1229    </tar>
1230    <checksum file="base-${base.version}.tar.gz" />
1231  </target>
1232 
1233  <target
1234    name="package.src"
1235    depends="svn.revision"
1236    description="Create source distribution package"
1237    >
1238    <property name="tempdir" location="base-${base.version}-src" />
1239    <delete dir="${tempdir}" failonerror="false"/>
1240    <svn>
1241      <export srcPath="." destPath="${tempdir}" />
1242    </svn>
1243    <replaceregexp 
1244      file="${tempdir}/build.xml"
1245      match="&lt;svn&gt;.*&lt;status.*?&lt;/svn&gt;"
1246      replace="&lt;property name=&#34;base.build&#34; value=&#34;${base.build}&#34; /&gt;"
1247      flags="s"
1248    />
1249    <replace file="${tempdir}/build.xml"
1250      description="Remove references to package.src">
1251      <replacefilter 
1252        token="package.bin,package.src"
1253        value="package.bin"
1254      />
1255    </replace>
1256    <replaceregexp 
1257      file="${tempdir}/build.xml"
1258      match="&lt;target\s*?name=&#34;package.src&#34;.*?&lt;/target&gt;"
1259      replace=""
1260      flags="s"
1261      description="Remove package.src target"
1262    />
1263      <tar
1264      destfile="base-${base.version}-src.tar.gz"
1265      longfile="gnu"
1266      compression="gzip"
1267      >
1268      <tarfileset
1269        dir="${tempdir}"
1270        mode="755"
1271        prefix="base-${base.version}-src"
1272        preserveLeadingSlashes="true"
1273        >
1274        <include name="**/*.sh" />
1275      </tarfileset>
1276      <tarfileset
1277        dir="${tempdir}"
1278        prefix="base-${base.version}-src"
1279        preserveLeadingSlashes="true"
1280        >
1281        <exclude name="**/*.sh" />
1282      </tarfileset>
1283    </tar>
1284    <checksum file="base-${base.version}-src.tar.gz"/>
1285    <delete dir="${tempdir}" />
1286  </target>
1287 
1288</project>
Note: See TracBrowser for help on using the repository browser.