source: trunk/build.xml @ 6633

Last change on this file since 6633 was 6633, checked in by Nicklas Nordborg, 8 years ago

References #1742: Upgrade to Hibernate 4.x

Replacing outer-join="auto" with nothing since Hibernate complained about outer-join being deprecated.

Also making some configuration options for ehcache that Hibernate wanted to use.

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