-
Notifications
You must be signed in to change notification settings - Fork 20
/
build_package.xml
304 lines (279 loc) · 10.4 KB
/
build_package.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
<project name="weka-package" default="compile" basedir=".">
<!--
===========================================================================
Ant build file for weka a weka package.
Type ant -projecthelp for targets and descriptions.
$Revision$
===========================================================================
-->
<!-- 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"/>
<!-- set specfic properties for this build: lexicons, resources and datasets -->
<property name="lexicons" value="lexicons"/>
<property name="resources" value="resources"/>
<property name="data" value="data"/>
<property name="javac_max_memory" value="256m"/>
<property name="debug" value="on" />
<property name="package" value="AffectiveTweets"/>
<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 package and deposit class files in build/classes">
<javac srcdir="${src}"
fork="yes" memoryMaximumSize="${javac_max_memory}"
destdir="${build}/classes"
optimize="${optimization}"
debug="${debug}"
deprecation="${deprecation}"
source="1.6" target="1.6">
<classpath refid="project.class.path" />
</javac>
<copy todir="${build}/classes" >
<fileset dir="${src}">
<include name="**/*.gif"/>
<include name="**/*.png"/>
<include name="**/*.jpeg"/>
<include name="**/*.jpg"/>
<include name="**/*.props"/>
<include name="**/*.txt"/>
<include name="**/*.xml"/>
<include name="**/*.cup"/>
<include name="**/*.flex"/>
<include name="**/*.jflex"/>
<include name="**/*.properties"/>
<include name="**/*.default"/>
</fileset>
</copy>
</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}"
Author="yes"
Public="yes"
link="http://weka.sourceforge.net/doc.dev/"
maxmemory="256m"/>
</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"/>
<!-- make this if it doesn't exist so that the compile_test task doesn't faile for
stuff that doesn't have test cases -->
<mkdir dir="${src-test}"/>
</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}"
deprecation="${deprecation}"
source="1.6" target="1.6">
<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 ${package}-tests.jar file -->
<target name="jar_tests" depends="compile_tests, init_dist"
description="Creates a jar file with the test cases in ./dist. Run with -Dpackage=[package name]">
<jar jarfile="${dist}/${package}-tests.jar"
basedir="${build}/testcases">
</jar>
</target>
<target name="run_tests_all" 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.AllPackageTests"/>
<classpath refid="project.class.path" />
<jvmarg value="-server"/>
<!-- <jvmarg value="-Xint"/> -->
<jvmarg value="-Djava.awt.headless=${headless}"/>
<jvmarg value="-Dweka.test.Regression.root=${regression_tests_root}"/>
<jvmarg value="-Duser.timezone=Pacific/Auckland"/>
</java>
</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 ${package}.jar file -->
<target name="exejar" depends="compile, docs, init_dist"
description="Create a binary jar file in ./dist">
<jar jarfile="${dist}/${package}.jar"
basedir="${build}/classes">
</jar>
</target>
<target name="make_package" depends="exejar" description="Make the package zip file. Run with -Dpackage=[package name]">
<mkdir dir="${dist}/${package}"/>
<copy todir="${dist}/${package}">
<fileset dir="${dist}">
<include name="*.jar"/>
</fileset>
</copy>
<delete>
<fileset dir="${dist}">
<include name="*.jar"/>
</fileset>
</delete>
<copy file="Description.props"
todir="${dist}/${package}"/>
<copy file="GenericPropertiesCreator.props"
todir="${dist}/${package}"/>
<copy file="GUIEditors.props"
todir="${dist}/${package}"/>
<mkdir dir="${dist}/${package}/lib"/>
<copy todir="${dist}/${package}/lib" >
<fileset dir="${lib}">
<include name="*.jar"/>
<exclude name="weka.jar"/>
<exclude name="weka-tests.jar"/>
<exclude name="junit.jar"/>
<include name="*.zip"/>
</fileset>
</copy>
<mkdir dir="${dist}/${package}/lexicons"/>
<copy todir="${dist}/${package}/lexicons" >
<fileset dir="${lexicons}">
<include name="**/*"/>
</fileset>
</copy>
<mkdir dir="${dist}/${package}/data"/>
<copy todir="${dist}/${package}/data" >
<fileset dir="${data}">
<include name="**/*"/>
</fileset>
</copy>
<mkdir dir="${dist}/${package}/resources"/>
<copy todir="${dist}/${package}/resources" >
<fileset dir="${resources}">
<include name="**/*"/>
</fileset>
</copy>
<mkdir dir="${dist}/${package}/doc"/>
<copy todir="${dist}/${package}/doc" >
<fileset dir="${doc}">
<include name="**/*"/>
</fileset>
</copy>
<mkdir dir="${dist}/${package}/src"/>
<copy todir="${dist}/${package}" >
<fileset dir=".">
<include name="*.xml"/>
<include name="src/**/*.excludes"/>
<include name="src/**/*.gif"/>
<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/**/*.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"/>
</fileset>
</copy>
<zip destfile="${dist}/${package}.zip"
basedir="${dist}/${package}">
</zip>
</target>
<!-- Put all .java, and .props files into ${dist}/${package}-src.jar-->
<target name="srcjar" depends="init_dist, init_all"
description="Create a jar file containing weka source in ./dist. Run with -Dpackage=[package name]">
<!-- jar up the source -->
<jar jarfile="${dist}/${package}-src.jar"
basedir=".">
<include name="*.xml"/>
<include name="src/**/*.excludes"/>
<include name="src/**/*.gif"/>
<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/**/*.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="lib/**/*.jar"/>
</jar>
</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}"/>
</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>