source: branches/3.4-stable/build.xml @ 6781

Last change on this file since 6781 was 6781, checked in by Nicklas Nordborg, 7 years ago

Preparing to release BASE 3.4.2

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 41.0 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3    $Id: build.xml 6781 2015-03-18 07:04:59Z 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="2" />
71  <property name="base.versionsuffix" value="" />
72  <property name="base.version" 
73    value="${base.majorversion}.${base.minorversion}.${base.maintenanceversion}" />
74 
75  <!-- set other global properties for this build -->
76  <property name="javac.arg" value="-Xlint: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    <copy todir="${build}/hbm"
489      description="Copy our data class files so xdoclet doesn't parse other code">
490      <fileset dir="${core.src}" includes="net/sf/basedb/core/data/**/*" />
491    </copy>
492   
493    <hibernatedoclet
494      destdir="${core.build}"
495      excludedtags="@version,@author,@todo"
496      mergedir="${core.build}"
497      verbose="true"
498      >
499      <fileset dir="${build}/hbm">
500        <include name="net/sf/basedb/core/data/**/*.java"/>
501      </fileset>
502      <hibernate version="2.0" />
503    </hibernatedoclet>
504   
505    <replace
506      dir="${core.build}"
507      >
508      <include name="**/*.hbm.xml"/>
509      <replacefilter 
510        token="-//Hibernate/Hibernate Mapping DTD 2.0//EN"
511        value="-//Hibernate/Hibernate Mapping DTD 3.0//EN"
512      />
513      <replacefilter 
514        token="http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"
515        value="http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"
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      >
990      <group title="Public API">
991        <package name="net.sf.basedb.info" />
992        <package name="net.sf.basedb.core" />
993        <package name="net.sf.basedb.core.plugin" />
994        <package name="net.sf.basedb.core.query" />
995        <package name="net.sf.basedb.core.signal" />
996        <package name="net.sf.basedb.core.authentication" />
997        <package name="net.sf.basedb.core.snapshot" />
998        <package name="net.sf.basedb.plugins*" />
999        <package name="net.sf.basedb.util*" />
1000        <package name="net.sf.basedb.clients.web.taglib*" />
1001        <package name="net.sf.basedb.clients.web.extensions*" />
1002      </group>
1003      <group title="Mixed Public and Internal API">
1004        <package name="net.sf.basedb.core.data" />
1005        <package name="net.sf.basedb.clients.web" />
1006        <package name="net.sf.basedb.clients.web.util" />
1007      </group>
1008      <group title="Extension API">
1009        <package name="net.sf.basedb.core.dbengine" />
1010        <package name="net.sf.basedb.core.log*" />
1011        <package name="net.sf.basedb.util.overview.*" />
1012        <package name="net.sf.basedb.util.extensions.manager.*" />
1013        <package name="net.sf.basedb.clients.jobagent" />
1014      </group>
1015      <group title="Internal API">
1016        <package name="net.sf.basedb.core.data.keyring" />
1017        <package name="net.sf.basedb.clients.jobagent.*" />
1018        <package name="net.sf.basedb.clients.web.*" />
1019        <package name="net.sf.basedb.core.hibernate" />
1020      </group>
1021     
1022      <header><![CDATA[${base.version}${base.versionsuffix}: ${TODAY}]]></header>
1023      <link href="http://docs.oracle.com/javase/7/docs/api/"/>
1024      <link href="http://docs.jboss.org/hibernate/core/3.6/javadocs/" />
1025      <link href="http://www.jdom.org/docs/apidocs/" />
1026      <link href="http://tomcat.apache.org/tomcat-7.0-doc/servletapi/" />
1027      <link href="http://tomcat.apache.org/tomcat-7.0-doc/jspapi/" />
1028      <link href="http://tomcat.apache.org/tomcat-7.0-doc/api/" />
1029      <link href="http://www.singularsys.com/jep/doc/javadoc/" />
1030      <link href="http://www.jfree.org/jfreechart/api/gjdoc/" />
1031      <link href="http://logging.apache.org/log4j/1.2/apidocs/" />
1032      <link href="http://download.oracle.com/docs/cd/E17802_01/products/products/java-media/jai/forDevelopers/jai-apidocs/" />
1033      <tag name="base.developer" description="Developer info" />
1034      <tag name="base.internal" description="This class/package is not part of the Public API" scope="overview,packages,types" />
1035      <tag name="base.modified" description="Last modified" />
1036      <tag name="hibernate.class" description="Hibernate: class" scope="types" />
1037      <tag name="hibernate.subclass" description="Hibernate: subclass" scope="types" />
1038      <tag name="hibernate.discriminator" description="Hibernate: discriminator" scope="types" />
1039      <tag name="hibernate.id" description="Hibernate: id" scope="methods" />
1040      <tag name="hibernate.generator-param" description="Hibernate: generator-param" scope="methods" />
1041      <tag name="hibernate.version" description="Hibernate: version" scope="methods" />
1042      <tag name="hibernate.property" description="Hibernate: property" scope="methods" />
1043      <tag name="hibernate.column" description="Hibernate: column" scope="methods" />
1044      <tag name="hibernate.map" description="Hibernate: map" scope="methods" />
1045      <tag name="hibernate.set" description="Hibernate: set" scope="methods" />
1046      <tag name="hibernate.list" description="Hibernate: list" scope="methods" />
1047      <tag name="hibernate.one-to-one" description="Hibernate: one-to-one" scope="methods" />
1048      <tag name="hibernate.many-to-one" description="Hibernate: many-to-one" scope="methods" />
1049      <tag name="hibernate.index-many-to-many" description="Hibernate: index-many-to-many" scope="methods" />
1050      <tag name="hibernate.collection-key" description="Hibernate: collection-key" scope="methods" />
1051      <tag name="hibernate.collection-index" description="Hibernate: collection-index" scope="methods" />
1052      <tag name="hibernate.collection-composite-index" description="Hibernate: collection-composite-index" scope="methods" />
1053      <tag name="hibernate.collection-element" description="Hibernate: collection-element" scope="methods" />
1054      <tag name="hibernate.collection-composite-element" description="Hibernate: collection-composite-element" scope="methods" />
1055      <tag name="hibernate.collection-one-to-many" description="Hibernate: collection-one-to-many" scope="methods" />
1056      <tag name="hibernate.collection-many-to-many" description="Hibernate: collection-many-to-many" scope="methods" />
1057      <tag name="hibernate.bag" description="Hibernate: bag" scope="methods" />
1058      <tag name="hibernate.many-to-any" description="Hibernate: many-to-any" scope="methods" />
1059      <tag name="hibernate.many-to-any-column" description="Hibernate: many-to-any-column" scope="methods" />
1060      <tag name="hibernate.component" description="Hibernate: component" scope="methods" />
1061    </javadoc>
1062  </target>
1063 
1064  <target
1065    name="doc.docbook"
1066    depends="doc.init,doc.docbook.html"
1067    description="Generate docbook user and admin documentation."
1068    >
1069  </target>
1070   
1071  <target 
1072    name="doc.docbook.html"
1073    depends="dev.init,doc.init,xsltprocessor"
1074    >
1075    <mkdir dir="${docbook.html.out}" />
1076    <!--Create subdirectories to store the chunked files in-->
1077    <mkdir dir="${docbook.html.out}/admin"/>
1078    <mkdir dir="${docbook.html.out}/developer"/>
1079    <mkdir dir="${docbook.html.out}/developer/plugins"/>
1080    <mkdir dir="${docbook.html.out}/developer/extensions"/>
1081    <mkdir dir="${docbook.html.out}/developer/api"/>
1082    <mkdir dir="${docbook.html.out}/developer/documentation"/>
1083    <mkdir dir="${docbook.html.out}/user"/>
1084    <mkdir dir="${docbook.html.out}/user/webclient"/>
1085    <mkdir dir="${docbook.html.out}/user/projects"/>
1086    <mkdir dir="${docbook.html.out}/user/files"/>
1087    <mkdir dir="${docbook.html.out}/user/annotations"/>
1088    <mkdir dir="${docbook.html.out}/user/biomaterials"/>
1089    <mkdir dir="${docbook.html.out}/user/experiments"/>
1090    <mkdir dir="${docbook.html.out}/faq" />
1091    <mkdir dir="${docbook.html.out}/appendix" />
1092       
1093    <mkdir dir="${build}/docbook/html" />
1094    <delete description="Delete existing documents">
1095      <fileset dir="${build}/docbook" defaultexcludes="no" />
1096      <fileset dir="${docbook.html.out}" defaultexcludes="no" />
1097    </delete>
1098    <delete file="data/helptexts.xml" />
1099    <ant antfile="${lib}/docbook/ant-build-docbook.xml" inheritall="false" target="html.chunked">
1100      <property name="ant.docbook.styler.dir" location="${lib}/docbook" />
1101      <property name="docbook.xml.dir" location="${docbook.src}" />
1102      <property name="docbook.resources.dir" location="${docbook.src}/figures" />
1103      <property name="distribution.dir" location="${docbook.html.out}" />
1104      <property name="build.dir" location="${build}/docbook/html" />
1105      <property name="base.version" value="${base.version}${base.versionsuffix}"/>
1106      <property name="dateformat" value="yyyy-MM-dd" />
1107    </ant>
1108    <copy todir="${docbook.html.out}">
1109      <fileset dir="${docbook.src}" includes="css/*.*" />
1110      <fileset dir="${docbook.src}" includes="script/*.*" />
1111      <fileset dir="${docbook.src}" includes="examples/*.*" />
1112     </copy>
1113   
1114    <property name="catalog.location" location="${lib}/docbook/preprocess/catalog.xml" />
1115    <path id="ant-extensions">
1116        <fileset dir="${lib}/docbook/ant-extensions" includes="**/*.jar" />
1117        <pathelement path="${lib}/docbook/ant-extensions" />
1118      </path>
1119   
1120    <xmlcatalog id="dtdcatalog">
1121          <catalogpath>
1122              <fileset file="${catalog.location}"/>
1123          </catalogpath>
1124      </xmlcatalog>
1125
1126      <xslt
1127          in      = "${build}/docbook/html/docbook-ready-file.tmp"
1128          style   = "${lib}/docbook/preprocess/webclient_helptext.xsl"
1129          out     = "data/helptexts.xml"
1130          processor = "${xslt.processor}"
1131          >
1132          <xmlcatalog refid="dtdcatalog"/>
1133          <classpath refid="ant-extensions" />
1134
1135          <param name="xsltproc.catalog" expression="${catalog.location}" />
1136          <param name="xsltproc.option.--nonet"  expression="" />
1137      </xslt>
1138  </target>
1139 
1140  <target 
1141    name="doc.dist"
1142    description="Copy documentation to the binary distribution"
1143    >
1144    <mkdir dir="dist/doc" />
1145    <copy todir="dist/doc">
1146      <!--fileset dir="doc" includes="admin/**/*" /-->
1147      <!--fileset dir="doc" includes="development/**/*" /-->
1148      <fileset dir="doc" includes="licenses/**/*" />
1149      <fileset dir="doc" includes="historical/**/*" />
1150      <fileset dir="doc" includes="test/**/*" />
1151      <!--fileset dir="doc" includes="user/**/*" /-->
1152      <fileset dir="doc" includes="*.*" />
1153    </copy>
1154  </target>
1155
1156  <target name="xsltprocessor">
1157      <property environment="env"/>
1158
1159      <condition  property="executable.file.extension"
1160                  value=".exe">
1161              <os family="windows"/>
1162      </condition>
1163      <condition  property="executable.file.extension"
1164                  value="">
1165              <os family="unix"/>
1166      </condition>
1167     
1168      <condition  property="tmp:xsltproc.available"
1169                  value="xsltproc${executable.file.extension}">
1170          <or>
1171              <and>
1172                  <os family="windows"/>
1173                  <available file="xsltproc${executable.file.extension}" filepath="${env.Path}" />
1174              </and>
1175              <and>
1176                  <os family="unix"/>
1177                  <available file="xsltproc${executable.file.extension}" filepath="${env.PATH}" />
1178              </and>
1179          </or>
1180      </condition>
1181     
1182      <condition property="xslt.processor" value="com.dawidweiss.ant.taskdefs.XsltProcLiaison">
1183          <and>
1184              <isset property="tmp:xsltproc.available" />
1185              <not>
1186                  <isset property="disable.xsltproc" />
1187              </not>
1188          </and>
1189      </condition>
1190     
1191      <condition property="xslt.processor" value="com.dawidweiss.ant.taskdefs.SaxonLiaison">
1192          <not>
1193              <isset property="disable.saxon" />
1194          </not>
1195      </condition>
1196
1197      <condition property="xslt.processor" value="trax">
1198          <not>
1199          <and>
1200                  <isset property="tmp:xsltproc.available" />
1201                  <not>
1202                      <isset property="disable.xsltproc" />
1203                  </not>
1204          </and>
1205          </not>
1206      </condition>
1207
1208    </target>
1209 
1210  <!--package targets -->
1211  <target
1212    name="package.bin"
1213    depends="dist"
1214    description="Create binary distribution package"
1215    >
1216    <mkdir dir="${package}" />
1217    <tar
1218      destfile="${package}/base-${base.version}${base.versionsuffix}.tar.gz"
1219      longfile="gnu"
1220      compression="gzip"
1221      >
1222      <tarfileset
1223        dir="${dist}"
1224        mode="755"
1225        prefix="base-${base.version}${base.versionsuffix}"
1226        preserveLeadingSlashes="true"
1227        >
1228        <include name="**/*.sh" />
1229      </tarfileset>
1230      <tarfileset
1231        dir="${dist}"
1232        prefix="base-${base.version}${base.versionsuffix}"
1233        preserveLeadingSlashes="true"
1234        >
1235        <exclude name="**/*.sh" />
1236      </tarfileset>
1237    </tar>
1238    <checksum file="${package}/base-${base.version}${base.versionsuffix}.tar.gz" />
1239  </target>
1240 
1241  <target
1242    name="package.src"
1243    depends="svn.revision"
1244    description="Create source distribution package"
1245    >
1246    <property name="tempdir" location="base-${base.version}${base.versionsuffix}-src" />
1247    <delete dir="${tempdir}" failonerror="false"/>
1248    <svn>
1249      <export srcPath="." destPath="${tempdir}" />
1250    </svn>
1251    <replaceregexp 
1252      file="${tempdir}/build.xml"
1253      match="&lt;svn&gt;.*&lt;status.*?&lt;/svn&gt;"
1254      replace="&lt;property name=&#34;base.build&#34; value=&#34;${base.build}&#34; /&gt;"
1255      flags="s"
1256    />
1257    <replace file="${tempdir}/build.xml"
1258      description="Remove references to package.src">
1259      <replacefilter 
1260        token="package.bin,package.src"
1261        value="package.bin"
1262      />
1263    </replace>
1264    <replaceregexp 
1265      file="${tempdir}/build.xml"
1266      match="&lt;target\s*?name=&#34;package.src&#34;.*?&lt;/target&gt;"
1267      replace=""
1268      flags="s"
1269      description="Remove package.src target"
1270    />
1271    <mkdir dir="${package}" />
1272      <tar
1273      destfile="${package}/base-${base.version}${base.versionsuffix}-src.tar.gz"
1274      longfile="gnu"
1275      compression="gzip"
1276      >
1277      <tarfileset
1278        dir="${tempdir}"
1279        mode="755"
1280        prefix="base-${base.version}${base.versionsuffix}-src"
1281        preserveLeadingSlashes="true"
1282        >
1283        <include name="**/*.sh" />
1284      </tarfileset>
1285      <tarfileset
1286        dir="${tempdir}"
1287        prefix="base-${base.version}${base.versionsuffix}-src"
1288        preserveLeadingSlashes="true"
1289        >
1290        <exclude name="**/*.sh" />
1291      </tarfileset>
1292    </tar>
1293    <checksum file="${package}/base-${base.version}${base.versionsuffix}-src.tar.gz"/>
1294    <delete dir="${tempdir}" />
1295  </target>
1296   
1297  <target 
1298    name="svn.update"
1299    description="Issues an 'svn update' command to check out the latest revision from subversion"
1300    >
1301    <svn>
1302      <update dir="." />
1303    </svn>
1304  </target>
1305 
1306  <target
1307    name="svn.diff"
1308    depends="svn.revision"
1309    description="Issues an 'svn diff' command to generate a patch with local changes"
1310    >
1311    <echo>NOTE! New files must be added to svn with 'svn add' or they will not be added to the patch.</echo>
1312    <property name="patchfile" value="patch-${base.build}.diff" />
1313    <pathconvert property="patchdir" dirsep="/" >
1314      <path location="." />
1315    </pathconvert>
1316    <svn>
1317      <diff oldpath="." outfile="${patchfile}"/>
1318    </svn>
1319    <replaceregexp file="${patchfile}" match="${patchdir}/" replace="" flags="g" />
1320    <echo>Generated patch file: ${patchfile}</echo>
1321  </target>
1322   
1323</project>
Note: See TracBrowser for help on using the repository browser.