source: trunk/build.xml @ 3763

Last change on this file since 3763 was 3763, checked in by Martin Svensson, 14 years ago

References #364, Added instructions how to make ant put base-plugins.xml and base-configurations.xml
in the plugin jar-file when building an external plugin.
Also updated the examples about this.

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