source: trunk/build.xml @ 5741

Last change on this file since 5741 was 5741, checked in by Nicklas Nordborg, 12 years ago

Preparing release 3.0-alfa

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