Skip to content

HTTPS clone URL

Subversion checkout URL

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