source: trunk/build.xml @ 6727

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

Fixes #1922: Always update BASE version file when compiling

Always delete the base.version file in the build directory to force a new version to be created.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 41.1 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3    $Id: build.xml 6727 2015-02-13 07:35:11Z 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="5" />
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    <delete file="${core.build}/base.version" failonerror="false" />
412    <copy todir="${core.build}"
413      description="Resource files needed by the core; excludes documentation and source files">
414      <fileset dir="${core.src}">
415        <include name="**/*" />
416        <exclude name="**/*.java" />
417        <exclude name="**/doc-files/" />
418        <exclude name="**/package.html" />
419      </fileset>
420    </copy>
421    <replace file="${core.build}/base.version">
422      <replacefilter 
423        token="@MAJOR@"
424        value="${base.majorversion}"
425      />
426      <replacefilter 
427        token="@MINOR@"
428        value="${base.minorversion}"
429      />
430      <replacefilter 
431        token="@MAINTENANCE@"
432        value="${base.maintenanceversion}"
433      />
434      <replacefilter 
435        token="@BUILD@"
436        value="${base.build}"
437      />
438      <replacefilter 
439        token="@SUFFIX@"
440        value="${base.versionsuffix}"
441      />
442    </replace>
443    <replaceregexp 
444      file="${core.build}/core-extensions.xml"
445      match="&lt;version&gt;.*&lt;/version&gt;"
446      replace="&lt;version&gt;${base.version}${base.versionsuffix}&lt;/version&gt;"
447      encoding="UTF-8"
448    />
449  </target>
450
451  <target
452    name="check.hibernate"
453    depends="core.init"
454    >
455    <uptodate
456      property="nohibernate"
457      >
458      <srcfiles dir="${core.src}/net/sf/basedb/core/data" includes="**/*.java">
459        <contains text="@hibernate.class" />
460      </srcfiles>
461      <mapper type="glob" from="*.java" to="${core.build}/net/sf/basedb/core/data/*.hbm.xml" />
462    </uptodate>
463    <condition property="hibernate.message" 
464      value="up to date; skipping" 
465      >
466      <istrue value="${nohibernate}" />
467    </condition>
468    <condition property="hibernate.message" 
469      value="not up to date; generating new" 
470      >
471      <isfalse value="${nohibernate}" />
472    </condition>
473    <echo>Hibernate mapping files are ${hibernate.message}</echo>
474  </target>
475 
476  <target
477    name="core.hibernate"
478    depends="core.init,core.compile,check.hibernate"
479    description="Generates Hibernate mapping files from the source code"
480    unless="nohibernate"
481    >
482    <delete>
483      <fileset dir="${core.build}" includes="**/*.hbm.xml" />
484    </delete>
485    <copy todir="${core.build}" 
486      description="Hardcoded *.hbm.xml files">
487      <fileset dir="${core.src}" includes="**/*.hbm.xml" />
488    </copy>
489    <copy todir="${build}/hbm"
490      description="Copy our data class files so xdoclet doesn't parse other code">
491      <fileset dir="${core.src}" includes="net/sf/basedb/core/data/**/*" />
492    </copy>
493   
494    <hibernatedoclet
495      destdir="${core.build}"
496      excludedtags="@version,@author,@todo"
497      mergedir="${core.build}"
498      verbose="true"
499      >
500      <fileset dir="${build}/hbm">
501        <include name="net/sf/basedb/core/data/**/*.java"/>
502      </fileset>
503      <hibernate version="2.0" />
504    </hibernatedoclet>
505   
506    <replace
507      dir="${core.build}"
508      >
509      <include name="**/*.hbm.xml"/>
510      <replacefilter 
511        token="-//Hibernate/Hibernate Mapping DTD 2.0//EN"
512        value="-//Hibernate/Hibernate Mapping DTD 3.0//EN"
513      />
514      <replacefilter 
515        token="http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"
516        value="http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"
517      />
518      <replacefilter
519        token="outer-join=&#34;false&#34;"
520        value="fetch=&#34;select&#34;"
521      />
522      <replacefilter
523        token="outer-join=&#34;true&#34;"
524        value="fetch=&#34;join&#34;"
525      />
526      <replacefilter
527        token="outer-join=&#34;auto&#34;"
528        value=""
529      />
530      <replacefilter
531        token="index-many-to-many"
532        value="map-key-many-to-many"
533      />
534      <replacefilter
535        token="&lt;index&gt;"
536        value="&lt;list-index&gt;"
537      />
538      <replacefilter
539        token="&lt;/index&gt;"
540        value="&lt;/list-index&gt;"
541      />
542      <replacefilter
543        token="composite-index"
544        value="composite-map-key"
545      />
546    </replace>
547   
548    <!--
549      Move the mappings files for all Extendable classes
550      because we are going to add more tags to them at runtime
551    -->
552    <!--
553    <move
554      todir="${core.build}/net/sf/basedb/core/templates"
555      >
556      <fileset dir="${core.build}/net/sf/basedb/core/data">
557        <include name="ReporterData.hbm.xml"/>
558        <include name="UserData.hbm.xml"/>
559      </fileset>
560      <mapper type="glob" from="*.hbm.xml" to="hibernate-properties-*.xml" />
561    </move>
562    -->
563  </target>
564 
565  <target
566    name="core.jar"
567    depends="core.init,core.compile,core.hibernate"
568    description="Create the core jar file: base-core-a.b.c.jar"
569    >
570    <jar
571      basedir="${core.build}"
572      jarfile="${jar}/base-core-${base.version}.jar"
573    />
574  </target>
575
576  <!-- core plugin targets -->
577  <target
578    name="coreplugins.init"
579    depends="core.init"
580    >
581    <property name="coreplugins.src" location="${src}/plugins/core" 
582      description="Location of source files" />
583    <property name="coreplugins.build" location="${build}/plugins/core" 
584      description="Location of compiled files" />
585    <path id="coreplugins.classpath" description="Class path for compiling plugins">
586      <path refid="core.classpath"/>
587      <pathelement location="${core.build}"/>
588    </path>
589  </target>
590 
591  <target
592    name="coreplugins.compile"
593    depends="core.compile,coreplugins.init"
594    description="Compile the core plugins"
595    >
596    <mkdir dir="${coreplugins.build}" />
597    <javac
598      srcdir="${coreplugins.src}"
599      destdir="${coreplugins.build}"
600      classpathref="coreplugins.classpath"
601      encoding="${javac.encoding}"
602      debug="true"
603      deprecation="true"
604      source="${javac.source}"
605      target="${javac.target}"
606      bootclasspathref="lib.bootclasspath"
607      includeantruntime="false"
608      >
609      <compilerarg value="${javac.arg}" />
610    </javac>
611    <copy todir="${coreplugins.build}" 
612      description="Resource files needed by the core plug-ins; excludes documentation and source files">
613      <fileset dir="${coreplugins.src}">
614        <include name="**/*" />
615        <exclude name="**/*.java" />
616        <exclude name="**/doc-files/" />
617        <exclude name="**/package.html" />
618      </fileset>
619    </copy>
620    <replaceregexp 
621      file="${coreplugins.build}/core-plugins.xml"
622      match="&lt;version&gt;.*&lt;/version&gt;"
623      replace="&lt;version&gt;${base.version}${base.versionsuffix}&lt;/version&gt;"
624      encoding="UTF-8"
625    />
626  </target>
627 
628  <target
629    name="coreplugins.jar"
630    depends="coreplugins.compile"
631    description="Create the plugin jar file: base-coreplugins-a.b.c.jar"
632    >
633    <jar
634      basedir="${coreplugins.build}"
635      jarfile="${jar}/base-coreplugins-${base.version}.jar"
636    />
637  </target>
638 
639  <!-- test targets -->
640  <target
641    name="test.init"
642    depends="core.init,coreplugins.init,jobagent.init"
643    >
644    <property name="test.src" location="${src}/test" 
645      description="Location of source files" />
646    <property name="test.build" location="${build}/test" 
647      description="Location of compiled files" />
648    <path id="test.classpath" description="Class path for compiling">
649      <path refid="core.classpath"/>
650      <pathelement location="${core.build}" />
651      <pathelement location="${coreplugins.build}" />
652      <pathelement location="${jobagent.build}" />
653    </path>
654  </target>
655 
656  <target
657    name="test.compile"
658    depends="test.init,core.compile,coreplugins.compile,jobagent.compile"
659    description="Compile the test programs"
660    >
661    <mkdir dir="${test.build}" />
662    <javac
663      srcdir="${test.src}"
664      destdir="${test.build}"
665      classpathref="test.classpath"
666      encoding="${javac.encoding}"
667      debug="true"
668      deprecation="true"
669      source="${javac.source}"
670      target="${javac.target}"
671      bootclasspathref="lib.bootclasspath"
672      includeantruntime="false"
673      >
674      <compilerarg value="${javac.arg}" />
675    </javac>
676  </target>
677 
678  <target
679    name="test.jar"
680    depends="test.compile"
681    description="Create a JAR file used by the test programs; Delete corresponding .class files"
682    >
683    <jar 
684      jarfile="${test.build}/JarPlugin.jar" 
685      basedir="${test.build}" 
686      includes="JarPlugin*,NullPlugin*,Base1*"
687      excludes="JarPlugin.jar"
688      manifest="${test.src}/data/JarPluginManifest.txt"
689      >
690    </jar>
691    <delete>
692      <fileset dir="${test.build}" includes="JarPlugin*.class" />
693    </delete>
694  </target>
695
696  <!-- web targets -->
697  <target
698    name="web.init"
699    depends="core.init,coreplugins.init"
700    >
701    <property name="web.src" location="${src}/clients/web" 
702      description="Location of source files" />
703    <property name="xjspcompiler.src" location="${src}/misc/compiler" />   
704    <property name="web.build" location="${build}/clients/web" 
705      description="Location of compiled files" />
706    <property name="web.inf" location="www/WEB-INF" 
707      description="Location of the WEB-INF folder" />
708    <path id="web.classpath" description="Class path for compiling web client">
709      <path refid="core.classpath"/>
710      <pathelement location="${core.build}"/>
711      <pathelement location="${coreplugins.build}" />
712      <path refid="lib.servlet.classpath" />
713    </path>
714  </target>
715 
716  <target
717    name="web.compile"
718    depends="web.init,core.compile,coreplugins.compile"
719    description="Compile the web client application"
720    >
721    <mkdir dir="${web.build}" />
722    <javac
723      srcdir="${web.src}"
724      destdir="${web.build}"
725      classpathref="web.classpath"
726      encoding="${javac.encoding}"
727      debug="true"
728      deprecation="true"
729      source="${javac.source}"
730      target="${javac.target}"
731      bootclasspathref="lib.bootclasspath"
732      includeantruntime="false"
733      >
734      <compilerarg value="${javac.arg}" />
735    </javac>
736    <copy todir="${web.build}" 
737      description="Resource files needed by the web client; excludes documentation and source files">
738      <fileset dir="${web.src}">
739        <include name="**/*" />
740        <exclude name="**/*.java" />
741        <exclude name="**/doc-files/" />
742        <exclude name="**/package.html" />
743      </fileset>
744    </copy>
745    <replaceregexp 
746      file="${web.build}/web-extensions.xml"
747      match="&lt;version&gt;.*&lt;/version&gt;"
748      replace="&lt;version&gt;${base.version}${base.versionsuffix}&lt;/version&gt;"
749      encoding="UTF-8"
750    />
751  </target>
752 
753  <target
754    name="web.jar"
755    depends="web.compile"
756    description="Create the web client jar file: base-webclient-a.b.c.jar"
757    >
758    <jar
759      basedir="${web.build}"
760      jarfile="${jar}/base-webclient-${base.version}.jar"
761    />
762  </target>
763 
764  <target 
765    name="web.jsp"
766    depends="web"
767    description="Compile all JSP pages to a temporary directory; used for checking only"
768    >
769    <property name="jsp.build" location="${build}/jsp" />
770    <property environment="env" />
771    <delete dir="${jsp.build}" />
772    <mkdir dir="${jsp.build}/src" />
773    <mkdir dir="${jsp.build}/classes" />
774    <path id="jsp.precompile.classpath">
775      <pathelement location="${java.home}/../lib/tools.jar" />
776      <fileset dir="${env.CATALINA_HOME}">
777        <include name="lib/*.jar" />
778      </fileset>
779      <fileset dir="${env.CATALINA_HOME}/bin">
780        <include name="*.jar" />
781      </fileset>
782    </path>
783   
784    <path id="jsp.compile.classpath">
785      <path refid="jsp.precompile.classpath" />
786      <fileset dir="${web.inf}/lib">
787        <include name="*.jar" />
788      </fileset>
789      <pathelement location="${info.build}" />
790    </path>
791
792    <taskdef
793      classname="org.apache.jasper.JspC" 
794      name="jasper2"
795      classpathref="jsp.precompile.classpath"
796    />
797    <jasper2
798      validateXml="false"
799      uriroot="www"
800      webXmlFragment="${jsp.build}/generated_web.xml"
801      outputdir="${jsp.build}/src"
802      javaencoding="${javac.encoding}"
803     
804    />
805    <javac
806      destdir="${jsp.build}/classes"
807      srcdir="${jsp.build}/src"
808      debug="true"
809      classpathref="jsp.compile.classpath"
810      memoryinitialsize="256m"
811      memorymaximumsize="512m"
812      fork="true"
813      source="${javac.source}"
814      target="${javac.target}"
815      encoding="${javac.encoding}"
816      bootclasspathref="lib.bootclasspath"
817      includeantruntime="false"
818      >
819    </javac>
820  </target>
821 
822  <!-- XJsp compiler targets -->
823  <target
824    name="xjspcompiler"
825    depends="web.compile,core.compile"
826    description="Compile the XJsp compiler and put JAR in ./bin/jar"
827    >
828    <mkdir dir="${build}/misc/compiler" />
829    <javac
830      srcdir="${xjspcompiler.src}"
831      destdir="${build}/misc/compiler"
832      classpathref="web.classpath"
833      encoding="${javac.encoding}"
834      debug="true"
835      deprecation="true"
836      source="${javac.source}"
837      target="${javac.target}"
838      bootclasspathref="lib.bootclasspath"
839      includeantruntime="false"
840      >
841      <compilerarg value="${javac.arg}" />
842    </javac>
843    <jar
844      basedir="${build}/misc/compiler"
845      jarfile="${bin}/jar/base-xjsp-compiler-${base.version}.jar"
846    />
847  </target> 
848   
849  <!-- installprg targets -->
850  <target
851    name="installprg.init"
852    depends="core.init,coreplugins.init,web.init"
853    >
854    <property name="installprg.src" location="${src}/install" 
855      description="Location of source files" />
856    <property name="installprg.build" location="${build}/install" 
857      description="Location of compiled files" />
858    <path id="installprg.classpath" description="Class path for compiling installation programs">
859      <path refid="core.classpath"/>
860      <pathelement location="${core.build}"/>
861      <pathelement location="${coreplugins.build}"/>
862      <pathelement location="${web.build}"/>
863    </path>
864  </target>
865  <target
866    name="installprg.compile"
867    depends="installprg.init,core.compile"
868    description="Compile the installation programs"
869    >
870    <mkdir dir="${installprg.build}" />
871    <javac
872      srcdir="${installprg.src}"
873      destdir="${installprg.build}"
874      classpathref="installprg.classpath"
875      encoding="${javac.encoding}"
876      debug="true"
877      deprecation="true"
878      source="${javac.source}"
879      target="${javac.target}"
880      bootclasspathref="lib.bootclasspath"
881      includeantruntime="false"
882      >
883      <compilerarg value="${javac.arg}" />
884    </javac>
885  </target>
886 
887  <target
888    name="installprg.jar"
889    depends="installprg.compile"
890    description="Create the installation jar file: base-install-a.b.c.jar"
891    >
892    <jar
893      basedir="${installprg.build}"
894      jarfile="${bin}/jar/base-install-${base.version}.jar"
895    />
896  </target>
897
898  <!-- jobagent targets -->
899  <target
900    name="jobagent.init"
901    depends="core.init,coreplugins.init,web.init"
902    >
903    <property name="jobagent.src" location="${src}/clients/jobagent" 
904      description="Location of source files" />
905    <property name="jobagent.build" location="${build}/clients/jobagent" 
906      description="Location of compiled files" />
907    <path id="jobagent.classpath" description="Class path for compiling jobagent">
908      <path refid="core.classpath"/>
909      <pathelement location="${core.build}"/>
910    </path>
911  </target>
912  <target
913    name="jobagent.compile"
914    depends="jobagent.init,core.compile"
915    description="Compile the job agent application"
916    >
917    <mkdir dir="${jobagent.build}" />
918    <javac
919      srcdir="${jobagent.src}"
920      destdir="${jobagent.build}"
921      classpathref="jobagent.classpath"
922      encoding="${javac.encoding}"
923      debug="true"
924      deprecation="true"
925      source="${javac.source}"
926      target="${javac.target}"
927      bootclasspathref="lib.bootclasspath"
928      includeantruntime="false"
929      >
930      <compilerarg value="${javac.arg}" />
931    </javac>
932  </target>
933 
934  <target
935    name="jobagent.jar"
936    depends="jobagent.compile"
937    description="Create the job agent jar file: base-jobagent-a.b.c.jar"
938    >
939    <jar
940      basedir="${jobagent.build}"
941      jarfile="${bin}/jar/base-jobagent-${base.version}.jar"
942    />
943  </target>
944
945  <!-- documentation targets -->
946  <target
947    name="doc.init"
948    depends="core.init"
949    >
950    <property name="javadoc.src" location="doc/src/javadoc" 
951      description="Location of javadoc source files" />
952    <property name="docbook.src" location="doc/src/docbook" 
953      description="Location of docbook source XML files" />
954    <path id="javadoc.classpath" description="Class path for generating javadoc">
955      <path refid="core.classpath" />
956      <path refid="lib.servlet.classpath" />
957    </path>
958    <property name="docbook.html.out" location="${doc}/html" />
959  </target>
960 
961  <target
962    name="doc.javadoc"
963    depends="doc.init,core.init,coreplugins.init,web.init,jobagent.init"
964    description="Generate JavaDoc of entire API"
965    >
966    <!-- Create the time stamp -->
967    <tstamp>
968      <format property="TODAY" pattern="yyyy-MM-dd"/>
969    </tstamp>
970    <delete dir="${doc}/api" />
971    <sleep milliseconds="1000"/>
972    <mkdir dir="${doc}/api" />
973
974    <javadoc
975      packagenames="net.sf.basedb.*"
976      sourcepath="${core.src}:${coreplugins.src}:${web.src}:${xjspcompiler.src}:${jobagent.src}"
977      destdir="${doc}/api"
978      author="true"
979      version="true"
980      use="false"
981      private="true"
982      windowtitle="BASE ${base.version}${base.versionsuffix} API documentation"
983      stylesheetfile="${javadoc.src}/javadoc.css"
984      classpathref="javadoc.classpath"
985      linksource="false"
986      breakiterator="yes"
987      encoding="${javac.encoding}"
988      overview="${javadoc.src}/overview.html"
989      maxmemory="256M"
990      >
991      <group title="Public API">
992        <package name="net.sf.basedb.info" />
993        <package name="net.sf.basedb.core" />
994        <package name="net.sf.basedb.core.plugin" />
995        <package name="net.sf.basedb.core.query" />
996        <package name="net.sf.basedb.core.signal" />
997        <package name="net.sf.basedb.core.authentication" />
998        <package name="net.sf.basedb.core.snapshot" />
999        <package name="net.sf.basedb.plugins*" />
1000        <package name="net.sf.basedb.util*" />
1001        <package name="net.sf.basedb.clients.web.taglib*" />
1002        <package name="net.sf.basedb.clients.web.extensions*" />
1003      </group>
1004      <group title="Mixed Public and Internal API">
1005        <package name="net.sf.basedb.core.data" />
1006        <package name="net.sf.basedb.clients.web" />
1007        <package name="net.sf.basedb.clients.web.util" />
1008      </group>
1009      <group title="Extension API">
1010        <package name="net.sf.basedb.core.dbengine" />
1011        <package name="net.sf.basedb.core.log*" />
1012        <package name="net.sf.basedb.util.overview.*" />
1013        <package name="net.sf.basedb.util.extensions.manager.*" />
1014        <package name="net.sf.basedb.clients.jobagent" />
1015      </group>
1016      <group title="Internal API">
1017        <package name="net.sf.basedb.core.data.keyring" />
1018        <package name="net.sf.basedb.clients.jobagent.*" />
1019        <package name="net.sf.basedb.clients.web.*" />
1020        <package name="net.sf.basedb.core.hibernate" />
1021      </group>
1022     
1023      <header><![CDATA[${base.version}${base.versionsuffix}: ${TODAY}]]></header>
1024      <link href="http://docs.oracle.com/javase/7/docs/api/"/>
1025      <link href="http://docs.jboss.org/hibernate/core/3.6/javadocs/" />
1026      <link href="http://www.jdom.org/docs/apidocs/" />
1027      <link href="http://tomcat.apache.org/tomcat-7.0-doc/servletapi/" />
1028      <link href="http://tomcat.apache.org/tomcat-7.0-doc/jspapi/" />
1029      <link href="http://tomcat.apache.org/tomcat-7.0-doc/api/" />
1030      <link href="http://www.singularsys.com/jep/doc/javadoc/" />
1031      <link href="http://www.jfree.org/jfreechart/api/gjdoc/" />
1032      <link href="http://logging.apache.org/log4j/1.2/apidocs/" />
1033      <link href="http://download.oracle.com/docs/cd/E17802_01/products/products/java-media/jai/forDevelopers/jai-apidocs/" />
1034      <tag name="base.developer" description="Developer info" />
1035      <tag name="base.internal" description="This class/package is not part of the Public API" scope="overview,packages,types" />
1036      <tag name="base.modified" description="Last modified" />
1037      <tag name="hibernate.class" description="Hibernate: class" scope="types" />
1038      <tag name="hibernate.subclass" description="Hibernate: subclass" scope="types" />
1039      <tag name="hibernate.discriminator" description="Hibernate: discriminator" scope="types" />
1040      <tag name="hibernate.id" description="Hibernate: id" scope="methods" />
1041      <tag name="hibernate.generator-param" description="Hibernate: generator-param" scope="methods" />
1042      <tag name="hibernate.version" description="Hibernate: version" scope="methods" />
1043      <tag name="hibernate.property" description="Hibernate: property" scope="methods" />
1044      <tag name="hibernate.column" description="Hibernate: column" scope="methods" />
1045      <tag name="hibernate.map" description="Hibernate: map" scope="methods" />
1046      <tag name="hibernate.set" description="Hibernate: set" scope="methods" />
1047      <tag name="hibernate.list" description="Hibernate: list" scope="methods" />
1048      <tag name="hibernate.one-to-one" description="Hibernate: one-to-one" scope="methods" />
1049      <tag name="hibernate.many-to-one" description="Hibernate: many-to-one" scope="methods" />
1050      <tag name="hibernate.index-many-to-many" description="Hibernate: index-many-to-many" scope="methods" />
1051      <tag name="hibernate.collection-key" description="Hibernate: collection-key" scope="methods" />
1052      <tag name="hibernate.collection-index" description="Hibernate: collection-index" scope="methods" />
1053      <tag name="hibernate.collection-composite-index" description="Hibernate: collection-composite-index" scope="methods" />
1054      <tag name="hibernate.collection-element" description="Hibernate: collection-element" scope="methods" />
1055      <tag name="hibernate.collection-composite-element" description="Hibernate: collection-composite-element" scope="methods" />
1056      <tag name="hibernate.collection-one-to-many" description="Hibernate: collection-one-to-many" scope="methods" />
1057      <tag name="hibernate.collection-many-to-many" description="Hibernate: collection-many-to-many" scope="methods" />
1058      <tag name="hibernate.bag" description="Hibernate: bag" scope="methods" />
1059      <tag name="hibernate.many-to-any" description="Hibernate: many-to-any" scope="methods" />
1060      <tag name="hibernate.many-to-any-column" description="Hibernate: many-to-any-column" scope="methods" />
1061      <tag name="hibernate.component" description="Hibernate: component" scope="methods" />
1062    </javadoc>
1063  </target>
1064 
1065  <target
1066    name="doc.docbook"
1067    depends="doc.init,doc.docbook.html"
1068    description="Generate docbook user and admin documentation."
1069    >
1070  </target>
1071   
1072  <target 
1073    name="doc.docbook.html"
1074    depends="dev.init,doc.init,xsltprocessor"
1075    >
1076    <mkdir dir="${docbook.html.out}" />
1077    <!--Create subdirectories to store the chunked files in-->
1078    <mkdir dir="${docbook.html.out}/admin"/>
1079    <mkdir dir="${docbook.html.out}/developer"/>
1080    <mkdir dir="${docbook.html.out}/developer/plugins"/>
1081    <mkdir dir="${docbook.html.out}/developer/extensions"/>
1082    <mkdir dir="${docbook.html.out}/developer/api"/>
1083    <mkdir dir="${docbook.html.out}/developer/documentation"/>
1084    <mkdir dir="${docbook.html.out}/user"/>
1085    <mkdir dir="${docbook.html.out}/user/webclient"/>
1086    <mkdir dir="${docbook.html.out}/user/projects"/>
1087    <mkdir dir="${docbook.html.out}/user/files"/>
1088    <mkdir dir="${docbook.html.out}/user/annotations"/>
1089    <mkdir dir="${docbook.html.out}/user/biomaterials"/>
1090    <mkdir dir="${docbook.html.out}/user/experiments"/>
1091    <mkdir dir="${docbook.html.out}/faq" />
1092    <mkdir dir="${docbook.html.out}/appendix" />
1093       
1094    <mkdir dir="${build}/docbook/html" />
1095    <delete description="Delete existing documents">
1096      <fileset dir="${build}/docbook" defaultexcludes="no" />
1097      <fileset dir="${docbook.html.out}" defaultexcludes="no" />
1098    </delete>
1099    <delete file="data/helptexts.xml" />
1100    <ant antfile="${lib}/docbook/ant-build-docbook.xml" inheritall="false" target="html.chunked">
1101      <property name="ant.docbook.styler.dir" location="${lib}/docbook" />
1102      <property name="docbook.xml.dir" location="${docbook.src}" />
1103      <property name="docbook.resources.dir" location="${docbook.src}/figures" />
1104      <property name="distribution.dir" location="${docbook.html.out}" />
1105      <property name="build.dir" location="${build}/docbook/html" />
1106      <property name="base.version" value="${base.version}${base.versionsuffix}"/>
1107      <property name="dateformat" value="yyyy-MM-dd" />
1108    </ant>
1109    <copy todir="${docbook.html.out}">
1110      <fileset dir="${docbook.src}" includes="css/*.*" />
1111      <fileset dir="${docbook.src}" includes="script/*.*" />
1112      <fileset dir="${docbook.src}" includes="examples/*.*" />
1113     </copy>
1114   
1115    <property name="catalog.location" location="${lib}/docbook/preprocess/catalog.xml" />
1116    <path id="ant-extensions">
1117        <fileset dir="${lib}/docbook/ant-extensions" includes="**/*.jar" />
1118        <pathelement path="${lib}/docbook/ant-extensions" />
1119      </path>
1120   
1121    <xmlcatalog id="dtdcatalog">
1122          <catalogpath>
1123              <fileset file="${catalog.location}"/>
1124          </catalogpath>
1125      </xmlcatalog>
1126
1127      <xslt
1128          in      = "${build}/docbook/html/docbook-ready-file.tmp"
1129          style   = "${lib}/docbook/preprocess/webclient_helptext.xsl"
1130          out     = "data/helptexts.xml"
1131          processor = "${xslt.processor}"
1132          >
1133          <xmlcatalog refid="dtdcatalog"/>
1134          <classpath refid="ant-extensions" />
1135
1136          <param name="xsltproc.catalog" expression="${catalog.location}" />
1137          <param name="xsltproc.option.--nonet"  expression="" />
1138      </xslt>
1139  </target>
1140 
1141  <target 
1142    name="doc.dist"
1143    description="Copy documentation to the binary distribution"
1144    >
1145    <mkdir dir="dist/doc" />
1146    <copy todir="dist/doc">
1147      <!--fileset dir="doc" includes="admin/**/*" /-->
1148      <!--fileset dir="doc" includes="development/**/*" /-->
1149      <fileset dir="doc" includes="licenses/**/*" />
1150      <fileset dir="doc" includes="historical/**/*" />
1151      <fileset dir="doc" includes="test/**/*" />
1152      <!--fileset dir="doc" includes="user/**/*" /-->
1153      <fileset dir="doc" includes="*.*" />
1154    </copy>
1155  </target>
1156
1157  <target name="xsltprocessor">
1158      <property environment="env"/>
1159
1160      <condition  property="executable.file.extension"
1161                  value=".exe">
1162              <os family="windows"/>
1163      </condition>
1164      <condition  property="executable.file.extension"
1165                  value="">
1166              <os family="unix"/>
1167      </condition>
1168     
1169      <condition  property="tmp:xsltproc.available"
1170                  value="xsltproc${executable.file.extension}">
1171          <or>
1172              <and>
1173                  <os family="windows"/>
1174                  <available file="xsltproc${executable.file.extension}" filepath="${env.Path}" />
1175              </and>
1176              <and>
1177                  <os family="unix"/>
1178                  <available file="xsltproc${executable.file.extension}" filepath="${env.PATH}" />
1179              </and>
1180          </or>
1181      </condition>
1182     
1183      <condition property="xslt.processor" value="com.dawidweiss.ant.taskdefs.XsltProcLiaison">
1184          <and>
1185              <isset property="tmp:xsltproc.available" />
1186              <not>
1187                  <isset property="disable.xsltproc" />
1188              </not>
1189          </and>
1190      </condition>
1191     
1192      <condition property="xslt.processor" value="com.dawidweiss.ant.taskdefs.SaxonLiaison">
1193          <not>
1194              <isset property="disable.saxon" />
1195          </not>
1196      </condition>
1197
1198      <condition property="xslt.processor" value="trax">
1199          <not>
1200          <and>
1201                  <isset property="tmp:xsltproc.available" />
1202                  <not>
1203                      <isset property="disable.xsltproc" />
1204                  </not>
1205          </and>
1206          </not>
1207      </condition>
1208
1209    </target>
1210 
1211  <!--package targets -->
1212  <target
1213    name="package.bin"
1214    depends="dist"
1215    description="Create binary distribution package"
1216    >
1217    <mkdir dir="${package}" />
1218    <tar
1219      destfile="${package}/base-${base.version}${base.versionsuffix}.tar.gz"
1220      longfile="gnu"
1221      compression="gzip"
1222      >
1223      <tarfileset
1224        dir="${dist}"
1225        mode="755"
1226        prefix="base-${base.version}${base.versionsuffix}"
1227        preserveLeadingSlashes="true"
1228        >
1229        <include name="**/*.sh" />
1230      </tarfileset>
1231      <tarfileset
1232        dir="${dist}"
1233        prefix="base-${base.version}${base.versionsuffix}"
1234        preserveLeadingSlashes="true"
1235        >
1236        <exclude name="**/*.sh" />
1237      </tarfileset>
1238    </tar>
1239    <checksum file="${package}/base-${base.version}${base.versionsuffix}.tar.gz" />
1240  </target>
1241 
1242  <target
1243    name="package.src"
1244    depends="svn.revision"
1245    description="Create source distribution package"
1246    >
1247    <property name="tempdir" location="base-${base.version}${base.versionsuffix}-src" />
1248    <delete dir="${tempdir}" failonerror="false"/>
1249    <svn>
1250      <export srcPath="." destPath="${tempdir}" />
1251    </svn>
1252    <replaceregexp 
1253      file="${tempdir}/build.xml"
1254      match="&lt;svn&gt;.*&lt;status.*?&lt;/svn&gt;"
1255      replace="&lt;property name=&#34;base.build&#34; value=&#34;${base.build}&#34; /&gt;"
1256      flags="s"
1257    />
1258    <replace file="${tempdir}/build.xml"
1259      description="Remove references to package.src">
1260      <replacefilter 
1261        token="package.bin,package.src"
1262        value="package.bin"
1263      />
1264    </replace>
1265    <replaceregexp 
1266      file="${tempdir}/build.xml"
1267      match="&lt;target\s*?name=&#34;package.src&#34;.*?&lt;/target&gt;"
1268      replace=""
1269      flags="s"
1270      description="Remove package.src target"
1271    />
1272    <mkdir dir="${package}" />
1273      <tar
1274      destfile="${package}/base-${base.version}${base.versionsuffix}-src.tar.gz"
1275      longfile="gnu"
1276      compression="gzip"
1277      >
1278      <tarfileset
1279        dir="${tempdir}"
1280        mode="755"
1281        prefix="base-${base.version}${base.versionsuffix}-src"
1282        preserveLeadingSlashes="true"
1283        >
1284        <include name="**/*.sh" />
1285      </tarfileset>
1286      <tarfileset
1287        dir="${tempdir}"
1288        prefix="base-${base.version}${base.versionsuffix}-src"
1289        preserveLeadingSlashes="true"
1290        >
1291        <exclude name="**/*.sh" />
1292      </tarfileset>
1293    </tar>
1294    <checksum file="${package}/base-${base.version}${base.versionsuffix}-src.tar.gz"/>
1295    <delete dir="${tempdir}" />
1296  </target>
1297   
1298  <target 
1299    name="svn.update"
1300    description="Issues an 'svn update' command to check out the latest revision from subversion"
1301    >
1302    <svn>
1303      <update dir="." />
1304    </svn>
1305  </target>
1306 
1307  <target
1308    name="svn.diff"
1309    depends="svn.revision"
1310    description="Issues an 'svn diff' command to generate a patch with local changes"
1311    >
1312    <echo>NOTE! New files must be added to svn with 'svn add' or they will not be added to the patch.</echo>
1313    <property name="patchfile" value="patch-${base.build}.diff" />
1314    <pathconvert property="patchdir" dirsep="/" >
1315      <path location="." />
1316    </pathconvert>
1317    <svn>
1318      <diff oldpath="." outfile="${patchfile}"/>
1319    </svn>
1320    <replaceregexp file="${patchfile}" match="${patchdir}/" replace="" flags="g" />
1321    <echo>Generated patch file: ${patchfile}</echo>
1322  </target>
1323   
1324</project>
Note: See TracBrowser for help on using the repository browser.