source: trunk/build.xml @ 3198

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

Added an ant task and a xsl stylesheet for helptext-import-file generation.

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