source: trunk/build.xml @ 3409

Last change on this file since 3409 was 3409, checked in by Nicklas Nordborg, 14 years ago

References #552, #553, #554: Added information about backwards compatibility and Public vs. Internal
API.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 38.9 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3    $Id: build.xml 3409 2007-05-30 13:35:40Z nicklas $
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="javadoc.src" location="doc/src/javadoc" 
934      description="Location of javadoc source files" />
935    <property name="docbook.src" location="doc/src/docbook" 
936      description="Location of docbook source XML files" />
937    <path id="javadoc.classpath" description="Class path for generating javadoc">
938      <path refid="core.classpath" />
939      <fileset dir="${lib}/servlet">
940        <include name="**/*.jar"/>
941      </fileset>
942    </path>
943  </target>
944 
945  <target
946    name="doc.javadoc"
947    depends="doc.init,core.init,coreplugins.init,web.init,migrate.init,jobagent.init"
948    description="Generate JavaDoc of entire API"
949    >
950    <!-- Create the time stamp -->
951    <tstamp>
952      <format property="TODAY" pattern="yyyy-MM-dd"/>
953    </tstamp>
954    <delete dir="${doc}/api" />
955    <mkdir dir="${doc}/api"/>
956
957    <javadoc
958      packagenames="net.sf.basedb.*"
959      sourcepath="${core.src}:${coreplugins.src}:${web.src}:${migrate.src}:${jobagent.src}"
960      destdir="${doc}/api"
961      author="true"
962      version="true"
963      use="false"
964      private="true"
965      windowtitle="BASE ${base.version} API documentation"
966      stylesheetfile="${javadoc.src}/javadoc.css"
967      classpathref="javadoc.classpath"
968      linksource="false"
969      breakiterator="yes"
970      encoding="iso-8859-1"
971      overview="${javadoc.src}/overview.html"
972      >
973      <group title="Public API"
974        packages="net.sf.basedb.core:net.sf.basedb.core.plugin:net.sf.basedb.core.query:net.sf.basedb.util*:net.sf.basedb.clients.web.taglib*:net.sf.basedb.plugins:net.sf.basedb.core.authentication"
975      />
976      <group title="Mixed Public and Internal API"
977        packages="net.sf.basedb.core.data:net.sf.basedb.clients.web:net.sf.basedb.clients.web.util"
978      />
979      <group title="Extension API"
980        packages="net.sf.basedb.core.dbengine:net.sf.basedb.clients.jobagent"
981      />
982      <group title="Internal API"
983        packages="net.sf.basedb.core.data.keyring:net.sf.basedb.clients.jobagent.*:net.sf.basedb.clients.migrate*:net.sf.basedb.clients.web.*"
984      />
985     
986      <header><![CDATA[${base.version}: ${TODAY}]]></header>
987      <link href="http://java.sun.com/j2se/1.5/docs/api"/>
988      <link href="http://www.hibernate.org/hib_docs/v3/api"/>
989      <link href="http://www.jdom.org/docs/apidocs/" />
990      <link href="http://java.sun.com/products/servlet/2.2/javadoc/" />
991      <link href="http://www.singularsys.com/jep/doc/javadoc/" />
992      <link href="http://www.jfree.org/jfreechart/api/gjdoc/" />
993      <link href="http://logging.apache.org/log4j/docs/api/" />
994      <link href="http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/" />
995      <tag name="base.developer" description="Developer info" />
996      <tag name="base.internal" description="This class/package is not part of the Public API" scope="overview,packages,types" />
997      <tag name="base.modified" description="Last modified" />
998      <tag name="hibernate.class" description="Hibernate: class" scope="types" />
999      <tag name="hibernate.subclass" description="Hibernate: subclass" scope="types" />
1000      <tag name="hibernate.discriminator" description="Hibernate: discriminator" scope="types" />
1001      <tag name="hibernate.id" description="Hibernate: id" scope="methods" />
1002      <tag name="hibernate.generator-param" description="Hibernate: generator-param" scope="methods" />
1003      <tag name="hibernate.version" description="Hibernate: version" scope="methods" />
1004      <tag name="hibernate.property" description="Hibernate: property" scope="methods" />
1005      <tag name="hibernate.column" description="Hibernate: column" scope="methods" />
1006      <tag name="hibernate.map" description="Hibernate: map" scope="methods" />
1007      <tag name="hibernate.set" description="Hibernate: set" scope="methods" />
1008      <tag name="hibernate.list" description="Hibernate: list" scope="methods" />
1009      <tag name="hibernate.array" description="Hibernate: array" scope="methods" />
1010      <tag name="hibernate.one-to-one" description="Hibernate: one-to-one" scope="methods" />
1011      <tag name="hibernate.many-to-one" description="Hibernate: many-to-one" scope="methods" />
1012      <tag name="hibernate.many-to-many" description="Hibernate: many-to-many" scope="methods" />
1013      <tag name="hibernate.index-many-to-many" description="Hibernate: index-many-to-many" scope="methods" />
1014      <tag name="hibernate.collection-key" description="Hibernate: collection-key" scope="methods" />
1015      <tag name="hibernate.collection-index" description="Hibernate: collection-index" scope="methods" />
1016      <tag name="hibernate.collection-composite-index" description="Hibernate: collection-composite-index" scope="methods" />
1017      <tag name="hibernate.collection-element" description="Hibernate: collection-element" scope="methods" />
1018      <tag name="hibernate.collection-composite-element" description="Hibernate: collection-composite-element" scope="methods" />
1019      <tag name="hibernate.collection-one-to-many" description="Hibernate: collection-one-to-many" scope="methods" />
1020      <tag name="hibernate.collection-many-to-many" description="Hibernate: collection-many-to-many" scope="methods" />
1021      <tag name="hibernate.bag" description="Hibernate: bag" scope="methods" />
1022      <tag name="hibernate.many-to-any" description="Hibernate: many-to-any" scope="methods" />
1023      <tag name="hibernate.many-to-any-column" description="Hibernate: many-to-any-column" scope="methods" />
1024      <tag name="hibernate.component" description="Hibernate: component" scope="methods" />
1025    </javadoc>
1026  </target>
1027 
1028  <target
1029    name="doc.docbook"
1030    depends="doc.init,doc.docbook.html,doc.docbook.pdf"
1031    description="Generate docbook user and admin documentation."
1032    >
1033  </target>
1034   
1035  <target 
1036    name="doc.docbook.html"
1037    depends="dev.init,doc.init,xsltprocessor"
1038    >
1039    <mkdir dir="${doc}/docbook/html" />
1040    <!--Create subdirectories to store the chunked files in-->
1041    <mkdir dir="${doc}/docbook/html/admindoc"/>
1042    <mkdir dir="${doc}/docbook/html/admindoc/user_administration"/>
1043    <mkdir dir="${doc}/docbook/html/admindoc/installation_upgrade"/>
1044    <mkdir dir="${doc}/docbook/html/admindoc/plugin_installation"/>
1045    <mkdir dir="${doc}/docbook/html/admindoc/coreplugin_configuration"/>
1046    <mkdir dir="${doc}/docbook/html/developerdoc"/>
1047    <mkdir dir="${doc}/docbook/html/developerdoc/api"/>
1048    <mkdir dir="${doc}/docbook/html/developerdoc/develop_overview"/>
1049    <mkdir dir="${doc}/docbook/html/developerdoc/core_ref"/>
1050    <mkdir dir="${doc}/docbook/html/developerdoc/javadoc"/>
1051    <mkdir dir="${doc}/docbook/html/developerdoc/plugin_developer"/>
1052    <mkdir dir="${doc}/docbook/html/developerdoc/write_doc"/>
1053    <mkdir dir="${doc}/docbook/html/overviewdoc/overview"/>
1054    <mkdir dir="${doc}/docbook/html/overviewdoc"/>
1055    <mkdir dir="${doc}/docbook/html/overviewdoc/why_base"/>
1056    <mkdir dir="${doc}/docbook/html/overviewdoc/resources"/>
1057    <mkdir dir="${doc}/docbook/html/userdoc"/>
1058    <mkdir dir="${doc}/docbook/html/userdoc/about"/>
1059    <mkdir dir="${doc}/docbook/html/userdoc/annotations"/>
1060    <mkdir dir="${doc}/docbook/html/userdoc/array_lims"/>
1061    <mkdir dir="${doc}/docbook/html/userdoc/biomaterials"/>
1062    <mkdir dir="${doc}/docbook/html/userdoc/analysis"/>
1063    <mkdir dir="${doc}/docbook/html/userdoc/filesystem"/>
1064    <mkdir dir="${doc}/docbook/html/userdoc/hardware"/>
1065    <mkdir dir="${doc}/docbook/html/userdoc/import_export"/>
1066    <mkdir dir="${doc}/docbook/html/userdoc/jobs"/>
1067    <mkdir dir="${doc}/docbook/html/userdoc/project_permission"/>
1068    <mkdir dir="${doc}/docbook/html/userdoc/protocols"/>
1069    <mkdir dir="${doc}/docbook/html/userdoc/reporters"/>
1070    <mkdir dir="${doc}/docbook/html/userdoc/software"/>
1071    <mkdir dir="${doc}/docbook/html/userdoc/trashcan"/>
1072    <mkdir dir="${doc}/docbook/html/userdoc/webclient"/>
1073    <mkdir dir="${doc}/docbook/html/faqs" />
1074       
1075    <mkdir dir="${build}/docbook/html" />
1076    <delete description="Delete existing documents">
1077      <fileset dir="${build}/docbook" defaultexcludes="no" />
1078      <fileset dir="${doc}/docbook/html" defaultexcludes="no" />
1079    </delete>
1080    <delete file="data/helptexts.xml" />
1081  <ant antfile="${lib}/docbook/ant-build-docbook.xml" inheritall="false" target="html.chunked">
1082      <property name="ant.docbook.styler.dir" location="${lib}/docbook" />
1083      <property name="docbook.xml.dir" location="${docbook.src}" />
1084      <property name="docbook.resources.dir" location="${docbook.src}/figures" />
1085      <property name="distribution.dir" location="${doc}/docbook/html" />
1086      <property name="build.dir" location="${build}/docbook/html" />
1087      <property name="base.version" value="${base.version}"/>
1088    </ant>
1089   
1090    <property name="catalog.location" location="${lib}/docbook/preprocess/catalog.xml" />
1091    <path id="ant-extensions">
1092        <fileset dir="${lib}/docbook/ant-extensions" includes="**/*.jar" />
1093        <pathelement path="${lib}/docbook/ant-extensions" />
1094      </path>
1095   
1096    <xmlcatalog id="dtdcatalog">
1097          <catalogpath>
1098              <fileset file="${catalog.location}"/>
1099          </catalogpath>
1100      </xmlcatalog>
1101
1102      <xslt
1103          in      = "${build}/docbook/html/docbook-ready-file.tmp"
1104          style   = "${lib}/docbook/preprocess/webclient_helptext.xsl"
1105          out     = "data/helptexts.xml"
1106          processor = "${xslt.processor}"
1107          >
1108          <xmlcatalog refid="dtdcatalog"/>
1109          <classpath refid="ant-extensions" />
1110
1111          <param name="xsltproc.catalog" expression="${catalog.location}" />
1112          <param name="xsltproc.option.--nonet"  expression="" />
1113      </xslt>
1114
1115    <replaceregexp 
1116      file="data/helptexts.xml"
1117      match="&lt;(?!/?name|/?description|/?helpitem|/?helptexts)(/?([a-z]+)[^>]*)&gt;"
1118      replace="&amp;lt;\$1&amp;gt;"
1119      flags="sg"
1120    />
1121  </target>
1122 
1123  <target 
1124    name="doc.docbook.pdf"
1125    depends="dev.init,doc.init"
1126    >
1127    <!-- Generate a pdf file from the documentation source -->
1128    <mkdir dir="${build}/docbook/pdf" />
1129    <echo>Generate pdf file</echo>
1130    <ant antfile="${lib}/docbook/ant-build-docbook.xml" inheritall="false" target="pdf.fop">
1131      <property name="ant.docbook.styler.dir" location="${lib}/docbook" />
1132      <property name="docbook.xml.dir" location="${docbook.src}" />
1133      <property name="docbook.resources.dir" location="${docbook.src}/figures" />
1134      <property name="distribution.dir" location="${doc}/docbook" />
1135      <property name="build.dir" location="${build}/docbook/pdf" />
1136      <property name="base.version" value="${base.version}"/>
1137    </ant>
1138  </target>
1139 
1140  <target 
1141    name="doc.dist"
1142    description="Copy documentation to the binary distribution"
1143    >
1144    <mkdir dir="dist/doc" />
1145    <copy todir="dist/doc">
1146      <fileset dir="doc" includes="admin/**/*" />
1147      <fileset dir="doc" includes="development/**/*" />
1148      <fileset dir="doc" includes="licenses/**/*" />
1149      <fileset dir="doc" includes="specifications/**/*" />
1150      <fileset dir="doc" includes="user/**/*" />
1151      <fileset dir="doc" includes="*.*" />
1152    </copy>
1153  </target>
1154
1155  <target name="xsltprocessor">
1156      <property environment="env"/>
1157
1158      <condition  property="executable.file.extension"
1159                  value=".exe">
1160              <os family="windows"/>
1161      </condition>
1162      <condition  property="executable.file.extension"
1163                  value="">
1164              <os family="unix"/>
1165      </condition>
1166     
1167      <condition  property="tmp:xsltproc.available"
1168                  value="xsltproc${executable.file.extension}">
1169          <or>
1170              <and>
1171                  <os family="windows"/>
1172                  <available file="xsltproc${executable.file.extension}" filepath="${env.Path}" />
1173              </and>
1174              <and>
1175                  <os family="unix"/>
1176                  <available file="xsltproc${executable.file.extension}" filepath="${env.PATH}" />
1177              </and>
1178          </or>
1179      </condition>
1180     
1181      <condition property="xslt.processor" value="com.dawidweiss.ant.taskdefs.XsltProcLiaison">
1182          <and>
1183              <isset property="tmp:xsltproc.available" />
1184              <not>
1185                  <isset property="disable.xsltproc" />
1186              </not>
1187          </and>
1188      </condition>
1189     
1190      <condition property="xslt.processor" value="com.dawidweiss.ant.taskdefs.SaxonLiaison">
1191          <not>
1192              <isset property="disable.saxon" />
1193          </not>
1194      </condition>
1195
1196      <condition property="xslt.processor" value="trax">
1197          <not>
1198          <and>
1199                  <isset property="tmp:xsltproc.available" />
1200                  <not>
1201                      <isset property="disable.xsltproc" />
1202                  </not>
1203          </and>
1204          </not>
1205      </condition>
1206
1207    </target>
1208 
1209  <!--package targets -->
1210  <target
1211    name="package.bin"
1212    depends="dist"
1213    description="Create binary distribution package"
1214    >
1215    <tar
1216      destfile="base-${base.version}.tar.gz"
1217      longfile="gnu"
1218      compression="gzip"
1219      >
1220      <tarfileset
1221        dir="${dist}"
1222        mode="755"
1223        prefix="base-${base.version}"
1224        preserveLeadingSlashes="true"
1225        >
1226        <include name="**/*.sh" />
1227      </tarfileset>
1228      <tarfileset
1229        dir="${dist}"
1230        prefix="base-${base.version}"
1231        preserveLeadingSlashes="true"
1232        >
1233        <exclude name="**/*.sh" />
1234      </tarfileset>
1235    </tar>
1236    <checksum file="base-${base.version}.tar.gz" />
1237  </target>
1238 
1239  <target
1240    name="package.src"
1241    depends="svn.revision"
1242    description="Create source distribution package"
1243    >
1244    <property name="tempdir" location="base-${base.version}-src" />
1245    <delete dir="${tempdir}" failonerror="false"/>
1246    <svn>
1247      <export srcPath="." destPath="${tempdir}" />
1248    </svn>
1249    <replaceregexp 
1250      file="${tempdir}/build.xml"
1251      match="&lt;svn&gt;.*&lt;status.*?&lt;/svn&gt;"
1252      replace="&lt;property name=&#34;base.build&#34; value=&#34;${base.build}&#34; /&gt;"
1253      flags="s"
1254    />
1255    <replace file="${tempdir}/build.xml"
1256      description="Remove references to package.src">
1257      <replacefilter 
1258        token="package.bin,package.src"
1259        value="package.bin"
1260      />
1261    </replace>
1262    <replaceregexp 
1263      file="${tempdir}/build.xml"
1264      match="&lt;target\s*?name=&#34;package.src&#34;.*?&lt;/target&gt;"
1265      replace=""
1266      flags="s"
1267      description="Remove package.src target"
1268    />
1269      <tar
1270      destfile="base-${base.version}-src.tar.gz"
1271      longfile="gnu"
1272      compression="gzip"
1273      >
1274      <tarfileset
1275        dir="${tempdir}"
1276        mode="755"
1277        prefix="base-${base.version}-src"
1278        preserveLeadingSlashes="true"
1279        >
1280        <include name="**/*.sh" />
1281      </tarfileset>
1282      <tarfileset
1283        dir="${tempdir}"
1284        prefix="base-${base.version}-src"
1285        preserveLeadingSlashes="true"
1286        >
1287        <exclude name="**/*.sh" />
1288      </tarfileset>
1289    </tar>
1290    <checksum file="base-${base.version}-src.tar.gz"/>
1291    <delete dir="${tempdir}" />
1292  </target>
1293 
1294</project>
Note: See TracBrowser for help on using the repository browser.