source: branches/3.19-stable/build.xml @ 8080

Last change on this file since 8080 was 8080, checked in by Nicklas Nordborg, 12 months ago

Preparing to release BASE 3.19.4

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