source: trunk/build.xml @ 7

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

It is now possible to compile with ant

File size: 18.1 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project
3  name="BASE2"
4  default="core"
5  basedir="."
6  >
7
8  <description>
9    Build file for BASE 2.0
10    Main targets:
11    core (default): build the core
12    nohibernate: build the core, but do not regenerate the Hibernate mappings
13    test: build the test programs
14    web: build the web client
15    migrate: build the migration client
16    javadoc: generate documentation
17    package: create binary distribution
18    all: core, clients, docs
19    clean: clean up everything
20  </description>
21
22  <!-- set global properties for this build -->
23  <property name="base.version" value="2.0-alpha1" />
24  <property name="src" location="src" />
25  <property name="build" location="build" />
26  <property name="dist" location="dist" />
27  <property name="dist.lib" location="${dist}/www/WEB-INF/lib" />
28  <property name="dist.classes" location="${dist}/www/WEB-INF/classes" />
29  <property name="dist.bin" location="${dist}/bin" />
30  <property name="doc" location="doc" />
31  <property name="lib" location="lib" />
32  <property name="www" location="www" />
33
34  <property name="core.src" location="${src}/core" />
35  <property name="test.src" location="${src}/test" />
36  <property name="web.src" location="${src}/clients/web" />
37  <property name="migrate.src" location="${src}/clients/migrate" />
38  <property name="install.src" location="${src}/install" />
39
40  <property name="core.build" location="${build}/core" />
41  <property name="test.build" location="${build}/test" />
42  <property name="migrate.build" location="${build}/clients/migrate" />
43  <property name="install.build" location="${build}/install" />
44  <property name="web.build" location="${build}/clients/web" />
45  <property name="web.inf" location="${www}/WEB-INF" />
46
47  <property name="doc.develop" location="${doc}/api/develop" />
48  <property name="doc.public" location="${doc}/api/public" />
49
50  <path id="core.compile.classpath">
51    <fileset dir="${lib}/compile">
52      <include name="**/*.jar"/>
53    </fileset>
54  </path>
55
56  <path id="test.compile.classpath">
57    <path refid="core.compile.classpath"/>
58    <pathelement location="${core.build}"/>
59  </path>
60
61  <path id="migrate.compile.classpath">
62    <path refid="core.compile.classpath" />
63    <pathelement location="${core.build}" />
64  </path>
65 
66  <path id="install.compile.classpath">
67    <path refid="core.compile.classpath" />
68    <pathelement location="${core.build}" />
69  </path>
70 
71  <path id="web.compile.classpath">
72    <path refid="core.compile.classpath"/>
73    <pathelement location="${core.build}"/>
74  </path>
75
76  <path id="hibernatedoclet.classpath">
77    <fileset dir="${lib}/hibernatedoclet">
78      <include name="**/*.jar"/>
79    </fileset>
80  </path>
81
82  <taskdef
83    name="hibernatedoclet"
84    classname="xdoclet.modules.hibernate.HibernateDocletTask"
85    classpathref="hibernatedoclet.classpath"
86    description="Task for generating Hibernate mapping files from XDoclet tags"
87  />
88
89  <target
90    name="all"
91    depends="core, test, web, javadoc"
92    description="Compile/create everything"
93  />
94
95  <target
96    name="core"
97    depends="core.compile,core.hibernate"
98    description="Compile the core, generate Hibernate mappings and put everyting in a JAR file"
99  />
100
101  <target
102    name="nohibernate"
103    depends="core.compile"
104    description="Compile the core, assuming Hibernate mappings already exists
105      and put everyting in a JAR file"
106  />
107
108  <target
109    name="core.hibernate"
110    depends="core.compile"
111    description="Generates Hibernate mappings for the core."
112    >
113    <hibernatedoclet
114      destdir="${core.build}"
115      excludedtags="@version,@author,@todo"
116      mergedir="${core.build}"
117      verbose="${xdoclet.verbose}">
118      <fileset dir="${core.src}">
119        <include name="**/*.java"/>
120      </fileset>
121      <hibernate version="2.0"/>
122    </hibernatedoclet>
123  </target>
124
125  <target
126    name="core.compile"
127    depends=""
128    description="compile the core source code"
129    >
130    <mkdir dir="${core.build}"/>
131    <javac
132      encoding="ISO-8859-1"
133      srcdir="${core.src}"
134      destdir="${core.build}"
135      classpathref="core.compile.classpath"
136      debug="true"
137      deprecation="true"
138    />
139    <copy todir="${core.build}">
140      <fileset dir="${core.src}">
141        <include name="**/*.xml" />
142        <include name="**/*.dtd" />
143        <include name="**/*.config" />
144        <include name="**/*.properties" />
145      </fileset>
146    </copy>
147  </target>
148
149  <target
150    name="test"
151    depends="test.compile"
152    description="Compile the test programs"
153  />
154
155  <target name="test.compile"
156    depends=""
157    description="compile the source code for the test programs"
158    >
159    <mkdir dir="${test.build}"/>
160    <javac
161      srcdir="${test.src}"
162      destdir="${test.build}"
163      classpathref="test.compile.classpath"
164      debug="true"
165      deprecation="true"
166      encoding="ISO-8859-1"
167    />
168    <copy todir="${test.build}">
169      <fileset dir="${test.src}">
170        <include name="*.*" />
171        <exclude name="*.java" />
172      </fileset>
173    </copy>
174    <chmod file="${test.build}/run.sh" perm="a+x"/>
175    <copy todir="${test.build}">
176      <fileset dir="${src}">
177        <include name="*.config" />
178        <include name="*.properties" />
179        <include name="*.xml" />
180      </fileset>
181    </copy>
182  </target>
183
184  <target
185    name="migrate"
186    depends="dist.migrate"
187    description="create the Migrate.jar"
188  >
189  </target>
190 
191  <target name="dist.migrate" depends="migrate.compile,dist.init" description="">
192    <jar basedir="${migrate.build}" jarfile="${dist.bin}/Migrate.jar" includes="**/*.class">
193    </jar>
194    <copy todir="${dist.bin}" file="${migrate.src}/migrate_from_1.2.sh" />
195    <chmod file="${dist.bin}/migrate_from_1.2.sh" perm="a+x"/>
196    <copy tofile="${dist.classes}/migrate.properties" file="${migrate.src}/migrate.properties.in" />
197    <chmod file="${dist.classes}/migrate.properties" perm="600"/>
198
199  </target>
200
201  <target name="migrate.properties" if="migrate.newproperties">
202    <copy tofile="${migrate.build}/migrate.properties" file="${migrate.src}/migrate.properties.in" />
203    <chmod file="${migrate.build}/migrate.properties" perm="600"/>
204  </target>
205
206  <target name="migrate.compile" description="compile the source code for the migration program">
207    <mkdir dir="${migrate.build}" />
208    <javac
209      encoding="ISO-8859-1"
210      srcdir="${migrate.src}"
211      destdir="${migrate.build}"
212      classpathref="migrate.compile.classpath"
213      debug="true"
214    />
215    <copy todir="${migrate.build}">
216      <fileset dir="${src}">
217        <include name="*.config" />
218        <include name="*.properties" />
219        <include name="*.xml" />
220      </fileset>
221    </copy>
222    <copy todir="${migrate.build}" file="${migrate.src}/migrate_from_1.2.sh" />
223    <chmod file="${migrate.build}/migrate_from_1.2.sh" perm="a+x"/>
224    <condition property="migrate.newproperties">
225      <not>
226        <available file="${migrate.build}/migrate.properties"/>
227      </not>
228    </condition>
229    <antcall target="migrate.properties"/>
230  </target>
231 
232  <target
233    name="install"
234    depends="install.compile"
235    description="Compile the installation program"
236  >
237  </target>
238
239  <target name="install.compile"
240    description="compile the source code for the installation program"
241    >
242    <mkdir dir="${install.build}" />
243    <javac
244      encoding="ISO-8859-1"
245      srcdir="${install.src}"
246      destdir="${install.build}"
247      classpathref="install.compile.classpath"
248      debug="true"
249    />
250  </target>
251
252  <target
253    name="web"
254    depends="web.compile"
255    description="Compile the web client, and copy required files to the web-inf directory"
256  >
257    <mkdir dir="${web.inf}/lib"/>
258    <mkdir dir="${web.inf}/classes"/>
259    <jar
260      basedir="${core.build}"
261      jarfile="${web.inf}/lib/BASE2Core.jar"
262    />
263    <jar
264      basedir="${web.build}"
265      jarfile="${web.inf}/lib/BASE2Webclient.jar"
266    />
267    <copy todir="${web.inf}/lib">
268      <fileset dir="${lib}/compile">
269        <include name="**/*.jar"/>
270      </fileset>
271      <fileset dir="${lib}/dist">
272        <include name="**/*.jar"/>
273      </fileset>
274    </copy>
275    <copy todir="${web.inf}/classes">
276      <fileset dir="${src}">
277        <include name="*.config"/>
278        <include name="*.properties"/>
279        <include name="*.xml"/>
280      </fileset>
281    </copy>
282  </target>
283
284  <target
285    name="web.compile"
286    depends=""
287    description="compile the source code for the web client"
288    >
289    <mkdir dir="${web.build}"/>
290    <javac
291      encoding="ISO-8859-1"
292      srcdir="${web.src}"
293      destdir="${web.build}"
294      classpathref="web.compile.classpath"
295      debug="true"
296    />
297  </target>
298
299  <target
300    name="dist"
301    depends="dist.init,dist.core,dist.install,dist.web,dist.doc,dist.migrate"
302    description="Create the distribution and put all files in their correct places">
303    <copy todir="${dist.lib}">
304      <fileset dir="${lib}/compile">
305        <include name="**/*.jar"/>
306        <exclude name="**/jai*.jar" />
307        <exclude name="**/servlet.jar" />
308      </fileset>
309      <fileset dir="${lib}/dist">
310        <include name="**/*.jar"/>
311      </fileset>
312    </copy>
313    <copy tofile="${dist.classes}/base.config" file="${src}/base.config.in" />
314    <chmod file="${dist.classes}/base.config" perm="600"/>
315    <copy todir="${dist.classes}" file="${src}/hibernate.properties" />
316    <copy todir="${dist.classes}" file="${src}/log4j.properties" />
317    <copy todir="${dist.classes}" file="${src}/extended-properties.xml" />
318    <copy todir="${dist.classes}" file="${src}/raw-data-types.xml" />
319    <copy todir="${dist.classes}" file="${src}/mysql-queries.xml" />
320    <copy todir="${dist.classes}" file="${src}/sqlserver-queries.xml" />
321  </target>
322
323  <target
324    name="dist.init"
325    description="Create the distribution directory structure"
326    >
327    <mkdir dir="${dist}"/>
328    <mkdir dir="${dist.bin}"/>
329    <mkdir dir="${dist}/doc"/>
330    <mkdir dir="${dist}/www"/>
331    <mkdir dir="${dist.lib}"/>
332  </target>
333
334  <target
335    name="dist.core"
336    depends="core.compile,core.hibernate"
337    description="Generate the core jar file: BASE2Core.jar"
338    >
339    <jar
340      basedir="${core.build}"
341      jarfile="${dist.lib}/BASE2Core.jar"
342    />
343  </target>
344  <target
345    name="dist.install"
346    depends="install.compile"
347    description="Generate the installation jar file: BASE2Install.jar"
348    >
349    <jar
350      basedir="${install.build}"
351      jarfile="${dist.bin}/BASE2Install.jar"
352    />
353    <copy todir="${dist.bin}" file="${install.src}/initdb.sh" />
354    <chmod file="${dist.bin}/initdb.sh" perm="a+x"/>
355  </target>
356  <target
357    name="dist.web"
358    depends="web"
359    description="Generate the web jar file: BASE2Webclient.jar
360      and copy all *.jsp files"
361    >
362    <jar
363      basedir="${web.build}"
364      jarfile="${dist.lib}/BASE2Webclient.jar"
365    />
366    <copy
367      todir="${dist}/www"
368      >
369      <fileset dir="${www}">
370        <include name="**/*"/>
371        <exclude name="CVS" />
372        <exclude name="**/*.jar" />
373      </fileset>
374    </copy>
375  </target>
376
377  <target
378    name="dist.doc"
379    depends=""
380    description="Copy required documentation"
381    >
382    <copy todir="${dist}" file="${doc}/installation.txt" />
383    <copy todir="${dist}" file="base2.license.txt" />
384    <copy todir="${dist}/doc" file="${doc}/3rd-party-components.txt" />
385    <copy todir="${dist}/doc" file="${doc}/Hibernate_modifications.txt" />
386    <copy todir="${dist}/doc/licenses">
387      <fileset dir="${doc}/licenses" />
388    </copy>
389  </target>
390
391  <target
392    name="package"
393    depends="dist"
394    description="Package the distribution"
395    >
396    <tar
397      destfile="base-${base.version}.tar.gz"
398      compression="gzip"
399      >
400      <tarfileset
401        dir="${dist}"
402        prefix="base-${base.version}"
403        preserveLeadingSlashes="true"
404      />
405    </tar>
406    <checksum
407      file="base-${base.version}.tar.gz"
408    />
409  </target>
410
411  <target
412    name="clean"
413    description="Remove all generated files and backup files" >
414    <delete dir="${build}"/>
415    <delete dir="${dist}"/>
416    <delete dir="${web.inf}/lib"/>
417    <delete dir="${web.inf}/classes"/>
418    <delete>
419      <fileset dir="." includes="**/*~" defaultexcludes="no"/>
420      <fileset dir="." includes="**/.#*" defaultexcludes="no"/>
421    </delete>
422  </target>
423
424  <target name="uml"
425    description="generate uml for core package using UmlGraph" >
426    <javadoc
427      packagenames="net.sf.basedb.*"
428      sourcepath="${core.src}"
429      >
430      <doclet name="UmlGraph" path="${lib}/umldoclet/UmlGraph.jar">
431        <param name="-hide" value="java.lang.Exception"/>
432      </doclet>
433    </javadoc>
434    <apply executable="dot">
435      <arg value="-Tps"/>
436      <arg value="-o${doc}/core.ps"/>
437      <fileset file="graph.dot"/>
438    </apply>
439  </target>
440
441  <target
442    name="javadoc"
443    depends="javadoc.develop"
444  />
445
446  <target
447    name="javadoc.develop"
448    description="generate JavaDoc for developers of BASE, ie. include private and protecteed methods.">
449    <!-- Create the time stamp -->
450    <tstamp>
451      <format property="TODAY" pattern="yyyy-MM-dd"/>
452    </tstamp>
453    <mkdir dir="${doc}"/>
454
455    <javadoc
456      packagenames="net.sf.basedb.*"
457      sourcepath="${core.src}:${web.src}"
458      destdir="${doc.develop}"
459      author="true"
460      version="true"
461      use="true"
462      private="true"
463      windowtitle="BASE 2.0 Class documentation (developer edition)"
464      stylesheetfile="${doc}/styles.css"
465      classpathref="core.compile.classpath"
466      linksource="yes"
467      breakiterator="yes"
468      encoding="iso-8859-1"
469      >
470      <header><![CDATA[Last update: ${TODAY}]]></header>
471      <link href="http://java.sun.com/j2se/1.4/docs/api"/>
472      <link href="http://www.thep.lu.se/~nicklas/bioinfo"/>
473      <tag name="base.internal" description="Developer info" />
474      <tag name="hibernate.class" description="Hibernate: class" scope="types" />
475      <tag name="hibernate.subclass" description="Hibernate: subclass" scope="types" />
476      <tag name="hibernate.discriminator" description="Hibernate: discriminator" scope="types" />
477      <tag name="hibernate.id" description="Hibernate: id" scope="methods" />
478      <tag name="hibernate.generator-param" description="Hibernate: generator-param" scope="methods" />
479      <tag name="hibernate.version" description="Hibernate: version" scope="methods" />
480      <tag name="hibernate.property" description="Hibernate: property" scope="methods" />
481      <tag name="hibernate.key-property" description="Hibernate: key-property" scope="methods" />
482      <tag name="hibernate.column" description="Hibernate: column" scope="methods" />
483      <tag name="hibernate.map" description="Hibernate: map" scope="methods" />
484      <tag name="hibernate.set" description="Hibernate: set" scope="methods" />
485      <tag name="hibernate.list" description="Hibernate: list" scope="methods" />
486      <tag name="hibernate.array" description="Hibernate: array" scope="methods" />
487      <tag name="hibernate.one-to-one" description="Hibernate: one-to-one" scope="methods" />
488      <tag name="hibernate.many-to-one" description="Hibernate: many-to-one" scope="methods" />
489      <tag name="hibernate.many-to-many" description="Hibernate: many-to-many" scope="methods" />
490      <tag name="hibernate.index-many-to-many" description="Hibernate: index-many-to-many" scope="methods" />
491      <tag name="hibernate.collection-key" description="Hibernate: collection-key" scope="methods" />
492      <tag name="hibernate.collection-index" description="Hibernate: collection-index" scope="methods" />
493      <tag name="hibernate.collection-composite-index" description="Hibernate: collection-composite-index" scope="methods" />
494      <tag name="hibernate.collection-element" description="Hibernate: collection-element" scope="methods" />
495      <tag name="hibernate.collection-composite-element" description="Hibernate: collection-composite-element" scope="methods" />
496      <tag name="hibernate.collection-one-to-many" description="Hibernate: collection-one-to-many" scope="methods" />
497      <tag name="hibernate.collection-many-to-many" description="Hibernate: collection-many-to-many" scope="methods" />
498    </javadoc>
499  </target>
500
501  <target
502    name="javadoc.public"
503    description="generate public JavaDoc, ie. without private and protected methods">
504    <javadoc
505      packagenames="net.sf.basedb.*"
506      sourcepath="${src}"
507      destdir="${doc.public}"
508      author="true"
509      version="true"
510      protected="true"
511      windowtitle="BASE 2.0 Class documentation"
512      stylesheetfile="${doc}/styles.css"
513      classpathref="core.compile.classpath"
514      breakiterator="yes"
515      encoding="iso-8859-1"
516      >
517      <header><![CDATA[Last update: ${TODAY}]]></header>
518      <link href="http://java.sun.com/j2se/1.4/docs/api"/>
519      <link href="http://www.thep.lu.se/~nicklas/bioinfo"/>
520      <tag name="base.internal" description="Developer info" />
521      <tag name="hibernate.class" description="Hibernate: class" scope="types" enabled="false" />
522      <tag name="hibernate.subclass" description="Hibernate: subclass" scope="types" enabled="false" />
523      <tag name="hibernate.discriminator" description="Hibernate: discriminator" scope="types" enabled="false" />
524      <tag name="hibernate.id" description="Hibernate: id" scope="methods" enabled="false" />
525      <tag name="hibernate.generator-param" description="Hibernate: generator-param" scope="methods" enabled="false" />
526      <tag name="hibernate.version" description="Hibernate: version" scope="methods" enabled="false" />
527      <tag name="hibernate.property" description="Hibernate: property" scope="methods" enabled="false" />
528      <tag name="hibernate.key-property" description="Hibernate: key-property" scope="methods" enabled="false" />
529      <tag name="hibernate.column" description="Hibernate: column" scope="methods" />
530      <tag name="hibernate.map" description="Hibernate: map" scope="methods" enabled="false" />
531      <tag name="hibernate.set" description="Hibernate: set" scope="methods" enabled="false" />
532      <tag name="hibernate.list" description="Hibernate: list" scope="methods" enabled="false" />
533      <tag name="hibernate.array" description="Hibernate: array" scope="methods" enabled="false" />
534      <tag name="hibernate.one-to-one" description="Hibernate: one-to-one" scope="methods" enabled="false" />
535      <tag name="hibernate.many-to-one" description="Hibernate: many-to-one" scope="methods" enabled="false" />
536      <tag name="hibernate.many-to-many" description="Hibernate: many-to-many" scope="methods" enabled="false" />
537      <tag name="hibernate.index-many-to-many" description="Hibernate: index-many-to-many" scope="methods" enabled="false" />
538      <tag name="hibernate.collection-key" description="Hibernate: collection-key" scope="methods" enabled="false" />
539      <tag name="hibernate.collection-index" description="Hibernate: collection-index" scope="methods" enabled="false" />
540      <tag name="hibernate.collection-composite-index" description="Hibernate: collection-composite-index" scope="methods" enabled="false" />
541      <tag name="hibernate.collection-element" description="Hibernate: collection-element" scope="methods" enabled="false" />
542      <tag name="hibernate.collection-composite-element" description="Hibernate: collection-composite-element" scope="methods" enabled="false" />
543      <tag name="hibernate.collection-one-to-many" description="Hibernate: collection-one-to-many" scope="methods" enabled="false" />
544      <tag name="hibernate.collection-many-to-many" description="Hibernate: collection-many-to-many" scope="methods" enabled="false" />
545    </javadoc>
546  </target>
547
548
549</project>
Note: See TracBrowser for help on using the repository browser.