Skip to content

HTTPS clone URL

Subversion checkout URL

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