This repository has been archived by the owner on Oct 20, 2023. It is now read-only.
/
build.xml
executable file
·202 lines (172 loc) · 7.72 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
<project name="reportng" default="dist" basedir=".">
<description>Reporting plug-in for TestNG.</description>
<!-- ==================================================================
GLOBAL BUILD PROPERTIES
=================================================================== -->
<property name="src.dir" location="./src"/>
<property name="java.dir" location="${src.dir}/java" />
<property name="templates.dir" location="${src.dir}/templates" />
<property name="lib.dir" location="./lib"/>
<property name="build.dir" location="./build"/>
<property name="classes.dir" location="${build.dir}/classes" />
<property name="dist.dir" location="./dist"/>
<property name="release.dir" location="./release" />
<property name="docs.dir" location="./docs"/>
<property name="api.dir" location="${docs.dir}/api" />
<property name="version" value="0.9.8"/>
<property name="artifact.identifier" value="reportng-${version}"/>
<!-- Classpath for compilation and tests. -->
<path id="base.path">
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</path>
<!-- ==================================================================
TARGETS FOR BUILDING THE SOFTWARE
=================================================================== -->
<!-- Builds everything from scratch. -->
<target name="all" depends="clean, dist" description="Builds everything, excluding docs, from scratch."/>
<!-- Deletes all directories and files created by the build process. -->
<target name="clean" description="Remove all files created by the build process." >
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
<delete dir="${release.dir}" />
<delete dir="${docs.dir}" />
</target>
<!-- Build all Java code. -->
<target name="compile" description="Compile the source." >
<mkdir dir="${classes.dir}/main" />
<javac destdir="${classes.dir}/main"
classpathref="base.path"
debug="on"
deprecation="on"
optimize="on"
source="1.5"
target="1.5"
srcdir="${java.dir}/main">
<include name="org/uncommons/**/*.java" />
<compilerarg line="-Xlint:unchecked" />
</javac>
<mkdir dir="${classes.dir}/test" />
<javac destdir="${classes.dir}/test"
classpathref="base.path"
debug="on"
deprecation="on"
optimize="on"
source="1.5"
target="1.5"
srcdir="${java.dir}/test">
<include name="org/uncommons/**/*.java" />
<compilerarg line="-Xlint:unchecked" />
<classpath>
<path location="${classes.dir}/main" />
</classpath>
</javac>
</target>
<!-- Build application JAR files. -->
<target name="jar" depends="compile" description="Create the application JAR files.">
<jar jarfile="${build.dir}/${artifact.identifier}.jar">
<fileset dir="${classes.dir}/main" >
<include name="org/uncommons/**/*.class" />
</fileset>
<fileset dir="${src.dir}" includes="templates/**/*" />
<manifest>
<attribute name="Class-Path" value="velocity-dep-1.4.jar"/>
</manifest>
</jar>
</target>
<!-- Copy all necessary files to deployment directory. -->
<target name="dist" depends="jar" description="Generate the deployment tree." >
<mkdir dir="${dist.dir}" />
<!-- Deploy all application JARs, libraries and config files. -->
<copy todir="${dist.dir}">
<fileset dir="${build.dir}" includes="**/*.jar" />
<fileset dir="${lib.dir}" includes="velocity*.jar" />
</copy>
</target>
<!-- Create the release artifacts. -->
<target name="release"
depends="clean, dist"
description="Creates the release archives.">
<mkdir dir="${release.dir}" />
<!-- Create a GZipped TAR file containing the built binaries, the API
documentation, and source code for the examples. -->
<tar destfile="${release.dir}/reportng-${version}.tgz"
compression="gzip"
longfile="gnu">
<tarfileset dir="${dist.dir}" prefix="${artifact.identifier}" includes="**/*" />
<!-- Don't forget to include the licence and other important information. -->
<tarfileset dir="." prefix="${artifact.identifier}" includes="*.txt" />
<!-- Include CSS files for optional customisation. -->
<tarfileset dir="${src.dir}/css" prefix="${artifact.identifier}/stylesheets" includes="*.css" />
</tar>
<!-- Also create a zip file release for the convenience of Windows users. -->
<zip destfile="${release.dir}/${artifact.identifier}.zip">
<zipfileset dir="${dist.dir}" prefix="${artifact.identifier}" includes="**/*" />
<!-- Don't forget to include the licence and other important information. -->
<zipfileset dir="." prefix="${artifact.identifier}" includes="*.txt" />
<!-- Include CSS files for optional customisation. -->
<zipfileset dir="${src.dir}/css" prefix="${artifact.identifier}/stylesheets" includes="*.css" />
</zip>
</target>
<target name="test" depends="jar" description="Run the unit tests.">
<mkdir dir="${build.dir}/test-results" />
<taskdef resource="testngtasks" classpathref="base.path"/>
<path id="test.path">
<pathelement location="${classes.dir}/test" />
<fileset dir="${build.dir}" includes="*.jar"/>
<path refid="base.path" />
</path>
<testng classpathref="test.path"
outputdir="${build.dir}/test-results"
haltonfailure="false"
useDefaultListeners="false"
listeners="org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter">
<xmlfileset dir="." includes="unittests.xml"/>
<sysproperty key="org.uncommons.reportng.title" value="ReportNG Unit Tests"/>
</testng>
</target>
<!-- Generate a sample report. -->
<target name="sample" depends="jar" description="Generate a sample test report.">
<mkdir dir="${build.dir}/sample" />
<taskdef resource="testngtasks" classpathref="base.path"/>
<path id="test.path">
<pathelement location="${classes.dir}/test" />
<fileset dir="${build.dir}" includes="*.jar"/>
<path refid="base.path" />
</path>
<testng classpathref="test.path"
outputdir="${build.dir}/sample"
haltonfailure="false"
useDefaultListeners="false"
listeners="org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter">
<xmlfileset dir="." includes="sample*.xml"/>
<sysproperty key="org.uncommons.reportng.coverage-report" value="http://cobertura.sourceforge.net/sample/"/>
<sysproperty key="org.uncommons.reportng.title" value="ReportNG Sample Report"/>
<sysproperty key="org.uncommons.reportng.xml-dialect" value="JUnit"/>
</testng>
<!-- Generate an HTML report from the JUnit XML. -->
<mkdir dir="${build.dir}/sample/xslt" />
<junitreport todir="${build.dir}/sample/xslt">
<fileset dir="${build.dir}/sample/xml">
<include name="*.xml"/>
</fileset>
<report format="frames" todir="${build.dir}/sample/xslt"/>
</junitreport>
</target>
<!-- ==================================================================
TARGETS FOR GENERATING DOCUMENTATION
=================================================================== -->
<target name="docs" description="Generate API documentation for Java code.">
<javadoc sourcepath="${java.dir}/main"
destdir="${api.dir}"
classpathref="base.path"
source="1.5" >
<packageset dir="${java.dir}" >
<include name="org/uncommons/**/*" />
</packageset>
<link href="http://java.sun.com/j2se/1.5.0/docs/api/" />
<link href="http://testng.org/javadocs/" />
</javadoc>
</target>
</project>