-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
356 lines (324 loc) · 14.2 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
<?xml version="1.0"?>
<project default="usage" basedir=".">
<property file="build.properties"/>
<!-- Override compiler to be -->
<property name="target" value="1.4" />
<property name="source" value="${target}" />
<property name="build.dir" value="build/classes"/>
<property name="dist.dir" value="dist"/>
<property name="license.dir" value="licenses"/>
<property name="build.lib.dir" value="build/lib"/>
<property name="lib.dir" value="lib"/>
<property name="test.dir" value="test"/>
<property name="src.dir" value="src"/>
<property name="demo.dir" value="demo"/>
<property name="report.dir" value="reports"/>
<property name="javadoc.dir" value="docs"/>
<property name="version" value="${version_major}.${version_minor}.${version_last}"/>
<property name="dnsjnio.dist.folder" value="dnsjnio-${version}"/>
<!-- set the classpath -->
<path id="dnsjnio.classpath">
<pathelement location="${build.dir}" />
<fileset dir="${lib.dir}" includes="*.jar,*.zip" />
</path>
<property name="dnsjnio.classpath" refid="dnsjnio.classpath" />
<!-- Nominet targets -->
<target name="compile" depends="make.dirs, compile.src, compile.demo"/>
<target name="compile.src">
<javac target="${target}"
source="${source}"
srcdir="${src.dir}/"
destdir="${build.dir}"
deprecation="true"
classpathref="dnsjnio.classpath"
includes="uk/nominet/ org/xbill/DNS/" />
</target>
<target name="compile.demo">
<javac target="${target}"
source="${source}"
srcdir="${demo.dir}/"
destdir="${build.dir}"
deprecation="true"
classpathref="dnsjnio.classpath"/>
</target>
<target name="make.dirs">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.lib.dir}"/>
<mkdir dir="${report.dir}"/>
</target>
<target name="compile.test" depends = "jar">
<javac target="${target}"
source="${source}"
srcdir="${test.dir}/"
destdir="${build.dir}"
deprecation="true"
classpathref="dnsjnio.classpath"
includes="uk/nominet/" />
</target>
<target name="jar" depends="clean, fix.versions, compile">
<!-- Create the bnd directory which will be used during the
osgi-fy process -->
<mkdir dir="${build.dir}/bnd"/>
<jar jarfile="${build.dir}/bnd/dnsjnio.jar"
basedir="${build.dir}"
includes="**/*"
excludes="**/${report.dir}/*,**/DemoClient*,**/bnd/*"/>
<get src="http://www.aqute.biz/repo/biz/aQute/bnd/0.0.401/bnd-0.0.401.jar"
dest="${build.dir}/bnd/bnd.jar"/>
<taskdef resource="aQute/bnd/ant/taskdef.properties"
classpath="${build.dir}/bnd/bnd.jar"/>
<!-- Create the .bnd file which holds all needed osgi
metadata-->
<echo file="${build.dir}/bnd/dnsjnio.bnd" append="false">
Bundle-Version: ${version}
Bundle-Name: DNSJava extension to support NIO
Bundle-SymbolicName: uk.nominet.dnsjnio
Export-Package: uk.nominet.dnsjnio;version=${version}
Bundle-Vendor: nominet.uk
Bundle-RequiredExecutionEnvironment: J2SE-1.4
Import-Package: !uk.nominet.dnsjnio,*
</echo>
<bndwrap definitions="${build.dir}/bnd/"
jars="${build.dir}/bnd/dnsjnio.jar"
output="${build.lib.dir}/dnsjnio.jar"/>
<delete file="${build.dir}/bnd/dnsjnio.bnd"/>
<delete file="${build.dir}/bnd/dnsjnio.jar"/>
</target>
<target name="javadoc">
<javadoc author="true" breakiterator="true" classpathref="dnsjnio.classpath"
destdir="${javadoc.dir}" doctitle="dnsjnio" failonerror="false"
packagenames="uk.nominet.*">
<fileset dir="${src.dir}"/>
</javadoc>
</target>
<target name="demo" depends="compile">
<java classname="DemoClient"
classpathref="dnsjnio.classpath"
fork="true">
<jvmarg value="-XX:+AggressiveHeap"/>
</java>
</target>
<target name="test" depends="run.test, make.junit.report"/>
<target name="ret.test" depends="run.ret.test, make.junit.report"/>
<target name="listener.test" depends="run.listener.test, make.junit.report"/>
<target name="run.test" depends="compile.test">
<echo message="**** RUNNING TESTS ****" />
<echo message="**** SOME MAY TAKE SEVERAL MINUTES EACH ****" />
<junit printsummary="yes" fork="yes"
errorproperty="test.failed"
failureproperty="test.failed"
haltonfailure="true">
<jvmarg value="-XX:+AggressiveHeap"/>
<classpath>
<pathelement location="${build.dir}" />
<fileset dir="${lib.dir}" includes="*.jar,*.zip" />
</classpath>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<batchtest todir="${report.dir}">
<fileset dir="${build.dir}">
<include name="uk/nominet/**/*Test.class"/>
<exclude name="uk/nominet/**/RemoteServerTest.class"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="run.ret.test" depends="compile.test">
<junit printsummary="yes" fork="yes"
errorproperty="test.failed"
failureproperty="test.failed"
haltonfailure="false">
<jvmarg value="-XX:+AggressiveHeap"/>
<classpath>
<pathelement location="${build.dir}" />
<fileset dir="${lib.dir}" includes="*.jar,*.zip" />
</classpath>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<batchtest todir="${report.dir}">
<fileset dir="${build.dir}">
<include name="uk/nominet/**/RetTest.class"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="run.listener.test" depends="compile.test">
<junit printsummary="yes" fork="yes"
errorproperty="test.failed"
failureproperty="test.failed"
haltonfailure="false">
<jvmarg value="-XX:+AggressiveHeap"/>
<classpath>
<pathelement location="${build.dir}" />
<fileset dir="${lib.dir}" includes="*.jar,*.zip" />
</classpath>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<batchtest todir="${report.dir}">
<fileset dir="${build.dir}">
<include name="uk/nominet/**/ListenerTest.class"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="make.junit.report">
<delete dir="${report.dir}/junitreport" quiet="true" failonerror="false"/>
<mkdir dir="${report.dir}/junitreport"/>
<junitreport todir="${report.dir}/junitreport">
<fileset dir="${report.dir}">
<include name="TEST-*.*"/>
</fileset>
<report todir="${report.dir}/junitreport"/>
</junitreport>
</target>
<target name="clean">
<delete quiet = "true">
<fileset dir="${dist.dir}">
<include name="*.tar.gz" />
<include name="*.zip" />
</fileset>
</delete>
<delete quiet = "true">
<fileset dir="${lib.dir}">
<include name="dnsjnio.jar" />
</fileset>
</delete>
<delete quiet = "true">
<fileset dir="${build.lib.dir}">
<include name="*.jar" />
</fileset>
</delete>
<delete quiet="true">
<fileset dir="${build.dir}">
<include name="**/*" />
</fileset>
</delete>
<delete quiet="true">
<fileset dir="${report.dir}">
<include name="**/*.*" />
</fileset>
</delete>
</target>
<target name="build.dist" depends="jar, javadoc">
<!-- Now copy the distributables in to the lib foler -->
<copy file="${build.lib.dir}/dnsjnio.jar" tofile="${lib.dir}/dnsjnio.jar"/>
</target>
<target name="fix.versions">
<!-- Sort out the version numbers for the code, docs and distribution -->
<copy file="src/README.src"
tofile="README" overwrite="true">
<filterset>
<filter token="VERSION_STRING" value="${version}"/>
</filterset>
</copy>
<copy file="src/uk/nominet/dnsjnio/Version.java.ant"
tofile="src/uk/nominet/dnsjnio/Version.java" overwrite="true">
<filterset>
<filter token="VERSION_STRING" value="${version}"/>
</filterset>
</copy>
<copy file="test/uk/nominet/dnsjnio/RemoteServerTest.java.txt"
tofile="test/uk/nominet/dnsjnio/RemoteServerTest.java" overwrite="true">
<filterset>
<filter token="VERSION_STRING" value="${version_major}-${version_minor}-${version_last}"/>
</filterset>
</copy>
</target>
<target name="dist" depends="build.dist, dist.zip, dist.tar">
<!-- We want to make a windows .zip, with CRLF on text files,
and a .tar file with CRLF removed -->
</target>
<target name="dist.zip" depends="windows.CRLF">
<!-- Make a zip release -->
<zip destfile="${dist.dir}/dnsjnio-${version}.zip">
<zipfileset dir="." includes="src/**/*" prefix="${dnsjnio.dist.folder}"/>
<zipfileset dir="." includes="demo/**/*" prefix="${dnsjnio.dist.folder}"/>
<zipfileset dir="." includes="test/**/*" prefix="${dnsjnio.dist.folder}"/>
<zipfileset dir="." includes="${license.dir}/**/*" prefix="${dnsjnio.dist.folder}"/>
<zipfileset dir="." includes="build.xml" prefix="${dnsjnio.dist.folder}"/>
<zipfileset dir="." includes="build.properties" prefix="${dnsjnio.dist.folder}"/>
<zipfileset dir="." includes="README" prefix="${dnsjnio.dist.folder}"/>
<zipfileset dir="." includes="lib/commons-logging.jar" prefix="${dnsjnio.dist.folder}"/>
<zipfileset dir="." includes="lib/log4j-1.2.8.jar" prefix="${dnsjnio.dist.folder}"/>
<!-- <zipfileset dir="." includes="lib/dnsjava-*.jar" prefix="${dnsjnio.dist.folder}"/> -->
<zipfileset dir="." includes="lib/dnsjnio.jar" prefix="${dnsjnio.dist.folder}"/>
<zipfileset dir="." includes="lib/spring.jar" prefix="${dnsjnio.dist.folder}"/>
</zip>
</target>
<target name="dist.tar" depends="unix.CRLF">
<!-- Make a tar release -->
<tar destfile="${dist.dir}/dnsjnio-${version}.tar">
<tarfileset dir="." includes="src/**/*" prefix="${dnsjnio.dist.folder}"/>
<tarfileset dir="." includes="demo/**/*" prefix="${dnsjnio.dist.folder}"/>
<tarfileset dir="." includes="test/**/*" prefix="${dnsjnio.dist.folder}"/>
<tarfileset dir="." includes="${license.dir}/**/*" prefix="${dnsjnio.dist.folder}"/>
<tarfileset dir="." includes="build.xml" prefix="${dnsjnio.dist.folder}" preserveLeadingSlashes="true"/>
<tarfileset dir="." includes="build.properties" prefix="${dnsjnio.dist.folder}" preserveLeadingSlashes="true"/>
<tarfileset dir="." includes="README" prefix="${dnsjnio.dist.folder}" preserveLeadingSlashes="true"/>
<tarfileset dir="." includes="lib/commons-logging.jar" prefix="${dnsjnio.dist.folder}" preserveLeadingSlashes="true"/>
<tarfileset dir="." includes="lib/log4j-1.2.8.jar" prefix="${dnsjnio.dist.folder}" preserveLeadingSlashes="true"/>
<!-- <tarfileset dir="." includes="lib/dnsjava-*.jar" prefix="${dnsjnio.dist.folder}" preserveLeadingSlashes="true"/> -->
<tarfileset dir="." includes="lib/dnsjnio.jar" prefix="${dnsjnio.dist.folder}" preserveLeadingSlashes="true"/>
<tarfileset dir="." includes="lib/spring.jar" prefix="${dnsjnio.dist.folder}" preserveLeadingSlashes="true"/>
</tar>
<gzip zipfile="${dist.dir}/dnsjnio-${version}.tar.gz" src="${dist.dir}/dnsjnio-${version}.tar"/>
</target>
<target name="unix.CRLF">
<fixcrlf srcdir="${basedir}"
eol="lf"
eof="remove"
includes="*"/>
<fixcrlf srcdir="${license.dir}"
eol="lf"
eof="remove"
includes="*"/>
<fixcrlf srcdir="${src.dir}"
eol="lf"
eof="remove"
includes="**/*"/>
<fixcrlf srcdir="${demo.dir}"
eol="lf"
eof="remove"
includes="**/*"/>
<fixcrlf srcdir="${test.dir}"
eol="lf"
eof="remove"
includes="**/*"/>
</target>
<target name="windows.CRLF">
<fixcrlf srcdir="${basedir}"
eol="crlf"
eof="asis"
includes="*"/>
<fixcrlf srcdir="${license.dir}"
eol="crlf"
eof="asis"
includes="*"/>
<fixcrlf srcdir="${src.dir}"
eol="crlf"
eof="asis"
includes="**/*"/>
<fixcrlf srcdir="${demo.dir}"
eol="crlf"
eof="asis"
includes="**/*"/>
<fixcrlf srcdir="${test.dir}"
eol="crlf"
eof="asis"
includes="**/*"/>
</target>
<!-- USAGE target -->
<target name="usage">
<echo message=" " />
<echo message="dnsjnio ${version} Build System" />
<echo message="-------------------" />
<echo message="Available Targets:" />
<echo message=" jar - create jar from class files" />
<echo message=" clean - delete class files" />
<echo message=" dist - package it up" />
<echo message=" test - run the tests" />
<echo message=" demo - run the demo" />
<echo message=" usage - this help message" />
<echo message=" " />
</target>
</project>