source: trunk/build.xml @ 7788

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

Changes for future release 3.17

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