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