-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
496 lines (455 loc) · 19.4 KB
/
build.xml
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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
<project name="weka" default="compile" basedir=".">
<!--
===========================================================================
Ant build file for weka. Tested with ant 1.6.5 and Junit 3.8.2. Requires
JavaMail and the java activation framework for mailing unit test results.
Type ant -projecthelp for targets and descriptions.
Assumes weka and tests (if unit testing) are in the same directory.
Build file can reside and be executed from either inside weka or the
directory containing weka.
$Revision: 9466 $
===========================================================================
-->
<!-- set global properties for this build -->
<property name="src" value="src/main/java"/>
<property name="src-test" value="src/test/java"/>
<property name="lib" value="lib" />
<property name="regression_tests_root" value="src/test/resources/wekarefs"/>
<property name="build" value="build"/>
<property name="dist" value="dist"/>
<property name="doc" value="doc"/>
<property name="reports" value="reports"/>
<property name="javac_max_memory" value="256m"/>
<property name="run_tests_fail" value="true"/>
<property name="headless" value="false"/>
<property name="macdistrib" value="osx-distrib"/>
<property name="debug" value="on" />
<target name="init_all">
<!-- Create the time stamp -->
<tstamp/>
</target>
<!-- general classpath definition, incl. CLASSPATH env. variable,
// but jars in lib directory have precedence over the CLASSPATH variable -->
<path id="project.class.path">
<fileset dir="${lib}">
<include name="*.jar"/>
<include name="*.zip"/>
</fileset>
<pathelement location="${build}/classes"/>
<pathelement location="${build}/testcases"/>
<pathelement path="${java.class.path}" />
</path>
<!--
============================================================================
Compilation and documentation making stuff
============================================================================
-->
<target name="init_compile" depends="init_all">
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}/classes"/>
</target>
<!-- Compile the java code from ${src}/weka into ${build}/classes -->
<target name="compile" depends="init_compile"
description="Compile weka and deposit class files in build/classes">
<javac srcdir="${src}"
fork="yes" memoryMaximumSize="${javac_max_memory}"
destdir="${build}/classes"
optimize="${optimization}"
includeantruntime="false"
debug="${debug}"
deprecation="${deprecation}"
source="1.5" target="1.5">
<classpath refid="project.class.path" />
</javac>
<copy todir="${build}/classes" >
<fileset dir="${src}">
<include name="weka/**/*.excludes"/>
<include name="weka/**/*.gif"/>
<include name="weka/**/*.png"/>
<include name="weka/**/*.jpeg"/>
<include name="weka/**/*.jpg"/>
<include name="weka/**/*.props"/>
<include name="weka/**/*.txt"/>
<include name="weka/**/*.xml"/>
<include name="weka/**/DatabaseUtils.props.*"/>
<include name="weka/gui/beans/README*"/>
<include name="**/*.cup"/>
<include name="**/*.flex"/>
<include name="**/*.jflex"/>
<include name="**/*.properties"/>
<include name="**/*.default"/>
</fileset>
</copy>
<rmic base="${build}/classes"
classname="weka.experiment.RemoteEngine"/>
<unzip src="${lib}/java-cup.jar" dest="${build}/classes">
<patternset>
<include name="java_cup/runtime/**/*"/>
</patternset>
</unzip>
</target>
<!-- Make the javadocs -->
<target name="docs"
depends="init_all"
description="Make javadocs into ./doc">
<mkdir dir="${doc}"/>
<javadoc sourcepath="${src}"
classpathref="project.class.path"
destdir="${doc}"
packagenames="weka.*"
Author="yes"
Public="yes"
maxmemory="256m"/>
<!-- insert the links to our homepage and documentation.html -->
<replace dir="${doc}"
token=""help-doc.html""
value=""../documentation.html" target="_blank"">
<include name="**/*.html"/>
</replace>
<replace dir="${doc}"
token="Help</B></FONT></A>&nbsp;</TD>"
value="Help</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="http://www.cs.waikato.ac.nz/ml/weka/" target="_blank"><FONT CLASS="NavBarFont1"><B>Weka's home</B></FONT></A>&nbsp;</TD>">
<include name="**/*.html"/>
</replace>
</target>
<!--
===========================================================================
Unit testing stuff
===========================================================================
-->
<!-- Junit testing initialization -->
<target name="init_tests" depends="init_all">
<available property="junit.present" classname="junit.framework.TestCase"/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}/testcases"/>
<mkdir dir="${reports}"/>
</target>
<!-- compile the testcases -->
<target name="compile_tests" depends="init_tests, compile"
description="Compile unit tests into build/testcases">
<javac srcdir="${src-test}"
fork="yes" memoryMaximumSize="${javac_max_memory}"
destdir="${build}/testcases"
optimize="${optimization}"
debug="${debug}"
includeantruntime="false"
deprecation="${deprecation}"
source="1.5" target="1.5">
<classpath refid="project.class.path" />
</javac>
<copy todir="${build}/testcases" >
<fileset dir="${src-test}">
<include name="**/*.arff"/>
<include name="**/*.cost"/>
<include name="**/*.xml"/>
<include name="**/*.matrix"/>
</fileset>
</copy>
</target>
<!-- Put everything in ${build}/testcases into the weka-tests.jar file -->
<target name="jar_tests" depends="compile_tests, init_dist"
description="Creates a jar file with the test cases in ./dist">
<jar jarfile="${dist}/weka-tests.jar"
basedir="${build}/testcases">
</jar>
</target>
<!-- Run the test cases via junit's testrunner class.
This is a faster, simpler option than running the junit task -->
<target name="run_tests" depends="compile_tests"
description="Execute unit tests (fast)">
<java fork="yes" dir="."
classname="junit.textui.TestRunner"
taskname="junit" failonerror="${run_tests_fail}">
<arg value="weka.AllTests"/>
<classpath refid="project.class.path" />
<jvmarg value="-Duser.timezone=Pacific/Auckland"/>
<jvmarg value="-Djava.awt.headless=${headless}"/>
<jvmarg value="-Dweka.test.Regression.root=${regression_tests_root}"/>
</java>
</target>
<!-- Run the test cases and produce an html summary (in ${reports}-->
<target name="junit" depends="compile_tests"
description="Execute unit tests and produce html summary (in ./reports)">
<junit fork="yes" dir=".">
<jvmarg value="-Djava.awt.headless=${headless}"/>
<jvmarg value="-Dweka.test.Regression.root=${regression_tests_root}"/>
<formatter type="xml"/>
<classpath refid="project.class.path" />
<batchtest todir="${reports}">
<fileset dir="${build}/testcases">
<include name="**/*Test.class"/>
<exclude name="**/AllTests.class"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="${reports}">
<fileset dir="${reports}">
<include name="TEST-*.xml"/>
</fileset>
<report format="noframes" todir="${reports}"/>
</junitreport>
</target>
<!--
===========================================================================
Release making stuff
===========================================================================
-->
<target name = "init_dist" depends="init_all">
<!-- Create the distribution directory -->
<mkdir dir="${dist}"/>
</target>
<!-- Put everything in ${build}/classes into the weka.jar file -->
<target name="exejar" depends="compile, init_dist"
description="Create an executable jar file in ./dist">
<copy todir="${build}/classes/weka/gui" file="resources/MacArffOpenFilesHandler.class"/>
<jar jarfile="${dist}/weka.jar"
basedir="${build}/classes">
<manifest>
<attribute name="Main-Class" value="weka.gui.GUIChooser"/>
</manifest>
</jar>
</target>
<!-- Put all .java, and .props files into ${dist}/weka-src.jar-->
<target name="srcjar" depends="init_dist, init_all"
description="Create a jar file containing weka source in ./dist">
<!-- jar up the source -->
<jar jarfile="${dist}/weka-src.jar"
basedir=".">
<include name="*.xml"/>
<include name="src/**/*.excludes"/>
<include name="src/**/*.gif"/>
<include name="src/**/*.png"/>
<include name="src/**/*.java"/>
<include name="src/**/*.jpeg"/>
<include name="src/**/*.jpg"/>
<include name="src/**/*.props"/>
<include name="src/**/*.txt"/>
<include name="src/**/*.xml"/>
<include name="src/**/DatabaseUtils.props.*"/>
<include name="src/**/weka/gui/beans/README*"/>
<include name="src/**/*.cup"/>
<include name="src/**/*.flex"/>
<include name="src/**/*.jflex"/>
<include name="src/**/*.properties"/>
<include name="src/**/*.default"/>
<include name="src/**/*.cost"/>
<include name="src/**/*.arff"/>
<include name="src/**/*.matrix"/>
<include name="src/**/*.ref"/>
<include name="lib/**/*.jar"/>
<include name="resources/**/*"/>
</jar>
</target>
<!-- make a jar file containing just the stuff needed for running a remote experiment server -->
<target name="remotejar" depends="compile, init_dist"
description="Create a jar file containing classes for remote experiments in ./dist">
<jar jarfile="${dist}/remoteEngine.jar"
basedir="${build}/classes"
includes="weka/experiment/*_*.class,weka/experiment/RemoteEngine*.class,weka/experiment/Compute.class,weka/experiment/Task.class,weka/experiment/TaskStatusInfo.class,weka/core/Queue*.class,weka/core/RevisionHandler.class,weka/core/Utils.class,weka/core/RevisionUtils.class"/>
<copy todir="${dist}" >
<fileset dir="${src}/weka/experiment">
<include name="remote.policy"/>
<include name="remote.policy.example"/>
</fileset>
</copy>
<jar jarfile="${dist}/remoteExperimentServer.jar"
basedir="${dist}"
includes="remoteEngine.jar,remote.policy,remote.policy.example"/>
<delete file="${dist}/remoteEngine.jar"/>
<delete file="${dist}/remote.policy"/>
<delete file="${dist}/remote.policy.example"/>
</target>
<!-- Writes $release version number to weka/core/version.txt -->
<target name="set_version">
<echo message="${release}" file="${src}/weka/core/version.txt"/>
<echo message="${release}" file="${build}/classes/weka/core/version.txt"/>
</target>
<!-- Make a release -->
<target name="release" depends="run_tests, release_sub_tasks"
description="Make a release in ${release}. Run with -Drelease=<number of release (eg. 3-4-1)>.">
</target>
<target name="release_no_junit" depends="compile, release_sub_tasks"
description="Make a release in ${release} without running junit tests. Run with -Drelease=<number of release (eg. 3-4-1)>.">
</target>
<target name="release_sub_tasks" depends="set_version, exejar, remotejar, srcjar, docs, changelog">
<!-- copy the docs to dist/docs -->
<copy todir="weka-${release}/weka-${release}/doc" >
<fileset dir="${doc}"/>
</copy>
<copy todir="weka-${release}/weka-${release}">
<fileset dir="${dist}"/>
</copy>
<copy todir="weka-${release}/weka-${release}/changelogs">
<fileset dir="../wekadocs/changelogs"/>
</copy>
<copy todir="weka-${release}/weka-${release}/data">
<fileset dir="../wekadocs/data"/>
</copy>
<copy todir="weka-${release}/weka-${release}">
<fileset dir="../wekadocs">
<include name="*.pdf"/>
</fileset>
</copy>
<copy todir="weka-${release}/weka-${release}">
<fileset dir="../wekadocs">
<include name="README*"/>
<include name="COPYING"/>
<include name="documentation.*"/>
<include name="weka.gif"/>
<include name="weka.ico"/>
</fileset>
</copy>
<zip destfile="weka-${release}.zip"
basedir="weka-${release}"/>
</target>
<!-- Make a Max OSX application (NOTE: assumes that release/release_no_junit or something that calls
release has been run first!!!). Also requires Ant version 1.7.0 or higher -->
<target name="osx_application" description="Make an OS X application. Run with -Drelease=<number of release (eg. 3-4-1)>. Assumes a release target has been run first!">
<mkdir dir="${macdistrib}"/>
<mkdir dir="${macdistrib}/weka-${release}"/>
<copy todir="${macdistrib}/weka-${release}">
<fileset dir="weka-${release}/weka-${release}"/>
</copy>
<taskdef name="jarbundler"
classname="net.sourceforge.jarbundler.JarBundler" />
<jarbundler dir="${macdistrib}"
name="weka-${release}"
mainclass="weka.gui.GUIChooser"
icon="${src}/weka/gui/weka_icon_new.icns"
version="${release}"
verbose="true"
VMOptions="-Xmx1Gb"
shortname="Weka"
arguments=""
workingdirectory="/Users"
jvmversion="1.5+">
<javaproperty name="java.library.path" value="$APP_PACKAGE/Contents/Resources"/>
<jarfileset dir="weka-${release}/weka-${release}">
<include name="weka.jar"/>
</jarfileset>
<documenttype name="Attribute Relation File Format (ARFF)"
extensions="arff xrff"
iconFile="${src}/weka/gui/weka_icon_new.icns"
role="Editor"/>
<documenttype name="Knowledge Flow layout file"
extensions="kf kfml"
iconFile="${src}/weka/gui/weka_icon_new.icns"
role="Editor"/>
</jarbundler>
<!-- Make a .dmg disk image -->
<exec executable="/usr/bin/hdiutil" os="Mac OS X">
<arg value="create"/>
<arg value="-srcfolder"/>
<arg value="${macdistrib}"/>
<arg value="-volname"/>
<arg value="weka-${release}"/>
<arg value="-ov"/>
<arg value="${macdistrib}/weka-${release}.dmg"/>
</exec>
</target>
<!-- New subversion stuff -->
<target name="svnCheckout" description="Checkout from subversion. Run with -Dsvn_username=username -Dsvn_password=password -Dweka_branch=<branch name (e.g. trunk, branches/book2ndEd-branch)>.">
<property name="source-root" value="."/>
<property name="repository.URL" value="https://svn.cms.waikato.ac.nz/svn/weka"/>
<java classname="org.tmatesoft.svn.cli.SVN"
dir="${source-root}/" fork="true">
<arg value="co"/>
<arg value="--username"/>
<arg value="${svn_username}"/>
<arg value="--password"/>
<arg value="${svn_password}"/>
<arg value="${repository.URL}/${weka_branch}/weka"/>
<classpath>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
<java classname="org.tmatesoft.svn.cli.SVN"
dir="${source-root}/" fork="true">
<arg value="co"/>
<arg value="--username"/>
<arg value="${svn_username}"/>
<arg value="--password"/>
<arg value="${svn_password}"/>
<arg value="${repository.URL}/${weka_branch}/wekadocs"/>
<classpath>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
<java classname="org.tmatesoft.svn.cli.SVN"
dir="${source-root}/" fork="true">
<arg value="co"/>
<arg value="--username"/>
<arg value="${svn_username}"/>
<arg value="--password"/>
<arg value="${svn_password}"/>
<arg value="${repository.URL}/${weka_branch}/installer"/>
<classpath>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
</target>
<target name="changelog"
description="Create a changelog file for a release of Weka. Run with -Dsvn_username=username -Dsvn_password=password -Drelease=<number of release (eg. 3-4-1)>, -Ddate_range=<date range for changes (eg. {2008-07-16}:{2008-09-29})>, -Dweka_branch=<branch name (e.g. trunk, branches/book2ndEd-branch)>.">
<property name="repository.URL" value="https://svn.cms.waikato.ac.nz/svn/weka"/>
<java classname="org.tmatesoft.svn.cli.SVN" fork="true"
output="../wekadocs/changelogs/CHANGELOG-${release}">
<arg value="log"/>
<arg value="--username"/>
<arg value="${svn_username}"/>
<arg value="--password"/>
<arg value="${svn_password}"/>
<arg value="-r"/>
<arg value="${date_range}"/>
<arg value="-v"/>
<arg value="${repository.URL}/${weka_branch}/weka/src/main/java/weka"/>
<classpath>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
</target>
<!-- This target is used for an automated nightly/weekly build job -->
<target name="nightly_build"
depends="init_tests"
description="Does a svn checkout, builds, runs unit tests, and mails the output to mail recipients (run ant with -Dsvn_username=username -Dsvn_password=password -Dweka_branch=branch -Dmail_recipients=<email,email,...> -Dmail_sender=email -Dmail_smtp_host=smtp-server)">
<!-- run the build process -->
<ant antfile="${ant.file}" target="svnCheckout" output="${reports}/nightly_build-init.txt">
<property name="mail_smtp_host" value="${mail_smtp_host}"/>
<property name="mail_sender" value="${mail_sender}"/>
<property name="mail_recipients" value="${mail_recipients}"/>
<property name="svn_username" value="${svn_username}"/>
<property name="svn_password" value="${svn_password}"/>
<property name="weka_branch" value="${weka_branch}"/>
</ant>
<ant antfile="${ant.file}" dir="weka" target="run_tests" output="../${reports}/nightly_build-results.txt">
<property name="mail_smtp_host" value="${mail_smtp_host}"/>
<property name="mail_sender" value="${mail_sender}"/>
<property name="mail_recipients" value="${mail_recipients}"/>
<property name="run_tests_fail" value="false"/>
<property name="headless" value="${headless}"/>
</ant>
<!-- mail the results -->
<mail messageMimeType="text/html"
tolist="${mail_recipients}"
mailhost="${mail_smtp_host}"
subject="nightly build results (${weka_branch}): ${TODAY}"
from="${mail_sender}">
<fileset dir="${reports}">
<include name="nightly_build*.*"/>
</fileset>
</mail>
</target>
<!-- Clean -->
<target name="clean" depends="init_all"
description="Removes the build, dist and reports directories">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
<delete dir="${reports}"/>
</target>
<target name="superclean" depends="clean"
description="Clean plus removes source trees! and doc directories">
<!-- WARNING, this deletes the source and doc directories -->
<delete dir="${src}"/>
<delete dir="${doc}"/>
</target>
</project>