source: branches/3.8-stable/build.xml @ 7149

Last change on this file since 7149 was 7149, checked in by Nicklas Nordborg, 5 years ago

Changes for future release 3.8.1

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