source: branches/3.6-stable/build.xml @ 6978

Last change on this file since 6978 was 6978, checked in by Nicklas Nordborg, 6 years ago

Preparing release 3.6

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