File: build.xml

package info (click to toggle)
bytecode 0.92.cvs.20070925
  • links: PTS, VCS
  • area: contrib
  • in suites: lenny
  • size: 392 kB
  • ctags: 1,026
  • sloc: java: 3,751; xml: 233; makefile: 37
file content (355 lines) | stat: -rwxr-xr-x 12,204 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
<?xml version="1.0"?>

<!--


  Ant build file for the entire biojava tree

  see:
  <a href="http://jakarta.apache.org/ant">Ant Project Homepage</a>
  <a href="http://home.wxs.nl/~ajkuiper/ant.html">Ant User Manual</a>
  <a href="http://jakarta.apache.org/builds/tomcat/nightly/ant.zip">Download</a>

  targets:

    compile
    compile-tests compiles JUnit tests
    compile-demos compiles the demo files
    package       builds the biojava.jar file (default)
    package-demos builds the demos.jar file
    runtests      runs JUnit tests
    javadocs
    dist
    dist-zip     'binary' release (jar & documentation) in zip format
    dist-tgz     'binary' release (jar & documentation) in tar.gz format
    dist-both    both dist-zip & dist-tgz
    clean        cleans up the build & dist directories

  author:  Matthew Pocock - "modified from biojava-live/build.xml"
  version: $Id: build.xml,v 1.2 2003/07/07 15:55:08 mrp Exp $

  portions Copyright (c) 1999-2000 The Apache Software Foundation.

-->

<project default="package" basedir=".">

  <target name="init">
    <tstamp />
    <property name="name" value="bytecode" />
    <property name="version" value="0.1" />

    <property name="build.compiler" value="modern" />

    <!-- We are bootstrapping some of the biojava exception handeling code -->
    <property name="classpath" value="biojava.jar" />

    <!-- Save the current system classpath to pass to forked VMs -->
    <property name="env.classpath" value="${java.class.path}" />

    <!-- Check the current system classpath for JUnit -->
    <available classpath="${env.classpath}"
               classname="junit.framework.TestCase"
               property="junit.present" />

    <!-- Check the current system classpath for JUnit support in Ant (only in >= 1.3) -->
    <available classpath="${env.classpath}"
               classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTest"
               property="junit.support" />

    <available classpath="${env.classpath}"
               classname="java.nio.Buffer"
               property="java14">
    </available>

    <property name="readme" value="./README" />
    <property name="license" value="./LICENSE" />
    <property name="src.dir" value="./src" />
    <property name="tests.dir" value="./tests" />
    <property name="demos.dir" value="./demos" />
    <property name="reports.dir" value="./reports" />
    <property name="manifest.dir" value="./manifest" />
    <property name="manifest.file" value="defaultmanifest.txt" />
    <property name="resources.dir" value="./resources" />

    <property name="packages" value="org.*" />

    <property name="build.dir" value="./ant-build" />
    <!-- Subdirectories for main source and classes -->
    <property name="build.src.main" value="./ant-build/src/main" />
    <property name="build.dest.main" value="./ant-build/classes/main" />
    <!-- Subdirectories for tests source and classes -->
    <property name="build.src.tests" value="./ant-build/src/tests" />
    <property name="build.dest.tests" value="./ant-build/classes/tests" />
    <property name="build.src.demos" value="./ant-build/src/demos" />
    <property name="build.dest.demos" value="./ant-build/classes/demos" />
    <!-- Subdirectory for Javadocs -->
    <property name="build.javadocs" value="./ant-build/docs" />
    <!-- Subdirectory for test reports -->
    <property name="reports.tests" value="./reports/tests" />

    <property name="dist.root" value="./dist" />
    <property name="dist.dir" value="${dist.root}/${name}-${version}" />
  </target>

  <!-- Prepares the build directory -->
  <target name="prepare" depends="init">
    <mkdir dir="${build.dir}" />
  </target>

  <!-- Prepares the source code -->
  <target name="prepare-core" depends="init,prepare">

    <!-- Creates directories -->
    <mkdir dir="${build.src.main}" />
    <mkdir dir="${build.dest.main}" />
    <mkdir dir="${build.src.tests}" />
    <mkdir dir="${build.dest.tests}" />
    <mkdir dir="${reports.tests}" />
    <mkdir dir="${build.src.demos}" />
    <mkdir dir="${build.dest.demos}" />

    <!-- Copies src files -->
    <!-- copydir src="${src.dir}" dest="${build.src}" excludes="CVS,cvs"/ -->
    <copy todir="${build.src.main}">
      <fileset dir="${src.dir}">
        <exclude name="**/CVS/**" />
      </fileset>
    </copy>

    <!-- Copies test src files -->
    <copy todir="${build.src.tests}">
      <fileset dir="${tests.dir}">
        <exclude name="**/CVS/**" />
      </fileset>
    </copy>

    <!-- Copies demos files -->
    <copy todir="${build.src.demos}">
      <fileset dir="${demos.dir}">
        <exclude name="**/CVS/**" />
      </fileset>
    </copy>

    <!-- Copies manifest -->
    <!-- copydir src="${manifest.dir}" dest="${build.src}" includes="${manifest.file}"/ -->
    <copy todir="${build.src.main}">
      <fileset dir="${manifest.dir}">
        <include name="${manifest.file}" />
      </fileset>
    </copy>

    <!-- Copies demo manifest -->
    <copy todir="${build.src.demos}">
      <fileset dir="${manifest.dir}">
        <include name="${demosmanifest.file}" />
      </fileset>
    </copy>
    
    <!-- Copies resources -->
    <!-- copydir src="${resources.dir}" dest="${build.src}" excludes="CVS,cvs"/ -->
    <copy todir="${build.dest.main}">
      <fileset dir="${resources.dir}">
        <exclude name="**/CVS/**" />
      </fileset>
    </copy>
  </target>

  <target name="prepare-src" depends="init,prepare-core" />

  <!-- Compiles the source directory -->
  <target name="compile" depends="init,prepare-src">
    <javac
      srcdir="${build.src.main}"
      destdir="${build.dest.main}"
      classpath="${classpath}"
      deprecation="false"
      depend="no"
      debug="true"
    />
  </target>

  <!-- Compiles the tests directory -->
  <target name="compile-tests" depends="init,prepare-src,compile">
    <javac
      srcdir="${build.src.tests}"
      destdir="${build.dest.tests}"
      deprecation="true"
      depend="yes">
      <classpath>
        <pathelement path="${classpath}" />
        <pathelement path="${build.dest.main}" />
      </classpath>
    </javac>
  </target>

  <!-- Compiles the demos directory -->
  <target name="compile-demos" depends="init,prepare-src,compile">
    <javac
      srcdir="${build.src.demos}"
      destdir="${build.dest.demos}"
      deprecation="true"
      depend="yes">
      <classpath>
        <pathelement path="${classpath}" />
        <pathelement path="${build.dest.main}" />
      </classpath>
    </javac>
  </target>

  <!-- Creates the class package (tests are left in the parallel tree) -->
  <target name="package" depends="init,compile">
    <jar
      jarfile="${build.dir}/${name}.jar"
      basedir="${build.dest.main}"
      manifest="${build.src.main}/${manifest.file}"
      includes="**"
    />
  </target>
  
  <!-- Create the demo package -->
  <target name="package-demos" depends="init,package,compile-demos">
    <jar
      jarfile="${build.dir}/demo.jar"
      basedir="${build.dest.demos}"
      manifest="${build.src.demos}/${demosmanifest.file}"
      includes="**"
    />
  </target>

  <!-- Runs tests if the Ant optional JUnit support is available -->
  <target name="runtests" depends="init,compile-tests" >
    <echo message="JUnit present: ${junit.present}"/>
    <junit printsummary="yes" haltonfailure="no" dir="${build.dest.tests}">
      <formatter type="plain" usefile="true" />
      <classpath>
        <!-- main classes from build -->
        <pathelement path="${build.dest.main}" />
        <!-- test classes from build -->
        <pathelement path="${build.dest.tests}" />
        <!-- test data from build -->
        <pathelement path="${build.src.tests}" />
        <!-- classes specified in this file -->
        <pathelement path="${classpath}" />
        <!-- classes specified in system classpath -->
        <pathelement path="${env.classpath}" />
      </classpath>
      <!-- The junit task doesn't support 'if' so we test for JUnit here -->
      <batchtest fork="yes" todir="${reports.tests}" if="junit.present">
        <fileset dir="${build.dest.tests}">
          <include name="**/*Test*" />
        </fileset>
      </batchtest>
    </junit>
  </target>

  <target name="seqtests" depends="init,compile-tests" if="junit.support">
    <junit printsummary="yes" haltonfailure="no" dir="${build.dest.tests}">
      <formatter type="plain" usefile="true" />
      <classpath>
        <!-- main classes from build -->
        <pathelement path="${build.dest.main}" />
        <!-- test classes from build -->
        <pathelement path="${build.dest.tests}" />
        <!-- test data from build -->
        <pathelement path="${build.src.tests}" />
        <!-- classes specified in this file -->
        <pathelement path="${classpath}" />
        <!-- classes specified in system classpath -->
        <pathelement path="${env.classpath}" />
      </classpath>
      <!-- The junit task doesn't support 'if' so we test for JUnit here -->
      <batchtest fork="yes" todir="${reports.tests}" if="junit.present">
        <fileset dir="${build.dest.tests}">
          <include name="org/biojava/bio/seq/*Test*" />
        </fileset>
      </batchtest>
    </junit>
  </target>
  
  <target name="symboltests" depends="init,compile-tests" if="junit.support">
    <junit printsummary="yes" haltonfailure="no" dir="${build.dest.tests}">
      <formatter type="plain" usefile="true" />
      <classpath>
        <!-- main classes from build -->
        <pathelement path="${build.dest.main}" />
        <!-- test classes from build -->
        <pathelement path="${build.dest.tests}" />
        <!-- test data from build -->
        <pathelement path="${build.src.tests}" />
        <!-- classes specified in this file -->
        <pathelement path="${classpath}" />
        <!-- classes specified in system classpath -->
        <pathelement path="${env.classpath}" />
      </classpath>
      <!-- The junit task doesn't support 'if' so we test for JUnit here -->
      <batchtest fork="yes" todir="${reports.tests}" if="junit.present">
        <fileset dir="${build.dest.tests}">
          <include name="org/biojava/bio/symbol/*Test*" />
        </fileset>
      </batchtest>
    </junit>
  </target>

  <!-- Creates the API documentation -->
  <target name="javadocs" depends="init,prepare-src">
    <mkdir dir="${build.javadocs}" />
    <javadoc
      packagenames="${packages}"
      sourcepath="${build.src.main}"
      classpath="${classpath}"
      destdir="${build.javadocs}"
      author="true"
      version="true"
      use="true"
      windowtitle="${name} API"
      doctitle="${name}"
      link="http://java.sun.com/j2se/1.4.2/docs/api/"
      maxmemory="96m">
    </javadoc>
  </target>

  <!-- Creates the distribution -->
  <target name="dist" depends="init,package,runtests,javadocs">
    <mkdir dir="${dist.root}" />
    <mkdir dir="${dist.dir}" />
    <mkdir dir="${dist.dir}/lib" />
    <mkdir dir="${dist.dir}/docs" />

    <copyfile src="${readme}" dest="${dist.dir}" />
    <copyfile src="${license}" dest="${dist.dir}" />

    <copyfile src="${build.dir}/${name}.jar" dest="${dist.dir}/lib/${name}.jar" />
    <copydir src="${build.javadocs}" dest="${dist.dir}/docs" />
  </target>

  <!-- zips the dist -->
  <target name="dist-zip" depends="init,dist">
    <zip zipfile="${name}-${version}.zip" basedir="${dist.dir}" includes="**" />
  </target>

  <!-- tgzs the dist -->
  <target name="dist-tgz" depends="init,dist">
    <tar tarfile="${name}-${version}.tar" basedir="${dist.root}" includes="**" />
    <gzip zipfile="${name}-${version}.tar.gz" src="${name}-${version}.tar" />
  </target>

  <!-- zip & tgz -->
  <target name="dist-both" depends="init,dist-zip,dist-tgz" />

  <!-- Cleans everything -->
  <target name="clean" depends="init">
    <delete dir="${build.dir}" />
    <delete dir="${dist.root}" />
    <delete file="${name}-${version}.tar.gz" />
    <delete file="${name}-${version}.tar" />
    <delete file="${name}-${version}.zip" />
  </target>

  <target name="sync">
    <cvs command="update" />
    <AntCall target="package"/>
    <cvs command="commit" />
  </target>

</project>