Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 406 lines (339 sloc) 16.841 kb
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
1 <!-- $Id: build.xml,v 1.57 2009/07/23 06:48:27 jhunter Exp $ -->
2
3 <!--
4 For instructions on how to build JDOM, please view the README.txt file.
5 -->
6
7 <project default="package" basedir=".">
8
9 <!-- =================================================================== -->
10 <!-- Initialization target -->
11 <!-- =================================================================== -->
12 <target name="init">
13 <tstamp/>
14
15 <!--
16 Give user a chance to override without editing this file
17 (and without using -D arguments each time they build).
18 The build properties a user is likely to override include:
19 - lib.dir The directory where to look for the default JAR
20 files. Defaults to ./lib
21 - xml-apis.jar The JAR containing the DOM, SAX and JAXP classes.
22 Defaults to ${lib.dir}/xml-apis.jar
23 - parser.jar The JAR containing the XML parser to use.
24 Defaults to ${lib.dir}/xerces.jar
25 - jaxen.lib.dir The directory containing the Jaxen JAR libraries.
26 Defaults to ${lib.dir}
27 -->
28 <property file="${user.home}/jdom.build.properties" />
29 <property file="${basedir}/build.properties" />
30
31 <property name="Name" value="JDOM"/>
5a4ad3c @hunterhacker Let's name the JARs jdom2.jar and jdom2-contrib.jar.
authored
32 <property name="name" value="jdom2"/>
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
33 <property name="version" value="2.alpha"/>
34 <property name="version.impl" value="${version}"/>
35 <property name="version.spec" value="2.alpha"/>
36 <property name="year" value="2011"/>
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
37
38 <property name="instrument" value="true" />
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
39
40 <echo message="----------- ${Name} ${version} ------------"/>
41
42 <property name="compile.debug" value="true" />
43 <property name="compile.optimize" value="true" />
44 <property name="compile.target" value="1.6" />
45 <property name="compile.source" value="1.6" />
46 <property name="compile.deprecation" value="true" />
47
48 <property name="build" value="./build"/>
49
50 <property name="core" value="./core" />
51 <property name="core.src" value="${core}/src/java" />
52 <property name="core.build" value="${build}/core" />
53
54 <property name="about" value="./core/package" />
55 <property name="about.src" value="${about}" />
56 <property name="about.build" value="${build}/about" />
57
58 <property name="metainf" value="./core/package/META-INF" />
59 <property name="metainf.build" value="${build}/META-INF" />
60
61 <property name="contrib" value="./contrib" />
62 <property name="contrib.src" value="${contrib}/src/java" />
63 <property name="contrib.build" value="${build}/contrib" />
64
65 <property name="junit" value="./test" />
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
66 <property name="junit.src" value="${junit}/src/java" />
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
67 <property name="junit.build" value="${build}/junit" />
e0af7b6 @rolfl Tidy up the ant junit process.
rolfl authored
68 <property name="junit.xml" value="${build}/junit.xml" />
69 <property name="junit.report" value="${build}/junit.report" />
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
70 <property name="junit.instrumented" value="${build}/instrumented" />
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
71
72
73 <property name="samples" value="./core/samples/" />
74 <property name="samples.src" value="${samples}/" />
75 <property name="samples.build" value="${build}/samples"/>
76
77 <property name="lib.dir" value="./lib"/>
78 <property name="packages" value="org.jdom2.*"/>
79
80 <property name="build.javadocs" value="${build}/apidocs"/>
81
82 <property name="dist.root" value="./dist"/>
83 <property name="dist.dir" value="${dist.root}/${name}-${version}"/>
84
85 <property name="package.dir" value="./package"/>
86
34397dd @rolfl create an 'eclipse' target for ant.
rolfl authored
87 <property name="coverage.out" value="${build}/coverage" />
88
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
89 <filter token="year" value="${year}"/>
90 <filter token="version" value="${version}"/>
91 <filter token="date" value="${TODAY}"/>
92 <filter token="log" value="true"/>
93 <filter token="verbose" value="true"/>
94
95 <!-- Default JAR libraries -->
96 <property name="parser.jar" value="${lib.dir}/xercesImpl.jar" />
b93332b @rolfl Include xml-apis jar in classpath for junit/eclipse targets.
rolfl authored
97 <property name="xmlapi.jar" value="${lib.dir}/xml-apis.jar" />
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
98 <property name="jaxen.jar" value="${lib.dir}/jaxen-1.1.3.jar" />
99 <property name="junit.jar" value="${lib.dir}/junit-4.8.2.jar" />
100 <property name="isorelax.jar" value="${contrib}/lib/isorelax.jar" />
101
102 <!-- Compilation class path -->
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
103 <path id="base.class.path">
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
104 <pathelement location="${jaxen.jar}" />
105 <pathelement location="${parser.jar}" />
b93332b @rolfl Include xml-apis jar in classpath for junit/eclipse targets.
rolfl authored
106 <pathelement location="${xmlapi.jar}" />
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
107 <pathelement location="${junit.jar}" />
108 <pathelement location="${isorelax.jar}" />
109 </path>
110
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
111 <path id="core.class.path">
112 <path refid="base.class.path"/>
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
113 <pathelement location="${core.build}"/>
114 </path>
115
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
116 <path id="junit.class.path">
117 <pathelement location="${junit.instrumented}" />
65a7b4c @rolfl Add implementation o Jaxen XPath library Navigator for supporting JDOM2.
rolfl authored
118 <pathelement location="${junit.build}"/>
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
119 <path refid="core.class.path"/>
120 <fileset dir="${lib.dir}/cobertura" includes="*.jar" />
121 </path>
122
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
123 </target>
124
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
125
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
126 <!-- =================================================================== -->
127 <!-- Help on usage -->
128 <!-- =================================================================== -->
129 <target name="usage">
130 <echo message=""/>
131 <echo message=""/>
132 <echo message="JDOM Build file"/>
133 <echo message="-------------------------------------------------------------"/>
134 <echo message=""/>
135 <echo message=" available targets are:"/>
136 <echo message=""/>
cb64bd6 @hunterhacker Made the README.txt a bit more modern. Added the new usage commands to b...
authored
137 <echo message=" - package [default] -> generates ./build/jdom2.jar and other supporting files"/>
138 <echo message=" - compile -> compiles the source code"/>
139 <echo message=" - javadoc -> generates the API documentation in ./build/javadocs"/>
140 <echo message=" - junit -> runs the JUnit tests"/>
141 <echo message=" - coverage -> generates test coverage metrics"/>
142 <echo message=" - eclipse -> generates an Eclipse project (source folders, jars, etc)"/>
143 <echo message=" - clean -> restores the distribution to its original and clean state"/>
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
144 <echo message=""/>
145 <echo message=" See the comments inside the build.xml file for more details."/>
146 <echo message="-------------------------------------------------------------"/>
147 <echo message=""/>
148 <echo message=""/>
149 </target>
150
151 <!-- =================================================================== -->
152 <!-- Prepares the build directory -->
153 <!-- =================================================================== -->
154 <target name="prepare" depends="init">
155 <mkdir dir="${build}"/>
156 <mkdir dir="${core.build}"/>
157 <mkdir dir="${about.build}"/>
158 <mkdir dir="${samples.build}"/>
159 <mkdir dir="${junit.build}"/>
160 <mkdir dir="${contrib.build}"/>
161 <mkdir dir="${metainf.build}"/>
162 </target>
163
164 <!-- =================================================================== -->
165 <!-- Prepares the source code -->
166 <!-- =================================================================== -->
167 <target name="prepare-src" depends="prepare">
168 <!-- copy src files -->
169 <copy todir="${samples.build}" filtering="yes">
170 <fileset dir="${samples.src}"/>
171 </copy>
172 <copy todir="${contrib.build}" filtering="yes">
173 <fileset dir="${contrib.src}"/>
174 </copy>
175 </target>
176
177 <!-- =================================================================== -->
178 <!-- Compiles the source directory -->
179 <!-- =================================================================== -->
180 <target name="compile.core" depends="prepare-src"
181 description="Compiles the core source code">
182
18d95b2 @rolfl Clean up the build again. Fix compile-time warnings, and remove the
rolfl authored
183 <javac srcdir="${core.src}"
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
184 destdir="${core.build}"
185 debug="${compile.debug}"
186 optimize="${compile.optimize}"
187 target="${compile.target}"
188 source="${compile.source}"
18d95b2 @rolfl Clean up the build again. Fix compile-time warnings, and remove the
rolfl authored
189 deprecation="${compile.deprecation}" includeantruntime="false">
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
190 <classpath refid="base.class.path"/>
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
191 </javac>
192 </target>
193
194 <target name="compile.samples" depends="compile.core"
195 description="Compiles the sample source code">
196
197 <javac srcdir="${samples.build}"
198 destdir="${samples.build}"
199 debug="${compile.debug}"
200 optimize="${compile.optimize}"
201 target="${compile.target}"
202 source="${compile.source}"
203 deprecation="${compile.deprecation}">
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
204 <classpath refid="core.class.path" />
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
205 </javac>
206 </target>
207
208 <target name="compile.contrib" depends="compile.core"
209 description="Compiles the contrib source code">
210
211 <javac srcdir="${contrib.build}"
212 destdir="${contrib.build}"
213 debug="${compile.debug}"
214 optimize="${compile.optimize}"
215 target="${compile.target}"
216 source="${compile.source}"
217 deprecation="${compile.deprecation}">
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
218 <classpath refid="core.class.path" />
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
219 </javac>
220 </target>
221
222 <target name="compile.junit" depends="compile.core"
223 description="Compiles the junit source code">
224
18d95b2 @rolfl Clean up the build again. Fix compile-time warnings, and remove the
rolfl authored
225 <copy todir="${junit.build}" >
226 <fileset dir="${junit.src}" excludes="*.java" />
227 </copy>
228
229 <javac srcdir="${junit.src}"
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
230 destdir="${junit.build}"
231 debug="${compile.debug}"
232 optimize="${compile.optimize}"
233 target="${compile.target}"
234 source="${compile.source}"
18d95b2 @rolfl Clean up the build again. Fix compile-time warnings, and remove the
rolfl authored
235 deprecation="${compile.deprecation}"
236 includeantruntime="false">
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
237 <classpath refid="core.class.path" />
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
238 </javac>
239 </target>
240
b46e7b9 @rolfl Remove default-package classes (JDOMAbout) from main jar.
rolfl authored
241 <target name="compile" depends="compile.core, compile.junit, compile.contrib, compile.samples"
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
242 description="Compiles all JDOM code (core, samples, junit, contrib)" />
243
244 <!-- =================================================================== -->
245 <!-- Creates the class package -->
246 <!-- =================================================================== -->
247 <target name="package" depends="compile"
248 description="Creates the class package">
249 <fixcrlf srcdir="." includes="**/*.bat" excludes="build*.*" eol="crlf"/>
250 <fixcrlf srcdir="." includes="**/*.sh" excludes="build*.*" eol="lf"/>
251
252 <!-- Filters defined specifically for updating the manifest -->
253 <filter token="version.spec" value="${version.spec}"/>
254 <filter token="version.impl" value="${version.impl}"/>
255 <copy todir="${metainf.build}/META-INF" filtering="yes">
256 <fileset dir="${metainf}"/>
257 <fileset dir=".">
258 <include name="LICENSE.txt"/>
259 </fileset>
260 </copy>
261 <jar jarfile="${build}/${name}.jar" manifest="${metainf.build}/META-INF/MANIFEST.MF">
fbd7fe3 @rolfl Clean up build artifacts.
rolfl authored
262 <fileset dir="${core.build}" includes="**/*.class" />
263 <fileset dir="${about.build}" includes="**/*.class" />
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
264 <fileset dir="${metainf.build}" excludes="**/MANIFEST.MF" />
265 </jar>
266 <jar jarfile="${build}/${name}-contrib.jar" >
fbd7fe3 @rolfl Clean up build artifacts.
rolfl authored
267 <fileset dir="${contrib.build}" includes="**/*.class" />
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
268 <fileset dir="${metainf.build}" excludes="**/MANIFEST.MF" />
269 </jar>
270 </target>
271
272 <!-- =================================================================== -->
273 <!-- Creates the API documentation -->
274 <!-- =================================================================== -->
275 <target name="javadoc" depends="prepare-src"
276 description="Creates the API documentation">
277 <mkdir dir="${build.javadocs}"/>
278 <javadoc packagenames="${packages}"
b46e7b9 @rolfl Remove default-package classes (JDOMAbout) from main jar.
rolfl authored
279 sourcepath="${core.src}"
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
280 destdir="${build.javadocs}"
281 author="true"
282 version="true"
283 use="true"
284 splitindex="true"
285 noindex="false"
286 windowtitle="${Name} v${version}"
287 doctitle="${Name} v${version}&lt;br&gt;API Specification"
288 header="&lt;b&gt;${Name}&lt;br&gt;&lt;font size='-1'&gt;${version}&lt;/font&gt;&lt;/b&gt;"
289 bottom="Copyright &#169; ${year} Jason Hunter, Brett McLaughlin. All Rights Reserved.">
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
290 <classpath refid="base.class.path"/>
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
291 </javadoc>
292 </target>
293
294 <!-- =================================================================== -->
295 <!-- Clean targets -->
296 <!-- =================================================================== -->
297 <target name="clean" depends="init"
298 description="Removes build files">
299 <delete dir="${build}"/>
300 </target>
301
302 <target name="distclean" depends="clean"
303 description="Removes the dist files">
304 <delete dir="${dist.root}"/>
305 </target>
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
306
e0af7b6 @rolfl Tidy up the ant junit process.
rolfl authored
307 <!-- =================================================================== -->
308 <!-- JUnit and Test Coverage targets -->
309 <!-- =================================================================== -->
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
310 <target name="coverage.setup" description="Set up code-coverage metrics" depends="compile.core">
311 <taskdef classpathref="junit.class.path" resource="tasks.properties"/>
312
edeb9e4 @rolfl Perform cleanup of the previous Cobertura artifacs before performing a
rolfl authored
313 <deltree dir="${junit.instrumented}"/>
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
314 <mkdir dir="${junit.instrumented}" />
fbd7fe3 @rolfl Clean up build artifacts.
rolfl authored
315 <property name="cobertura.datafile" value="${junit.instrumented}/cobertura.ser"/>
316 <cobertura-instrument todir="${junit.instrumented}" datafile="${cobertura.datafile}">
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
317 <fileset dir="${core.build}">
318 <include name="**/*.class"/>
65a7b4c @rolfl Add implementation o Jaxen XPath library Navigator for supporting JDOM2.
rolfl authored
319 <!-- exclude name="**/**/jaxen/**/*.class"/ -->
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
320 </fileset>
321 </cobertura-instrument>
e0af7b6 @rolfl Tidy up the ant junit process.
rolfl authored
322
323 <property name="forkjunit" value="true" />
324
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
325 </target>
326
327 <target name="junit" depends="compile.core, compile.junit"
328 description="Run all the JUnit tests">
e0af7b6 @rolfl Tidy up the ant junit process.
rolfl authored
329
330 <delete dir="${junit.report}" />
331 <mkdir dir="${junit.report}" />
332
333 <delete dir="${junit.xml}" />
334 <mkdir dir="${junit.xml}" />
335
336 <!-- this may already be set true in the cobertura task. -->
337 <property name="forkjunit" value="false" />
338
339 <junit fork="${forkjunit}" forkmode="once" haltonerror="false" haltonfailure="false"
b93332b @rolfl Include xml-apis jar in classpath for junit/eclipse targets.
rolfl authored
340 failureproperty="junit.failed" printsummary="true" timeout="100000"
341 showoutput="true" includeantruntime="true" >
e0af7b6 @rolfl Tidy up the ant junit process.
rolfl authored
342
fbd7fe3 @rolfl Clean up build artifacts.
rolfl authored
343 <sysproperty key="net.sourceforge.cobertura.datafile"
344 file="${cobertura.datafile}" />
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
345 <classpath refid="junit.class.path" />
e0af7b6 @rolfl Tidy up the ant junit process.
rolfl authored
346
347 <formatter type="xml"/>
348
349 <batchtest haltonerror="false" haltonfailure="false"
350 failureproperty="junit.failed" todir="${junit.xml}" >
18d95b2 @rolfl Clean up the build again. Fix compile-time warnings, and remove the
rolfl authored
351 <fileset dir="${junit.src}">
e0af7b6 @rolfl Tidy up the ant junit process.
rolfl authored
352 <include name="**/Test*.java"/>
353 <exclude name="**/generate/**" />
354 </fileset>
355 </batchtest>
356
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
357 </junit>
18d95b2 @rolfl Clean up the build again. Fix compile-time warnings, and remove the
rolfl authored
358
e0af7b6 @rolfl Tidy up the ant junit process.
rolfl authored
359 <junitreport todir="${junit.report}">
360 <fileset dir="${junit.xml}">
361 <include name="TEST-*.xml"/>
362 </fileset>
363
364 <report format="frames" todir="${junit.report}"/>
365 </junitreport>
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
366 </target>
367
34397dd @rolfl create an 'eclipse' target for ant.
rolfl authored
368 <target name="coverage" depends="coverage.setup, junit"
369 description="Run the code coverage tool.">
edeb9e4 @rolfl Perform cleanup of the previous Cobertura artifacs before performing a
rolfl authored
370 <deltree dir="${coverage.out}"/>
34397dd @rolfl create an 'eclipse' target for ant.
rolfl authored
371 <mkdir dir="${coverage.out}" />
18d95b2 @rolfl Clean up the build again. Fix compile-time warnings, and remove the
rolfl authored
372 <cobertura-report srcdir="${core.src}" destdir="${coverage.out}" datafile="${cobertura.datafile}"/>
34397dd @rolfl create an 'eclipse' target for ant.
rolfl authored
373 <echo message="See ${coverage.out}/index.html for results." />
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored
374 </target>
375
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
376
e0af7b6 @rolfl Tidy up the ant junit process.
rolfl authored
377 <!-- =================================================================== -->
378 <!-- Eclipse targets -->
379 <!-- =================================================================== -->
34397dd @rolfl create an 'eclipse' target for ant.
rolfl authored
380 <target name="eclipse" description="Set up your eclipse project (source folders, jars, etc.)">
381 <echo file="./.classpath" xml:space="preserve"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
382 <classpath>
383 <classpathentry kind="src" path="core/src/java"/>
384 <classpathentry kind="src" path="core/package"/>
385 <classpathentry kind="src" path="core/samples"/>
386 <classpathentry kind="src" path="test/src/java"/>
387 <classpathentry kind="src" path="test/resources"/>
388 <classpathentry kind="src" path="contrib/src/java" excluding="org/jdom/contrib/ids/doc-files/|org/jdom/contrib/input/scanner/doc-files/|org/jdom2/contrib/ids/doc-files/|org/jdom2/contrib/ids/doc-files/|org/jdom2/contrib/input/scanner/doc-files/|org/jdom2/contrib/input/scanner/doc-files/|org/jdom2/contrib/schema/"/>
389 <classpathentry kind="src" path="contrib/samples"/>
390 <classpathentry kind="src" path="contrib/src/java/org/jdom2/contrib/ids/doc-files"/>
391 <classpathentry kind="src" path="contrib/src/java/org/jdom2/contrib/input/scanner/doc-files"/>
392 <classpathentry kind="lib" path="lib/junit-4.8.2.jar"/>
393 <classpathentry kind="lib" path="lib/xercesImpl.jar"/>
b9c2593 @rolfl Add xml-apis to eclipse path
rolfl authored
394 <classpathentry kind="lib" path="lib/xml-apis.jar"/>
34397dd @rolfl create an 'eclipse' target for ant.
rolfl authored
395 <classpathentry kind="lib" path="lib/jaxen-1.1.3.jar"/>
396 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
397 <classpathentry kind="output" path="ebuild"/>
398 </classpath>
399 ]]>
400 </echo>
401 </target>
402
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored
403 </project>
404
405 <!-- End of file -->
Something went wrong with that request. Please try again.