source: trunk/build.xml @ 6490

Last change on this file since 6490 was 6490, checked in by Nicklas Nordborg, 9 years ago

Fixes #1817: Do not generate BASE documentation PDF

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