source: branches/3.16-stable/build.xml @ 7791

Last change on this file since 7791 was 7791, checked in by Nicklas Nordborg, 3 years ago

Preparing release 3.16

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