-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.xml
279 lines (248 loc) · 11.6 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
<project name="strutstestcase" default="all" basedir=".">
<!-- ================ Initialize Property Values ================ -->
<!-- set jikes as the java compiler -->
<property name="build.compiler" value="modern"/>
<!-- set the release version -->
<property name="major.version" value="2"/>
<property name="minor.version" value="1"/>
<property name="point.version" value="4"/>
<property name="release.version" value="${major.version}${minor.version}${point.version}"/>
<property name="jar.name" value="strutstest-${major.version}.${minor.version}.${point.version}.jar"/>
<!-- targets this build for different Servlet specs -->
<!-- uncomment or set on the ant command line -->
<!-- <property name="build_2.2" value="true" />-->
<!-- <property name="build_2.4" value="true" />-->
<!-- points to the top of a test application server -->
<!-- used for automatic deployment of the test code -->
<property name="appserver.home" value="/Users/deryl/develop/resin-3.0.8"/>
<!-- compile options defaults -->
<property name="comp.deprecate" value="off"/>
<property name="comp.debug" value="on"/>
<property name="comp.optimize" value="off"/>
<property name="comp.depend" value="on"/>
<property name="comp.verbose" value="off"/>
<property name="comp.source" value="1.3"/>
<property name="comp.target" value="1.3"/>
<!-- important directories -->
<property name="build.dir" value="${basedir}/build"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="distribute.dir" value="${basedir}/dist/strutstest"/>
<property name="doc.dir" value="${distribute.dir}/docs"/>
<property name="test.dir" value="${basedir}/test-results"/>
<property name="temp.dir" value="${basedir}/temp"/>
<property name="lib.dir" value="${basedir}/lib"/>
<!-- set class.path to use with javac/jikes -->
<!-- ====================== Build Targets ====================== -->
<!-- intialize build -->
<target name="init">
<condition property="servlet.version" value="2.2">
<isset property="build_2.2"/>
</condition>
<condition property="servlet.version" value="2.4">
<isset property="build_2.4"/>
</condition>
<condition property="servlet.version" value="2.3">
<and>
<not><isset property="build_2.2"/></not>
<not><isset property="build_2.4"/></not>
</and>
</condition>
<condition property="build_2.3" value="true">
<and>
<not><isset property="build_2.2"/></not>
<not><isset property="build_2.4"/></not>
</and>
</condition>
<echo message="servlet version = ${servlet.version}"/>
<property name="struts.version" value="1.2"/>
<path id="class.path">
<fileset dir="${lib.dir}">
<include name="*.jar"/>
<include name="*.zip"/>
<exclude name="servletapi-2.3.jar" if="build_2.2"/>
<exclude name="servletapi-2.4.jar" if="build_2.2"/>
<exclude name="servletapi-2.2.jar" if="build_2.3"/>
<exclude name="servletapi-2.4.jar" if="build_2.3"/>
<exclude name="servletapi-2.2.jar" if="build_2.4"/>
<exclude name="servletapi-2.3.jar" if="build_2.4"/>
<exclude name="cactus-13-1.7.jar" if="build_2.2"/>
<exclude name="cactus-12-1.7.jar" unless="build_2.2"/>
</fileset>
<pathelement location="${build.dir}"/>
</path>
</target>
<!-- Compile the application classes -->
<target name="build" depends="init" description="compile all Java classes">
<mkdir dir="${build.dir}"/>
<javac srcdir="${src.dir}"
destdir="${build.dir}"
deprecation="${comp.deprecate}"
debug="${comp.debug}"
optimize="${comp.optimize}"
verbose="${comp.verbose}"
depend="${comp.depend}"
source="${comp.source}"
target="${comp.target}">
<classpath refid="class.path"/>
<include name="**/*.java"/>
<excludesfile name="excludes-${struts.version}-${servlet.version}"/>
</javac>
</target>
<!-- package the application for deployment. -->
<target name="package" description="package all Java classes">
<mkdir dir="${distribute.dir}"/>
<jar jarfile="${distribute.dir}/${jar.name}">
<fileset dir="${build.dir}" includes="**/*.class" excludes="**/examples/**,**/tests/**"/>
</jar>
<war warfile="test.war" webxml="${src.dir}/examples/WEB-INF/web.xml">
<webinf dir="${src.dir}/examples/WEB-INF">
<exclude name="web.xml"/>
</webinf>
<webinf dir="${src.dir}/examples/cactus">
<include name="cactus.properties"/>
</webinf>
<lib dir="${lib.dir}">
<exclude name="cactus-13-1.7.jar" if="build_2.2"/>
<exclude name="cactus-12-1.7.jar" unless="build_2.2"/>
<exclude name="servletapi*.jar" />
<exclude name="ant*.jar"/>
</lib>
<lib dir="${distribute.dir}" includes="${jar.name}"/>
<classes dir="${build.dir}" includes="**/tests/**,**/examples/**"/>
<classes dir="${src.dir}">
<include name="examples/ApplicationResources.properties"/>
<include name="log4j.properties"/>
</classes>
<classes dir="${src.dir}/examples/cactus">
<include name="cactus.properties"/>
</classes>
<fileset dir="${src.dir}/examples">
<include name="login/**"/>
<include name="main/**"/>
</fileset>
</war>
</target>
<!-- prepare code for public release -->
<target name="release" depends="init,package,docs">
<echo message="creating release for servlet v${servlet.version} and struts v${struts.version}.."/>
<zip zipFile="${basedir}/strutstest${release.version}-${struts.version}_${servlet.version}.zip" basedir="${basedir}/dist"/>
</target>
<target name="release.src" depends="clean">
<zip zipFile="${basedir}/strutstest-${release.version}-src.zip" basedir="${basedir}">
<exclude name="*.zip"/>
<exclude name="lib/*.jar"/>
</zip>
</target>
<!-- Clean up the build -->
<target name="clean" description="remove all build products">
<delete dir="${build.dir}"/>
<delete dir="${basedir}/dist"/>
<delete dir="${test.dir}"/>
<delete file="${basedir}/test.war"/>
<delete>
<fileset dir="${basedir}" includes="strutstest*.zip"/>
</delete>
</target>
<!-- Generate Javadocs for the application -->
<target name="docs" description="compile documentation for all Java classes">
<mkdir dir="${doc.dir}/api"/>
<copy file="${basedir}/howto.htm" toDir="${doc.dir}"/>
<copy file="${basedir}/faq.htm" toDir="${doc.dir}"/>
<copy file="${basedir}/stylesheet.css" toDir="${doc.dir}"/>
<copy file="${basedir}/LICENSE.TXT" toDir="${distribute.dir}"/>
<copy file="${basedir}/README.TXT" toDir="${distribute.dir}"/>
<mkdir dir="${distribute.dir}/examples"/>
<copy todir="${distribute.dir}/examples">
<fileset dir="${src.dir}/examples" excludes="**/tiles*.xml"/>
</copy>
<javadoc packagenames="servletunit,servletunit.struts"
sourcepath="${src.dir}"
destdir="${doc.dir}/api"
author="true"
version="true"
use="true"
windowtitle="StrutsTestCase Documentation"
doctitle="<H1>StrutsTestCase for JUnit</H1>"
bottom="<i>Copyright © Deryl Seale All Rights Reserved.</i>">
<group title="StrutsTestCase for JUnit" packages="servletunit.struts"/>
<group title="ServletUnit Mock Object Framework" packages="servletunit"/>
<!-- Put in links to JDK classes -->
<link offline="true"
href="http://java.sun.com/products/j2se/1.3/docs/api/"
packagelistLoc="http://java.sun.com/products/jdk/1.3/docs/api"/>
<link offline="true"
href="http://java.sun.com/j2ee/sdk_1.3/techdocs/api/"
packagelistLoc="http://java.sun.com/j2ee/sdk_1.3/techdocs/api/"/>
</javadoc>
<copy todir="${distribute.dir}/examples" file="test.war"/>
</target>
<!-- Run unit tests -->
<target name="test" description="run all mock object tests">
<mkdir dir="${test.dir}"/>
<junit printsummary="yes" haltonfailure="no">
<sysproperty key="test.dir" value="${test.dir}"/>
<sysproperty key="basedir" value="${basedir}"/>
<classpath refid="class.path"/>
<classpath>
<pathelement location="${src.dir}/examples/"/>
<pathelement location="${src.dir}/"/>
</classpath>
<formatter type="xml"/>
<batchtest fork="yes" todir="${test.dir}">
<fileset dir="${build.dir}">
<include name="**/examples/**/Test*.class"/>
<include name="**/servletunit/struts/Test*.class"/>
<include name="**/tests/**/Test*.class"/>
<exclude name="**/cactus/**"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="${test.dir}">
<fileset dir="${test.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${test.dir}"/>
</junitreport>
</target>
<target name="test.cactus" description="run all cactus tests">
<mkdir dir="${test.dir}"/>
<junit printsummary="yes" haltonfailure="no">
<sysproperty key="test.dir" value="${test.dir}"/>
<sysproperty key="basedir" value="${basedir}"/>
<classpath refid="class.path"/>
<classpath>
<pathelement location="${src.dir}/"/>
<pathelement location="${src.dir}/examples/cactus"/>
</classpath>
<formatter type="xml"/>
<batchtest fork="yes" todir="${test.dir}">
<fileset dir="${build.dir}">
<include name="**/cactus/**/Test*.class"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="${test.dir}">
<fileset dir="${test.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${test.dir}"/>
</junitreport>
</target>
<target name="deploy" depends="package">
<copy todir="${appserver.home}/webapps" file="${basedir}/test.war" overwrite="true"/>
</target>
<target name="update.struts">
<tstamp/>
<delete dir="${temp.dir}"/>
<mkdir dir="${temp.dir}"/>
<get src="http://svn.apache.org/builds/jakarta-struts/nightly/struts-${DSTAMP}.zip"
dest="${temp.dir}/jakarta-struts-nightly.zip"
verbose="false"/>
<unzip src="${temp.dir}/jakarta-struts-nightly.zip" dest="${temp.dir}"/>
<copy file="${temp.dir}/struts-${DSTAMP}/lib/struts.jar" tofile="${lib.dir}/struts-1.2.jar" overwrite="true"/>
<delete dir="${temp.dir}"/>
</target>
<!-- Run all the build targets -->
<target name="all" description="build the StrutsTestCase library" depends="clean,build,package,deploy"/>
<target name="auto.build" depends="clean,update.struts,build,test,package,deploy,test.cactus"/>
</project>