-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
executable file
·345 lines (303 loc) · 12.3 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns:ivy="antlib:org.apache.ivy.ant"
name="jRally"
default="compile">
<property file="local.properties"/>
<!--
The following properties are top-level directories that contain the source, libraries,
and tools that make up this package. The separation between lib.dir and ivy.lib.dir
is an artifact of using Apache Ivy for external library dependencies. Everything in
ivy.lib.dir is downloaded by Ivy. Lib.dir contains libraries that are not currently
available using Ivy so we are forced to bundle them statically.
-->
<property name="src.dir" location="src/main"/>
<property name="test.src.dir" location="src/test"/>
<property name="web.src.dir" location="src/web"/>
<property name="config.dir" location="configs"/>
<property name="web.rsrc.dir" value="${web.src.dir}/resources"/>
<property name="generated.src.dir" location="generated-src"/>
<property name="lib.dir" location="local-lib"/>
<property name="ivy.lib.dir" location="ext-lib"/>
<property name="tools.dir" location="tools"/>
<property name="docs.dir" location="docs"/>
<property name="schemas.dir" value="${config.dir}/main/schemas"/>
<property name="xsl.dir" value="${config.dir}/main/xslt"/>
<!--
This set of properties controls the locations of intermediate files. These are used
to store compiled classes and stage other intermediates as necessary.
Currently all of the intermediates are located under build.dir. The `clean' target
removes all intermediate files by simply removing this directory. If any intermediate
files are introduced outside of build.dir, then make sure that the `clean' target is
updated appropriately.
-->
<property name="build.dir" location="build"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="test.classes.dir" value="${build.dir}/test-classes"/>
<property name="eclipse.build.dir" value="build/eclipse"/> <!-- this is required to be relative -->
<property name="coverage.dir" value="${build.dir}/coverage"/>
<!-- This is not defined here, read the comments above the "emma" target -->
<!-- property name="instr.classes.dir" value="${build.dir}/instr"/ -->
<!--
This set of properties controls the locations of the artifacts constructed by this
package.
Currently all of the output artifacts are contained in output.dir. The `real-clean'
target removes all generated files by deleting this directory. If an output file is
added outside of this tree, then make sure that `real-clean' is updated to remove
the file or files.
-->
<property name="output.dir" location="bin"/>
<property name="jar.path" value="${output.dir}/${ant.project.name}.jar"/>
<property name="test.jar.path" value="${output.dir}/${ant.project.name}-tests.jar"/>
<property name="war.path" value="${output.dir}/${ant.project.name}.war"/>
<property name="javadoc.dir" value="${docs.dir}/api"/>
<property name="report.dir" value="${docs.dir}/reports"/>
<property name="junit.report.dir" value="${report.dir}/test"/>
<property name="coverage.report.dir" value="${report.dir}/coverage"/>
<property name="schema.docs.dir" value="${docs.dir}/schema-docs"/>
<path id="emma.path">
<pathelement location="${emma.dir}/emma.jar"/>
<pathelement location="${emma.dir}/emma_ant.jar"/>
</path>
<path id="default.classpath">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
<fileset dir="${ivy.lib.dir}" includes="**/*.jar"/>
</path>
<path id="build.classpath">
<path refid="default.classpath"/>
<fileset dir="${tools.dir}" includes="**/*.jar"/>
</path>
<path id="run.classpath">
<path refid="default.classpath"/>
<fileset dir="${output.dir}" includes="**/*.jar"/>
<pathelement location="${config.dir}/test"/>
</path>
<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
<classpath refid="build.classpath"/>
</taskdef>
<taskdef name="eclipse" classname="prantl.ant.eclipse.EclipseTask">
<classpath refid="build.classpath"/>
</taskdef>
<taskdef resource="emma_ant.properties" classpathref="emma.path"/>
<target name="update-ivy"
description="===> retrieve dependencies">
<ivy:retrieve type="jar" sync="true"/>
</target>
<target name="xml-sources"
description="===> generate JAXB sources from the schemas">
<mkdir dir="${generated.src.dir}"/>
<xjc schema="${schemas.dir}/rally-1.21.xsd" target="2.0" removeOldOutput="true"
destdir="${generated.src.dir}" package="com.rallydev.xml">
<depends dir="${schemas.dir}" includes="rally-1.21.xsd"/>
<produces dir="${generated.src.dir}/com/rallydev/xml" includes="**/*.java"/>
</xjc>
<xjc schema="${schemas.dir}/story-list.xsd" target="2.0" removeOldOutput="true"
destdir="${generated.src.dir}" package="standup.xml">
<depends dir="${schemas.dir}" includes="story-list.xsd"/>
<produces dir="${generated.src.dir}/standup/xml" includes="**/*.java"/>
</xjc>
</target>
<target name="bootstrap"
description="===> update external dependencies, compile schemas, etc."
depends="update-ivy,xml-sources,eclipse">
</target>
<target name="api-docs"
description="===> generate API documentation">
<mkdir dir="${javadoc.dir}"/>
<javadoc
destdir="${javadoc.dir}"
private="true"
sourcepath="${src.dir}:${generated.src.dir}"
classpathref="build.classpath"
overview="${docs.dir}/overview.html">
<group title="Application Entry Points" packages="standup.application"/>
<group title="Domain Model" packages="standup.xml"/>
<group title="Connectors" packages="standup.connector:standup.connector.*"/>
<group title="Rally Web Service API" packages="com.rallydev.*"/>
<group title="Tests" packages="tests:tests.*"/>
<link href="http://java.sun.com/javase/6/docs/api/"/>
<link href="http://java.sun.com/javaee/6/docs/api/"/>
<link href="http://hc.apache.org/httpcomponents-client/httpclient/apidocs/"/>
</javadoc>
</target>
<target name="schema-docs"
description="===> generate XML Schema documentation">
<xslt basedir="${schemas.dir}" destdir="${schema.docs.dir}"
extension=".html" style="${tools.dir}/xs3p.xsl">
<param name="title" expression="Story List XML Schema"/>
<include name="story-list.xsd"/>
</xslt>
</target>
<target name="docs"
description="===> build all documentation"
depends="schema-docs,api-docs"/>
<target name="eclipse"
description="===> generate an Eclipse project">
<mkdir dir="${generated.src.dir}"/>
<mkdir dir="${ivy.lib.dir}"/>
<eclipse mode="java" updatealways="true">
<project name="${ant.project.name}"/>
<classpath>
<output path="${eclipse.build.dir}/classes"/>
<source path="${src.dir}"/>
<source path="${web.src.dir}" output="${eclipse.build.dir}/web"/>
<source path="${test.src.dir}" output="${eclipse.build.dir}/tests"/>
<source path="${generated.src.dir}" output="${eclipse.build.dir}/generated"/>
<library pathref="default.classpath"/>
<library path="${config.dir}/main"/>
<library path="${config.dir}/test"/>
</classpath>
</eclipse>
</target>
<target name="compile"
description="===> compile all classes"
depends="xml-sources">
<mkdir dir="${classes.dir}"/>
<javac target="1.6" debug="true"
destdir="${classes.dir}" includeantruntime="false">
<src path="${src.dir}"/>
<src path="${web.src.dir}"/>
<src path="${generated.src.dir}"/>
<classpath refid="build.classpath"/>
</javac>
</target>
<target name="jar"
description="===> build a JAR of all classes"
depends="compile">
<jar destfile="${jar.path}" basedir="${classes.dir}">
<fileset dir="${classes.dir}" includes="**/*.class" excludes="**/web/**/*.class"/>
<fileset dir="${config.dir}/main" includes="*.properties"/>
<zipfileset dir="${schemas.dir}" prefix="schemas" includes="**/*.xsd"/>
<zipfileset dir="${xsl.dir}" prefix="xslt" includes="**/*.xsl"/>
</jar>
</target>
<target name="war"
description="===> build a WAR of classes and their dependencies"
depends="compile">
<war destfile="${war.path}">
<webinf dir="${web.src.dir}/WEB-INF"/>
<zipfileset dir="${schemas.dir}" prefix="schemas"/>
<zipfileset dir="${xsl.dir}" prefix="xslt"/>
<zipfileset dir="${web.rsrc.dir}"/>
<classes dir="${classes.dir}"/>
<classes dir="${config.dir}/main" includes="*.properties"/>
<classes dir="${config.dir}/web" includes="*.properties"/>
<lib dir="${lib.dir}"/>
<lib dir="${ivy.lib.dir}"/>
</war>
</target>
<target name="compile-tests"
description="===> compile the test code"
depends="compile">
<mkdir dir="${test.classes.dir}"/>
<javac target="1.6" debug="true"
destdir="${test.classes.dir}" includeantruntime="false">
<src path="${test.src.dir}"/>
<classpath refid="build.classpath"/>
<classpath path="${classes.dir}"/>
</javac>
</target>
<target name="test-jar"
description="===> build the jar contain unit tests and test data"
depends="compile-tests">
<jar destfile="${test.jar.path}" basedir="${test.classes.dir}">
<fileset dir="${test.classes.dir}" includes="**/*.class"/>
<fileset dir="${config.dir}/test" includes="*.properties"/>
<zipfileset dir="${test.src.dir}/test-data" prefix="test-data"/>
</jar>
</target>
<target name="clean"
description="===> removes intermediate generated files">
<delete dir="${build.dir}" deleteonexit="true"/>
<delete file="coverage.ec" deleteonexit="true"/>
</target>
<target name="real-clean"
description="===> remove all generated files"
depends="clean">
<delete dir="${output.dir}" deleteonexit="true"/>
<delete dir="${javadoc.dir}" deleteonexit="true"/>
<delete dir="${report.dir}" deleteonexit="true"/>
<delete dir="${schema.docs.dir}" deleteonexit="true"/>
</target>
<target name="dist-clean"
description="===> remove all non-repository files"
depends="real-clean">
<delete dir="${generated.src.dir}" deleteonexit="true"/>
<delete file="${basedir}/.project" deleteonexit="true"/>
<delete file="${basedir}/.classpath" deleteonexit="true"/>
<delete dir="${basedir}/.settings" deleteonexit="true"/>
<delete dir="${ivy.lib.dir}" deleteonexit="true"/>
<mkdir dir="${ivy.lib.dir}"/>
</target>
<target name="test"
description="===> run the test classes"
depends="jar, test-jar">
<mkdir dir="${junit.report.dir}"/>
<emma enabled="${emma.enabled}">
<instr destdir="${instr.classes.dir}/standup" mode="copy"
metadatafile="${coverage.dir}/metadata.emma"
merge="true">
<instrpath>
<pathelement location="${classes.dir}/standup"/>
</instrpath>
</instr>
</emma>
<junit printsummary="true" fork="true" forkmode="once">
<formatter type="plain"/>
<formatter type="xml"/>
<classpath>
<pathelement location="${instr.classes.dir}"/>
<path refid="run.classpath"/>
<path refid="emma.path"/>
</classpath>
<batchtest fork="yes" todir="${junit.report.dir}">
<fileset dir="${test.src.dir}" includes="**/*Test.java"/>
</batchtest>
<jvmarg value="-Demma.coverage.out.file=${coverage.dir}/coverage.emma"/>
<jvmarg value="-Demma.coverage.out.merge=true"/>
</junit>
<junitreport todir="${junit.report.dir}">
<fileset dir="${junit.report.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${junit.report.dir}/html"/>
</junitreport>
<emma enabled="${emma.enabled}">
<report sourcepath="${src.dir}">
<fileset dir="${coverage.dir}">
<include name="*.emma"/>
</fileset>
<txt outfile="${coverage.report.dir}/coverage.txt"/>
<html outfile="${coverage.report.dir}/coverage.html"/>
</report>
</emma>
</target>
<target name="run"
description="===> run the command-line application"
depends="jar">
<java fork="true"
classname="standup.application.RetrieveStoriesByID"
classpathref="run.classpath">
<!--arg value="-v"/-->
<arg value="-u"/> <arg value="${rally.user}"/>
<arg value="-p"/> <arg value="${rally.password}"/>
<arg value="-o"/> <arg value="retrieve-stories.pdf"/>
<arg value="US4270"/>
<arg value="US4182"/>
<arg value="US4188"/>
<arg value="US2888"/>
</java>
</target>
<!--
The following is a twisted but quite functional way of incorporating Emma
into the overall process.
-->
<target name="emma"
description="===> enable Emma by mixing this in">
<mkdir dir="${coverage.dir}"/>
<mkdir dir="${coverage.report.dir}"/>
<property name="emma.enabled" value="true"/>
<property name="instr.classes.dir" value="${build.dir}/instr"/>
</target>
</project>
<!-- vim: set tabstop=2 shiftwidth=2 columns=110: -->