source: branches/3.17-stable/build.xml @ 7873

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

Changes for future release BASE 3.17.1

  • 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 7873 2020-10-22 06:11:15Z 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="1" />
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.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      stylesheetfile="${javadoc.src}/javadoc.css"
997      classpathref="javadoc.classpath"
998      linksource="false"
999      breakiterator="yes"
1000      encoding="${javac.encoding}"
1001      overview="${javadoc.src}/overview.html"
1002      maxmemory="256M"
1003      additionalparam="${javadoc.arg}"
1004      >
1005      <group title="Public API">
1006        <package name="net.sf.basedb.info" />
1007        <package name="net.sf.basedb.core" />
1008        <package name="net.sf.basedb.core.plugin" />
1009        <package name="net.sf.basedb.core.query" />
1010        <package name="net.sf.basedb.core.signal" />
1011        <package name="net.sf.basedb.core.authentication" />
1012        <package name="net.sf.basedb.core.snapshot" />
1013        <package name="net.sf.basedb.plugins*" />
1014        <package name="net.sf.basedb.util*" />
1015        <package name="net.sf.basedb.clients.web.taglib*" />
1016        <package name="net.sf.basedb.clients.web.extensions*" />
1017      </group>
1018      <group title="Mixed Public and Internal API">
1019        <package name="net.sf.basedb.core.data" />
1020        <package name="net.sf.basedb.clients.web" />
1021        <package name="net.sf.basedb.clients.web.util" />
1022      </group>
1023      <group title="Extension API">
1024        <package name="net.sf.basedb.core.dbengine" />
1025        <package name="net.sf.basedb.core.log*" />
1026        <package name="net.sf.basedb.util.overview.*" />
1027        <package name="net.sf.basedb.util.extensions.manager.*" />
1028        <package name="net.sf.basedb.clients.jobagent" />
1029      </group>
1030      <group title="Internal API">
1031        <package name="net.sf.basedb.core.data.keyring" />
1032        <package name="net.sf.basedb.clients.jobagent.*" />
1033        <package name="net.sf.basedb.clients.web.*" />
1034        <package name="net.sf.basedb.core.hibernate" />
1035      </group>
1036     
1037      <header><![CDATA[${base.version}${base.versionsuffix}: ${TODAY}]]></header>
1038      <link href="https://docs.oracle.com/en/java/javase/11/docs/api/"/>
1039      <link href="https://docs.jboss.org/hibernate/orm/5.4/javadocs/" />
1040      <link href="http://www.jdom.org/docs/apidocs/" />
1041      <link href="http://tomcat.apache.org/tomcat-9.0-doc/servletapi/" />
1042      <link href="http://tomcat.apache.org/tomcat-9.0-doc/jspapi/" />
1043      <link href="http://tomcat.apache.org/tomcat-9.0-doc/api/" />
1044      <link href="http://www.singularsys.com/jep/doc/javadoc/" />
1045      <link href="http://www.jfree.org/jfreechart/api/gjdoc/" />
1046      <link href="http://logging.apache.org/log4j/1.2/apidocs/" />
1047      <tag name="base.developer" description="Developer info" />
1048      <tag name="base.internal" description="This class/package is not part of the Public API" scope="overview,packages,types" />
1049      <tag name="base.modified" description="Last modified" />
1050      <tag name="hibernate.class" description="Hibernate: class" scope="types" />
1051      <tag name="hibernate.subclass" description="Hibernate: subclass" scope="types" />
1052      <tag name="hibernate.discriminator" description="Hibernate: discriminator" scope="types" />
1053      <tag name="hibernate.id" description="Hibernate: id" scope="methods" />
1054      <tag name="hibernate.generator-param" description="Hibernate: generator-param" scope="methods" />
1055      <tag name="hibernate.version" description="Hibernate: version" scope="methods" />
1056      <tag name="hibernate.property" description="Hibernate: property" scope="methods" />
1057      <tag name="hibernate.column" description="Hibernate: column" scope="methods" />
1058      <tag name="hibernate.map" description="Hibernate: map" scope="methods" />
1059      <tag name="hibernate.set" description="Hibernate: set" scope="methods" />
1060      <tag name="hibernate.list" description="Hibernate: list" scope="methods" />
1061      <tag name="hibernate.one-to-one" description="Hibernate: one-to-one" scope="methods" />
1062      <tag name="hibernate.many-to-one" description="Hibernate: many-to-one" scope="methods" />
1063      <tag name="hibernate.index-many-to-many" description="Hibernate: index-many-to-many" scope="methods" />
1064      <tag name="hibernate.collection-key" description="Hibernate: collection-key" scope="methods" />
1065      <tag name="hibernate.collection-index" description="Hibernate: collection-index" scope="methods" />
1066      <tag name="hibernate.collection-composite-index" description="Hibernate: collection-composite-index" scope="methods" />
1067      <tag name="hibernate.collection-element" description="Hibernate: collection-element" scope="methods" />
1068      <tag name="hibernate.collection-composite-element" description="Hibernate: collection-composite-element" scope="methods" />
1069      <tag name="hibernate.collection-one-to-many" description="Hibernate: collection-one-to-many" scope="methods" />
1070      <tag name="hibernate.collection-many-to-many" description="Hibernate: collection-many-to-many" scope="methods" />
1071      <tag name="hibernate.component" description="Hibernate: component" scope="methods" />
1072      <tag name="hibernate.bag" description="Hibernate: bag" scope="methods" />
1073      <tag name="hibernate.many-to-any" description="Hibernate: many-to-any" scope="methods" />
1074      <tag name="hibernate.many-to-any-column" description="Hibernate: many-to-any-column" scope="methods" />
1075    </javadoc>
1076  </target>
1077 
1078  <target
1079    name="doc.docbook"
1080    depends="doc.init,doc.docbook.html"
1081    description="Generate docbook user and admin documentation."
1082    >
1083  </target>
1084   
1085  <target 
1086    name="doc.docbook.html"
1087    depends="dev.init,doc.init,xsltprocessor"
1088    >
1089    <mkdir dir="${docbook.html.out}" />
1090    <!--Create subdirectories to store the chunked files in-->
1091    <mkdir dir="${docbook.html.out}/admin"/>
1092    <mkdir dir="${docbook.html.out}/developer"/>
1093    <mkdir dir="${docbook.html.out}/developer/plugins"/>
1094    <mkdir dir="${docbook.html.out}/developer/extensions"/>
1095    <mkdir dir="${docbook.html.out}/developer/api"/>
1096    <mkdir dir="${docbook.html.out}/developer/documentation"/>
1097    <mkdir dir="${docbook.html.out}/user"/>
1098    <mkdir dir="${docbook.html.out}/user/webclient"/>
1099    <mkdir dir="${docbook.html.out}/user/projects"/>
1100    <mkdir dir="${docbook.html.out}/user/files"/>
1101    <mkdir dir="${docbook.html.out}/user/annotations"/>
1102    <mkdir dir="${docbook.html.out}/user/biomaterials"/>
1103    <mkdir dir="${docbook.html.out}/user/experiments"/>
1104    <mkdir dir="${docbook.html.out}/faq" />
1105    <mkdir dir="${docbook.html.out}/appendix" />
1106       
1107    <mkdir dir="${build}/docbook/html" />
1108    <delete description="Delete existing documents">
1109      <fileset dir="${build}/docbook" defaultexcludes="no" />
1110      <fileset dir="${docbook.html.out}" defaultexcludes="no" />
1111    </delete>
1112    <delete file="data/helptexts.xml" />
1113    <ant antfile="${lib}/docbook/ant-build-docbook.xml" inheritall="false" target="html.chunked">
1114      <property name="ant.docbook.styler.dir" location="${lib}/docbook" />
1115      <property name="svnkit.dir" location="${lib}/svnkit" />
1116      <property name="docbook.xml.dir" location="${docbook.src}" />
1117      <property name="docbook.resources.dir" location="${docbook.src}/figures" />
1118      <property name="distribution.dir" location="${docbook.html.out}" />
1119      <property name="build.dir" location="${build}/docbook/html" />
1120      <property name="base.version" value="${base.version}${base.versionsuffix}"/>
1121      <property name="dateformat" value="yyyy-MM-dd" />
1122    </ant>
1123    <copy todir="${docbook.html.out}">
1124      <fileset dir="${docbook.src}" includes="css/*.*" />
1125      <fileset dir="${docbook.src}" includes="script/*.*" />
1126      <fileset dir="${docbook.src}" includes="examples/*.*" />
1127     </copy>
1128   
1129    <property name="catalog.location" location="${lib}/docbook/preprocess/catalog.xml" />
1130    <path id="ant-extensions">
1131        <fileset dir="${lib}/docbook/ant-extensions" includes="**/*.jar" />
1132        <pathelement path="${lib}/docbook/ant-extensions" />
1133      </path>
1134   
1135    <xmlcatalog id="dtdcatalog">
1136          <catalogpath>
1137              <fileset file="${catalog.location}"/>
1138          </catalogpath>
1139      </xmlcatalog>
1140
1141      <xslt
1142          in      = "${build}/docbook/html/docbook-ready-file.tmp"
1143          style   = "${lib}/docbook/preprocess/webclient_helptext.xsl"
1144          out     = "data/helptexts.xml"
1145          processor = "${xslt.processor}"
1146          >
1147          <xmlcatalog refid="dtdcatalog"/>
1148          <classpath refid="ant-extensions" />
1149
1150          <param name="xsltproc.catalog" expression="${catalog.location}" />
1151          <param name="xsltproc.option.--nonet"  expression="" />
1152      </xslt>
1153  </target>
1154 
1155  <target 
1156    name="doc.dist"
1157    description="Copy documentation to the binary distribution"
1158    >
1159    <mkdir dir="dist/doc" />
1160    <copy todir="dist/doc">
1161      <!--fileset dir="doc" includes="admin/**/*" /-->
1162      <!--fileset dir="doc" includes="development/**/*" /-->
1163      <fileset dir="doc" includes="licenses/**/*" />
1164      <fileset dir="doc" includes="historical/**/*" />
1165      <fileset dir="doc" includes="test/**/*" />
1166      <!--fileset dir="doc" includes="user/**/*" /-->
1167      <fileset dir="doc" includes="*.*" />
1168    </copy>
1169  </target>
1170
1171  <target name="xsltprocessor">
1172      <property environment="env"/>
1173
1174      <condition  property="executable.file.extension"
1175                  value=".exe">
1176              <os family="windows"/>
1177      </condition>
1178      <condition  property="executable.file.extension"
1179                  value="">
1180              <os family="unix"/>
1181      </condition>
1182     
1183      <condition  property="tmp:xsltproc.available"
1184                  value="xsltproc${executable.file.extension}">
1185          <or>
1186              <and>
1187                  <os family="windows"/>
1188                  <available file="xsltproc${executable.file.extension}" filepath="${env.Path}" />
1189              </and>
1190              <and>
1191                  <os family="unix"/>
1192                  <available file="xsltproc${executable.file.extension}" filepath="${env.PATH}" />
1193              </and>
1194          </or>
1195      </condition>
1196     
1197      <condition property="xslt.processor" value="com.dawidweiss.ant.taskdefs.XsltProcLiaison">
1198          <and>
1199              <isset property="tmp:xsltproc.available" />
1200              <not>
1201                  <isset property="disable.xsltproc" />
1202              </not>
1203          </and>
1204      </condition>
1205     
1206      <condition property="xslt.processor" value="com.dawidweiss.ant.taskdefs.SaxonLiaison">
1207          <not>
1208              <isset property="disable.saxon" />
1209          </not>
1210      </condition>
1211
1212      <condition property="xslt.processor" value="trax">
1213          <not>
1214          <and>
1215                  <isset property="tmp:xsltproc.available" />
1216                  <not>
1217                      <isset property="disable.xsltproc" />
1218                  </not>
1219          </and>
1220          </not>
1221      </condition>
1222
1223    </target>
1224 
1225  <!--package targets -->
1226  <target
1227    name="package.bin"
1228    depends="dist"
1229    description="Create binary distribution package"
1230    >
1231    <mkdir dir="${package}" />
1232    <tar
1233      destfile="${package}/base-${base.version}${base.versionsuffix}.tar.gz"
1234      longfile="gnu"
1235      compression="gzip"
1236      >
1237      <tarfileset
1238        dir="${dist}"
1239        mode="755"
1240        prefix="base-${base.version}${base.versionsuffix}"
1241        preserveLeadingSlashes="true"
1242        >
1243        <include name="**/*.sh" />
1244      </tarfileset>
1245      <tarfileset
1246        dir="${dist}"
1247        prefix="base-${base.version}${base.versionsuffix}"
1248        preserveLeadingSlashes="true"
1249        >
1250        <exclude name="**/*.sh" />
1251      </tarfileset>
1252    </tar>
1253    <checksum file="${package}/base-${base.version}${base.versionsuffix}.tar.gz" />
1254  </target>
1255 
1256  <target
1257    name="package.src"
1258    depends="svn.revision"
1259    description="Create source distribution package"
1260    >
1261    <property name="tempdir" location="base-${base.version}${base.versionsuffix}-src" />
1262    <delete dir="${tempdir}" failonerror="false"/>
1263    <java
1264      classname="org.tmatesoft.svn.cli.SVN"
1265      classpathref="lib.svnkit.classpath"
1266      >
1267      <arg value="export" />
1268      <arg value="-q" />  <!--quiet: or we get a list of all files that are copied -->
1269      <arg value="." />
1270      <arg path="${tempdir}" />
1271    </java>
1272   
1273    <replaceregexp 
1274      description="replacs the 'java' call in svn.revision with a static property"
1275      file="${tempdir}/build.xml"
1276      match="&lt;java.*org.tmatesoft.svn.cli.SVN.*?&lt;/loadresource&gt;"
1277      replace="&lt;property name=&#34;base.build&#34; value=&#34;${base.build}&#34; /&gt;"
1278      flags="s"
1279    />
1280    <replace file="${tempdir}/build.xml"
1281      description="Remove references to package.src">
1282      <replacefilter 
1283        token="package.bin,package.src"
1284        value="package.bin"
1285      />
1286    </replace>
1287    <replaceregexp 
1288      file="${tempdir}/build.xml"
1289      match="&lt;target\s*?name=&#34;package.src&#34;.*?&lt;/target&gt;"
1290      replace=""
1291      flags="s"
1292      description="Remove package.src target"
1293    />
1294    <mkdir dir="${package}" />
1295      <tar
1296      destfile="${package}/base-${base.version}${base.versionsuffix}-src.tar.gz"
1297      longfile="gnu"
1298      compression="gzip"
1299      >
1300      <tarfileset
1301        dir="${tempdir}"
1302        mode="755"
1303        prefix="base-${base.version}${base.versionsuffix}-src"
1304        preserveLeadingSlashes="true"
1305        >
1306        <include name="**/*.sh" />
1307      </tarfileset>
1308      <tarfileset
1309        dir="${tempdir}"
1310        prefix="base-${base.version}${base.versionsuffix}-src"
1311        preserveLeadingSlashes="true"
1312        >
1313        <exclude name="**/*.sh" />
1314      </tarfileset>
1315    </tar>
1316    <checksum file="${package}/base-${base.version}${base.versionsuffix}-src.tar.gz"/>
1317    <delete dir="${tempdir}" />
1318  </target>
1319
1320</project>
Note: See TracBrowser for help on using the repository browser.