3 <project default="compile" basedir=".">
6 <property name="build.deprecation" value="off" />
7 <property name="build.debug" value="off" />
9 <!-- import local build options -->
10 <property file="build.properties" />
12 <!-- import current version string -->
13 <property file="VERSION" />
15 <!-- the base location to put build targets -->
16 <property name="build.dir" value="build" />
17 <!-- where to put compiled class files -->
18 <property name="build.dest" value="${build.dir}/classes" />
19 <!-- where to put generated jar files -->
20 <property name="build.lib.dest" value="${build.dir}/lib" />
21 <!-- where to put generated javadocs -->
22 <property name="javadoc.dest" value="${build.dir}/doc" />
23 <!-- where to find the java source -->
24 <property name="build.src" value="src" />
26 <!-- where to find external jar files -->
27 <property name="lib.dir" value="lib" />
29 <!-- where the unit tests reside -->
30 <property name="test.dir" value="test" />
31 <property name="test.reports" value="${test.dir}/reports" />
33 <!-- PREPARE targets -->
35 <target name="prepare-env">
36 <!-- see if the 'test' directory exists -->
37 <available file="${test.dir}" type="dir" property="test.present" />
39 <!-- set the standard classpath -->
40 <path id="project.classpath">
41 <pathelement location="${build.dest}" />
42 <fileset dir="${lib.dir}" includes="*.jar,*.zip" />
44 <property name="project.classpath" refid="project.classpath" />
48 <target name="prepare-src" depends="prepare-env">
49 <mkdir dir="${build.dest}" />
50 <mkdir dir="${build.lib.dest}" />
53 <target name="prepare-test" depends="prepare-src" if="test.present">
54 <mkdir dir="${test.dir}/${build.dest}" />
55 <mkdir dir="${test.reports}" />
57 <path id="test.classpath">
58 <pathelement location="${test.dir}/${build.dest}" />
59 <pathelement path="${project.classpath}" />
60 <fileset dir="${test.dir}/${lib.dir}" includes="*jar,*.zip" />
62 <property name="test.classpath" refid="test.classpath" />
65 <!-- BUILD targets -->
67 <target name="dnsjava">
69 <javac srcdir="dnsjava"
70 destdir="${build.dest}"
71 deprecation="${build.deprecation}"
72 debug="${build.debug}"
75 includes="org/xbill/DNS/" />
76 <jar destfile="${build.lib.dest}/dnsjava-unbound.jar"
77 basedir="${build.dest}"
78 includes="org/xbill/DNS/" />
82 <target name="unbound-proto" depends="prepare-src, dnsjava" >
83 <javac srcdir="${build.src}"
84 destdir="${build.dest}"
85 deprecation="${build.deprecation}"
86 debug="${build.debug}"
89 classpathref="project.classpath"
90 includes="se/rfc/unbound/" />
93 <target name="unbound-proto-jar" depends="unbound-proto">
94 <jar jarfile="${build.lib.dest}/unbound-prototype.jar"
95 basedir="${build.dest}"
96 includes="se/rfc/unbound/" />
103 <target name="javadoc-unbound-proto" depends="prepare-src">
104 <mkdir dir="${javadoc.dest}" />
105 <javadoc packagenames="se.rfc.unbound.*"
106 sourcepath="${build.src}"
108 classpath="${project.classpath}"
109 destdir="${javadoc.dest}"
114 windowtitle="Unbound Prototype API Documentation">
118 <!-- TEST targets -->
119 <target name="build-tests" depends="prepare-test, unbound-proto"
121 <javac srcdir="${test.dir}/${build.src}"
122 destdir="${test.dir}/${build.dest}"
123 deprecation="${build.deprecation}"
124 debug="${build.debug}"
127 classpathref="test.classpath"
128 includes="se/rfc/unbound/" />
131 <target name="run-tests" depends="build-tests" if="test.present">
132 <junit printsummary="yes"
138 <pathelement path="${test.classpath}" />
141 <formatter type="plain" />
143 <batchtest todir="${test.reports}">
144 <fileset dir="${test.dir}/${build.dest}">
145 <include name="se/rfc/unbound/**/*Test.class" />
152 <!-- DIST targets -->
154 <property name="unbound-proto-distname"
155 value="unbound-prototype-${version}" />
157 <target name="unbound-proto-dist"
160 <tar tarfile="${unbound-proto-distname}.tar.gz"
162 <tarfileset mode="755"
164 prefix="${unbound-proto-distname}">
165 <include name="bin/*.sh" />
166 <exclude name="bin/_*.sh" />
170 prefix="${unbound-proto-distname}">
171 <include name="lib/*.jar" />
172 <include name="etc/*.properties" />
173 <include name="etc/named.ca" />
174 <include name="etc/trust_anchors" />
175 <include name="etc/*_trust_anchors" />
176 <include name="VERSION" />
177 <include name="README" />
178 <include name="licenses/**" />
179 <exclude name="bin/**" />
182 <tarfileset dir="${build.lib.dest}"
183 prefix="${unbound-proto-distname}/lib">
184 <include name="*.jar" />
189 <target name="unbound-proto-src-dist">
191 <tar tarfile="${unbound-proto-distname}-src.tar.gz"
194 <tarfileset mode="755"
196 prefix="${unbound-proto-distname}">
197 <include name="bin/*.sh" />
201 prefix="${unbound-proto-distname}">
202 <include name="src/**/*.java" />
203 <include name="dnsjava/**" />
204 <include name="lib/*.jar" />
205 <include name="etc/*.properties" />
206 <include name="etc/named.ca" />
207 <include name="etc/trust_anchors" />
208 <include name="licenses/**" />
209 <include name="VERSION" />
210 <include name="README" />
211 <include name="build.xml" />
212 <exclude name="bin/**" />
218 <target name="sign-dist"
219 depends="unbound-proto-dist, unbound-proto-src-dist">
220 <exec executable="gpg">
223 <arg value="--detach-sig" />
224 <arg path="${unbound-proto-distname}.tar.gz" />
226 <exec executable="gpg">
229 <arg value="--detach-sig" />
230 <arg path="${unbound-proto-distname}-src.tar.gz" />
235 <target name="flatten-jar-libs">
237 <mkdir dir="${build.dir}/jar" />
239 <unjar dest="${build.dir}/jar/">
240 <fileset dir="lib" includes="*.jar" />
245 <target name="unbound-resolver-jar" depends="compile, flatten-jar-libs">
247 <!-- this attempts to make a single runnable jar file for the
248 validating iterative resolver version of this project -->
250 <jar destfile="unbound-resolver.jar">
251 <fileset dir="${build.dest}"
252 includes="se/rfc/unbound/,org/xbill/DNS/" />
253 <fileset dir="${build.dir}/jar"
256 <attribute name="Main-Class" value="se.rfc.unbound.server.Server" />
262 <target name="unbound-digtest-jar" depends="compile, flatten-jar-libs">
264 <jar destfile="unbound-digtest.jar">
265 <fileset dir="${build.dest}"
266 includes="se/rfc/unbound/,org/xbill/DNS/" />
267 <fileset dir="${build.dir}/jar"
270 <attribute name="Main-Class" value="se.rfc.unbound.cl.DigTest" />
276 <!-- CLEAN targets -->
278 <target name="clean-unbound-proto" depends="prepare-env">
279 <delete dir="${build.dest}" />
280 <delete dir="${build.dir}/jar" />
281 <delete file="${build.lib.dest}/*.jar" />
284 <target name="clean-unbound-tests" depends="prepare-env"
286 <delete dir="${test.dir}/${build.dest}" />
287 <delete dir="${test.reports}" />
290 <target name="clean-dist" depends="prepare-env">
292 <fileset dir="." includes="*.tar.gz" />
297 <!-- MASTER targets -->
298 <target name="compile"
299 depends="usage, unbound-proto-jar">
303 depends="javadoc-unbound-proto">
312 depends="usage, unbound-proto-dist, unbound-proto-src-dist">
316 depends="usage, clean-unbound-proto, clean-unbound-tests, clean-dist">
319 <!-- USAGE target -->
320 <target name="usage" depends="prepare-env">
322 <echo message="Unbound Prototype v. ${version} Build System" />
323 <echo message="--------------------------------------" />
324 <echo message="Available Targets:" />
325 <echo message=" compile (default) - compiles the source code" />
326 <echo message=" test - run the unit tests" />
327 <echo message=" dist - create the distribution files" />
328 <echo message=" clean - delete class files" />
329 <echo message=" usage - this help message" />