Skip to content
Newer
Older
100644 390 lines (332 sloc) 15.9 KB
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored Aug 2, 2011
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 Aug 7, 2011
32 <property name="name" value="jdom2"/>
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored Aug 2, 2011
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 Aug 2, 2011
37
38 <property name="instrument" value="true" />
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored Aug 2, 2011
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 Aug 2, 2011
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 Aug 2, 2011
67 <property name="junit.build" value="${build}/junit" />
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored Aug 2, 2011
68 <property name="junit.instrumented" value="${build}/instrumented" />
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored Aug 2, 2011
69
70
71 <property name="samples" value="./core/samples/" />
72 <property name="samples.src" value="${samples}/" />
73 <property name="samples.build" value="${build}/samples"/>
74
75 <property name="lib.dir" value="./lib"/>
76 <property name="packages" value="org.jdom2.*"/>
77
78 <property name="build.javadocs" value="${build}/apidocs"/>
79
80 <property name="dist.root" value="./dist"/>
81 <property name="dist.dir" value="${dist.root}/${name}-${version}"/>
82
83 <property name="package.dir" value="./package"/>
84
34397dd @rolfl create an 'eclipse' target for ant.
rolfl authored Aug 2, 2011
85 <property name="coverage.out" value="${build}/coverage" />
86
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored Aug 2, 2011
87 <filter token="year" value="${year}"/>
88 <filter token="version" value="${version}"/>
89 <filter token="date" value="${TODAY}"/>
90 <filter token="log" value="true"/>
91 <filter token="verbose" value="true"/>
92
93 <!-- Default JAR libraries -->
94 <property name="parser.jar" value="${lib.dir}/xercesImpl.jar" />
b93332b @rolfl Include xml-apis jar in classpath for junit/eclipse targets.
rolfl authored Aug 15, 2011
95 <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 Aug 2, 2011
96 <property name="jaxen.jar" value="${lib.dir}/jaxen-1.1.3.jar" />
97 <property name="junit.jar" value="${lib.dir}/junit-4.8.2.jar" />
98 <property name="isorelax.jar" value="${contrib}/lib/isorelax.jar" />
99
100 <!-- Compilation class path -->
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored Aug 2, 2011
101 <path id="base.class.path">
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored Aug 2, 2011
102 <pathelement location="${jaxen.jar}" />
103 <pathelement location="${parser.jar}" />
b93332b @rolfl Include xml-apis jar in classpath for junit/eclipse targets.
rolfl authored Aug 15, 2011
104 <pathelement location="${xmlapi.jar}" />
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored Aug 2, 2011
105 <pathelement location="${junit.jar}" />
106 <pathelement location="${isorelax.jar}" />
107 </path>
108
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored Aug 2, 2011
109 <path id="core.class.path">
110 <path refid="base.class.path"/>
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored Aug 2, 2011
111 <pathelement location="${core.build}"/>
112 </path>
113
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored Aug 2, 2011
114 <path id="junit.class.path">
115 <pathelement location="${junit.instrumented}" />
116 <path refid="core.class.path"/>
117 <pathelement location="${junit.build}"/>
118 <fileset dir="${lib.dir}/cobertura" includes="*.jar" />
119 </path>
120
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored Aug 2, 2011
121 </target>
122
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored Aug 2, 2011
123
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored Aug 2, 2011
124 <!-- =================================================================== -->
125 <!-- Help on usage -->
126 <!-- =================================================================== -->
127 <target name="usage">
128 <echo message=""/>
129 <echo message=""/>
130 <echo message="JDOM Build file"/>
131 <echo message="-------------------------------------------------------------"/>
132 <echo message=""/>
133 <echo message=" available targets are:"/>
134 <echo message=""/>
cb64bd6 @hunterhacker Made the README.txt a bit more modern. Added the new usage commands t…
authored Aug 7, 2011
135 <echo message=" - package [default] -> generates ./build/jdom2.jar and other supporting files"/>
136 <echo message=" - compile -> compiles the source code"/>
137 <echo message=" - javadoc -> generates the API documentation in ./build/javadocs"/>
138 <echo message=" - junit -> runs the JUnit tests"/>
139 <echo message=" - coverage -> generates test coverage metrics"/>
140 <echo message=" - eclipse -> generates an Eclipse project (source folders, jars, etc)"/>
141 <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 Aug 2, 2011
142 <echo message=""/>
143 <echo message=" See the comments inside the build.xml file for more details."/>
144 <echo message="-------------------------------------------------------------"/>
145 <echo message=""/>
146 <echo message=""/>
147 </target>
148
149 <!-- =================================================================== -->
150 <!-- Prepares the build directory -->
151 <!-- =================================================================== -->
152 <target name="prepare" depends="init">
153 <mkdir dir="${build}"/>
154 <mkdir dir="${core.build}"/>
155 <mkdir dir="${about.build}"/>
156 <mkdir dir="${samples.build}"/>
157 <mkdir dir="${junit.build}"/>
158 <mkdir dir="${contrib.build}"/>
159 <mkdir dir="${metainf.build}"/>
160 </target>
161
162 <!-- =================================================================== -->
163 <!-- Prepares the source code -->
164 <!-- =================================================================== -->
165 <target name="prepare-src" depends="prepare">
166 <!-- copy src files -->
167 <copy todir="${core.build}" filtering="yes">
168 <fileset dir="${core.src}"/>
169 </copy>
170 <copy todir="${about.build}" filtering="yes">
171 <fileset dir="${about.src}"/>
172 </copy>
173 <copy todir="${samples.build}" filtering="yes">
174 <fileset dir="${samples.src}"/>
175 </copy>
176 <copy todir="${contrib.build}" filtering="yes">
177 <fileset dir="${contrib.src}"/>
178 </copy>
179 <copy todir="${junit.build}" filtering="yes">
180 <fileset dir="${junit.src}"/>
181 </copy>
182 </target>
183
184 <!-- =================================================================== -->
185 <!-- Compiles the source directory -->
186 <!-- =================================================================== -->
187 <target name="compile.core" depends="prepare-src"
188 description="Compiles the core source code">
189
190 <javac srcdir="${core.build}"
191 destdir="${core.build}"
192 debug="${compile.debug}"
193 optimize="${compile.optimize}"
194 target="${compile.target}"
195 source="${compile.source}"
196 deprecation="${compile.deprecation}">
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored Aug 2, 2011
197 <classpath refid="base.class.path"/>
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored Aug 2, 2011
198 </javac>
199 </target>
200
201 <target name="compile.about" depends="prepare-src"
202 description="Compiles the about source code">
203
204 <javac srcdir="${about.build}"
205 destdir="${about.build}"
206 debug="${compile.debug}"
207 optimize="${compile.optimize}"
208 target="${compile.target}"
209 source="${compile.source}"
210 deprecation="${compile.deprecation}">
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored Aug 2, 2011
211 <classpath refid="core.class.path"/>
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored Aug 2, 2011
212 </javac>
213 </target>
214
215 <target name="compile.samples" depends="compile.core"
216 description="Compiles the sample source code">
217
218 <javac srcdir="${samples.build}"
219 destdir="${samples.build}"
220 debug="${compile.debug}"
221 optimize="${compile.optimize}"
222 target="${compile.target}"
223 source="${compile.source}"
224 deprecation="${compile.deprecation}">
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored Aug 2, 2011
225 <classpath refid="core.class.path" />
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored Aug 2, 2011
226 </javac>
227 </target>
228
229 <target name="compile.contrib" depends="compile.core"
230 description="Compiles the contrib source code">
231
232 <javac srcdir="${contrib.build}"
233 destdir="${contrib.build}"
234 debug="${compile.debug}"
235 optimize="${compile.optimize}"
236 target="${compile.target}"
237 source="${compile.source}"
238 deprecation="${compile.deprecation}">
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored Aug 2, 2011
239 <classpath refid="core.class.path" />
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored Aug 2, 2011
240 </javac>
241 </target>
242
243 <target name="compile.junit" depends="compile.core"
244 description="Compiles the junit source code">
245
246 <javac srcdir="${junit.build}"
247 destdir="${junit.build}"
248 debug="${compile.debug}"
249 optimize="${compile.optimize}"
250 target="${compile.target}"
251 source="${compile.source}"
252 deprecation="${compile.deprecation}">
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored Aug 2, 2011
253 <classpath refid="core.class.path" />
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored Aug 2, 2011
254 </javac>
255 </target>
256
257 <target name="compile" depends="compile.core, compile.about, compile.junit, compile.contrib, compile.samples"
258 description="Compiles all JDOM code (core, samples, junit, contrib)" />
259
260 <!-- =================================================================== -->
261 <!-- Compiles the "About" code -->
262 <!-- =================================================================== -->
263 <target name="about" depends="compile.about"
264 description="Compiles the About code" />
265
266 <!-- =================================================================== -->
267 <!-- Creates the class package -->
268 <!-- =================================================================== -->
269 <target name="package" depends="compile"
270 description="Creates the class package">
271 <fixcrlf srcdir="." includes="**/*.bat" excludes="build*.*" eol="crlf"/>
272 <fixcrlf srcdir="." includes="**/*.sh" excludes="build*.*" eol="lf"/>
273
274 <!-- Filters defined specifically for updating the manifest -->
275 <filter token="version.spec" value="${version.spec}"/>
276 <filter token="version.impl" value="${version.impl}"/>
277 <copy todir="${metainf.build}/META-INF" filtering="yes">
278 <fileset dir="${metainf}"/>
279 <fileset dir=".">
280 <include name="LICENSE.txt"/>
281 </fileset>
282 </copy>
283 <jar jarfile="${build}/${name}.jar" manifest="${metainf.build}/META-INF/MANIFEST.MF">
fbd7fe3 @rolfl Clean up build artifacts.
rolfl authored Aug 2, 2011
284 <fileset dir="${core.build}" includes="**/*.class" />
285 <fileset dir="${about.build}" includes="**/*.class" />
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored Aug 2, 2011
286 <fileset dir="${metainf.build}" excludes="**/MANIFEST.MF" />
287 </jar>
288 <jar jarfile="${build}/${name}-contrib.jar" >
fbd7fe3 @rolfl Clean up build artifacts.
rolfl authored Aug 3, 2011
289 <fileset dir="${contrib.build}" includes="**/*.class" />
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored Aug 2, 2011
290 <fileset dir="${metainf.build}" excludes="**/MANIFEST.MF" />
291 </jar>
292 </target>
293
294 <!-- =================================================================== -->
295 <!-- Creates the API documentation -->
296 <!-- =================================================================== -->
297 <target name="javadoc" depends="prepare-src"
298 description="Creates the API documentation">
299 <mkdir dir="${build.javadocs}"/>
300 <javadoc packagenames="${packages}"
301 sourcepath="${core.build}"
302 destdir="${build.javadocs}"
303 author="true"
304 version="true"
305 use="true"
306 splitindex="true"
307 noindex="false"
308 windowtitle="${Name} v${version}"
309 doctitle="${Name} v${version}&lt;br&gt;API Specification"
310 header="&lt;b&gt;${Name}&lt;br&gt;&lt;font size='-1'&gt;${version}&lt;/font&gt;&lt;/b&gt;"
311 bottom="Copyright &#169; ${year} Jason Hunter, Brett McLaughlin. All Rights Reserved.">
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored Aug 2, 2011
312 <classpath refid="base.class.path"/>
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored Aug 2, 2011
313 </javadoc>
314 </target>
315
316 <!-- =================================================================== -->
317 <!-- Clean targets -->
318 <!-- =================================================================== -->
319 <target name="clean" depends="init"
320 description="Removes build files">
321 <delete dir="${build}"/>
322 </target>
323
324 <target name="distclean" depends="clean"
325 description="Removes the dist files">
326 <delete dir="${dist.root}"/>
327 </target>
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored Aug 2, 2011
328
329 <target name="coverage.setup" description="Set up code-coverage metrics" depends="compile.core">
330 <taskdef classpathref="junit.class.path" resource="tasks.properties"/>
331
edeb9e4 @rolfl Perform cleanup of the previous Cobertura artifacs before performing a
rolfl authored Sep 10, 2011
332 <deltree dir="${junit.instrumented}"/>
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored Aug 2, 2011
333 <mkdir dir="${junit.instrumented}" />
fbd7fe3 @rolfl Clean up build artifacts.
rolfl authored Aug 3, 2011
334 <property name="cobertura.datafile" value="${junit.instrumented}/cobertura.ser"/>
335 <cobertura-instrument todir="${junit.instrumented}" datafile="${cobertura.datafile}">
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored Aug 2, 2011
336 <fileset dir="${core.build}">
337 <include name="**/*.class"/>
338 </fileset>
339 </cobertura-instrument>
340
341 </target>
342
343 <target name="junit" depends="compile.core, compile.junit"
344 description="Run all the JUnit tests">
b93332b @rolfl Include xml-apis jar in classpath for junit/eclipse targets.
rolfl authored Aug 15, 2011
345 <junit fork="true" haltonerror="false" haltonfailure="false"
346 failureproperty="junit.failed" printsummary="true" timeout="100000"
347 showoutput="true" includeantruntime="true" >
fbd7fe3 @rolfl Clean up build artifacts.
rolfl authored Aug 3, 2011
348 <sysproperty key="net.sourceforge.cobertura.datafile"
349 file="${cobertura.datafile}" />
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored Aug 2, 2011
350 <classpath refid="junit.class.path" />
351 <test name="org.jdom2.test.cases.Alltests" />
352 </junit>
353 </target>
354
34397dd @rolfl create an 'eclipse' target for ant.
rolfl authored Aug 3, 2011
355 <target name="coverage" depends="coverage.setup, junit"
356 description="Run the code coverage tool.">
edeb9e4 @rolfl Perform cleanup of the previous Cobertura artifacs before performing a
rolfl authored Sep 10, 2011
357 <deltree dir="${coverage.out}"/>
34397dd @rolfl create an 'eclipse' target for ant.
rolfl authored Aug 3, 2011
358 <mkdir dir="${coverage.out}" />
359 <cobertura-report srcdir="${core.build}" destdir="${coverage.out}" datafile="${cobertura.datafile}"/>
360 <echo message="See ${coverage.out}/index.html for results." />
7cb8614 @rolfl Include JUnit ant target and code coverage tool cobertura.
rolfl authored Aug 2, 2011
361 </target>
362
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored Aug 2, 2011
363
34397dd @rolfl create an 'eclipse' target for ant.
rolfl authored Aug 3, 2011
364 <target name="eclipse" description="Set up your eclipse project (source folders, jars, etc.)">
365 <echo file="./.classpath" xml:space="preserve"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
366 <classpath>
367 <classpathentry kind="src" path="core/src/java"/>
368 <classpathentry kind="src" path="core/package"/>
369 <classpathentry kind="src" path="core/samples"/>
370 <classpathentry kind="src" path="test/src/java"/>
371 <classpathentry kind="src" path="test/resources"/>
372 <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/"/>
373 <classpathentry kind="src" path="contrib/samples"/>
374 <classpathentry kind="src" path="contrib/src/java/org/jdom2/contrib/ids/doc-files"/>
375 <classpathentry kind="src" path="contrib/src/java/org/jdom2/contrib/input/scanner/doc-files"/>
376 <classpathentry kind="lib" path="lib/junit-4.8.2.jar"/>
377 <classpathentry kind="lib" path="lib/xercesImpl.jar"/>
b9c2593 @rolfl Add xml-apis to eclipse path
rolfl authored Sep 5, 2011
378 <classpathentry kind="lib" path="lib/xml-apis.jar"/>
34397dd @rolfl create an 'eclipse' target for ant.
rolfl authored Aug 3, 2011
379 <classpathentry kind="lib" path="lib/jaxen-1.1.3.jar"/>
380 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
381 <classpathentry kind="output" path="ebuild"/>
382 </classpath>
383 ]]>
384 </echo>
385 </target>
386
0a76492 @rolfl Create an initial build.xml for the combined core/contrib/test code.
rolfl authored Aug 2, 2011
387 </project>
388
389 <!-- End of file -->
Something went wrong with that request. Please try again.