-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
355 lines (326 loc) · 17 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
345
346
347
348
349
350
351
352
353
354
355
<project name="jmockit" basedir="." default="minimalRebuild">
<property name="JUNIT_JAR" value="lib/junit-dep-4.11.jar"/>
<property name="TESTNG_JAR" value="lib/testng-6.8.jar"/>
<taskdef resource="testngtasks" classpath="${TESTNG_JAR}"/>
<loadfile property="version" srcFile="version.txt"/>
<path id="common.classpath">
<fileset dir="lib" includes="*.jar"/>
</path>
<target name="minimalRebuild" depends="buildMain, buildCoverage, createjars"/>
<target name="fullRebuild" depends="buildMain, buildCoverage, createjars, createjavadocs, buildSamples"/>
<!-- Targets for building/compiling the several JMockit components (modules) -->
<macrodef name="build">
<attribute name="module"/>
<attribute name="srcdir" default="src"/>
<attribute name="outdir" default="classes"/>
<attribute name="extraclasspathLocation" default=""/>
<attribute name="extraclasspath" default="none"/>
<sequential>
<delete dir="@{module}/@{outdir}" includes="**/*" quiet="true"/>
<mkdir dir="@{module}/@{outdir}"/>
<javac
srcdir="@{module}/@{srcdir}" destdir="@{module}/@{outdir}" includeantruntime="false"
source="1.5" target="1.5" debug="true" nowarn="true" excludes="**/package-info.java">
<classpath refid="common.classpath"/>
<classpath location="main/classes"/>
<classpath location="@{module}/classes"/>
<classpath location="@{module}/@{outdir}"/>
<classpath location="@{extraclasspathLocation}"/>
<classpath><fileset dir="." includes="@{extraclasspath}"/></classpath>
</javac>
<copy todir="@{module}/@{outdir}">
<fileset dir="@{module}/@{srcdir}" includes="**/*.properties, **/*.css, **/*.js, **/*.png, **/*.zip"/>
</copy>
</sequential>
</macrodef>
<macrodef name="buildTests">
<attribute name="module"/>
<attribute name="extraclasspathLocation" default=""/>
<attribute name="extraclasspath" default=""/>
<sequential>
<build
module="@{module}" srcdir="test" outdir="test-classes"
extraclasspathlocation="@{extraclasspathLocation}" extraclasspath="@{extraclasspath}"/>
</sequential>
</macrodef>
<target name="buildMain">
<build module="main"/><buildTests module="main"/>
</target>
<target name="buildCoverage" depends="buildMain">
<build module="coverage"/><buildTests module="coverage"/>
</target>
<target name="buildIncremental" depends="buildCoverage">
<build module="incremental" extraclasspathlocation="coverage/classes"/>
</target>
<target name="buildHibernateEmulation">
<build module="hibernate3emul"/>
<buildTests module="hibernate3emul"/>
</target>
<macrodef name="buildSample">
<attribute name="module"/>
<attribute name="jdkVersion" default="1.6"/>
<attribute name="outdir" default="classes"/>
<attribute name="testLibrary" default="${JUNIT_JAR}"/>
<attribute name="extraclasspathLocation" default=""/>
<attribute name="extraclasspath" default="none"/>
<sequential>
<delete dir="samples/@{module}/@{outdir}" includes="**/*.class" quiet="true"/>
<mkdir dir="samples/@{module}/@{outdir}"/>
<javac
srcdir="samples/@{module}/src" destdir="samples/@{module}/@{outdir}" includeantruntime="false"
source="@{jdkVersion}" target="@{jdkVersion}" debug="true" nowarn="true" excludes="**/package-info.java">
<classpath refid="common.classpath"/>
<classpath>
<fileset dir="samples/@{module}/lib" includes="*.jar" erroronmissingdir="false"/>
</classpath>
<classpath location="@{extraclasspathLocation}"/>
<classpath><fileset dir="." includes="@{extraclasspath}"/></classpath>
</javac>
<delete dir="samples/@{module}/test-classes" includes="**/*.class" quiet="true"/>
<mkdir dir="samples/@{module}/test-classes"/>
<javac
srcdir="samples/@{module}/test" destdir="samples/@{module}/test-classes" includeantruntime="false"
source="@{jdkVersion}" target="@{jdkVersion}" debug="true" nowarn="true">
<classpath refid="common.classpath"/>
<classpath location="jmockit.jar"/>
<classpath location="@{testLibrary}"/>
<classpath>
<fileset dir="samples/@{module}/lib" includes="*.jar" erroronmissingdir="false"/>
</classpath>
<classpath location="samples/@{module}/@{outdir}"/>
<classpath location="@{extraclasspathLocation}"/>
<classpath><fileset dir="." includes="@{extraclasspath}"/></classpath>
</javac>
</sequential>
</macrodef>
<target name="buildEasyMock">
<buildSample module="easymock" extraclasspath="samples/lib/easymock*.jar"/>
</target>
<target name="buildJMock">
<buildSample module="jmock" extraclasspath="lib/hamcrest-*.jar samples/lib/jmock*.jar"/>
</target>
<target name="buildMockito">
<buildSample
module="mockito" extraclasspath="lib/hamcrest-*.jar samples/lib/hamcrest-*.jar samples/lib/mockito*.jar"/>
</target>
<target name="buildUnitils">
<buildSample module="unitils" extraclasspath="samples/lib/unitils*.jar"/>
</target>
<target name="buildPowerMock">
<buildSample module="powermock" extraclasspath="lib/*.jar samples/lib/dom4j-*.jar"/>
</target>
<target name="buildJBossAOP"><buildSample module="jbossaop" jdkVersion="1.5"/></target>
<target name="buildLoginService">
<buildSample module="LoginService" testlibrary="${TESTNG_JAR}"/>
</target>
<target name="buildTutorial"><buildSample module="tutorial"/></target>
<target name="buildOrderManagement" depends="buildHibernateEmulation, createjar-hibernate3emul">
<buildSample
module="orderMngmntWebapp" outdir="WEB-INF/classes"
extraclasspathlocation="hibernate3emul/jmockit-hibernate3emul.jar"/>
</target>
<target name="buildTimingFramework">
<buildSample module="TimingFramework" extraclasspath="lib/hamcrest-*.jar"/>
</target>
<target name="buildAnimatedTransitions">
<buildSample module="AnimatedTransitions" extraclasspathLocation="samples/TimingFramework/classes"/>
</target>
<target name="buildTourDeMock">
<buildSample
module="tourdemock"
extraclasspath="samples/lib/easymock*.jar samples/lib/jmock*.jar samples/lib/mockito*.jar
samples/lib/unitils*.jar samples/lib/org.springframework.*.jar"/>
</target>
<target name="buildFakingXMocking">
<buildSample module="fakingXmocking" jdkVersion="1.7" extraclasspath="samples/lib/mockito*.jar"/>
</target>
<target
name="buildSamples"
depends="buildEasyMock, buildJMock, buildMockito, buildUnitils, buildPowerMock, buildLoginService,
buildJBossAOP, buildTutorial, buildOrderManagement, buildTimingFramework,
buildAnimatedTransitions, buildTourDeMock, buildFakingXMocking"/>
<!-- Target for generating the Javadoc HTML documentation -->
<target name="createjavadocs">
<delete dir="www/javadoc" includes="**/*.html" excludes="overview.html" quiet="true"/>
<javadoc
destdir="www/javadoc" overview="www/javadoc/overview.html"
classpathref="common.classpath" classpath="main/classes"
nodeprecated="true" noindex="true" notree="true" nohelp="true" breakiterator="yes"
windowtitle="JMockit Toolkit API" doctitle="JMockit Toolkit API Documentation"
encoding="UTF-8" charset="UTF-8" locale="en">
<arg line="-notimestamp -quiet"/>
<fileset dir="${basedir}/main/src">
<include name="mockit/*.java"/>
<include name="mockit/integration/junit4/*.java"/>
<include name="mockit/integration/testng/*.java"/>
<include name="mockit/integration/logging/*.java"/>
</fileset>
<link href="http://download.oracle.com/javase/6/docs/api" offline="true" packagelistloc="www/javadoc/external"/>
<header><![CDATA[<a href="http://code.google.com/p/jmockit" target="_top"><img src="resources/logo.png">JMockit Home</a>]]></header>
<footer><![CDATA[<a href="http://code.google.com/p/jmockit" target="_top"><img src="resources/logo.png">JMockit Home</a>]]></footer>
<bottom><![CDATA[<font size=-1>© 2006-2012 Rogério Liesenfeld</font>]]></bottom>
</javadoc>
<delete file="www/javadoc/constant-values.html"/>
</target>
<!-- Targets for generating component jars and the distribution zip file -->
<target name="createjars" depends="createjar-main, createjar-coverage"/>
<target name="createjar-main">
<jar destfile="jmockit.jar">
<fileset file="LICENSE.txt"/>
<fileset dir="main/src" includes="mockit/**/*.java **/attach/**/*.java org/junit/**/*.java junit/*/*.java"/>
<fileset
dir="main/classes" includes="mockit/**/*.class **/attach/**/*.class org/junit/**/*.class junit/*/*.class"/>
<manifest>
<attribute name="Premain-Class" value="mockit.internal.startup.Startup"/>
<attribute name="Agent-Class" value="mockit.internal.startup.Startup"/>
<attribute name="Can-Redefine-Classes" value="true"/>
<attribute name="Implementation-Version" value="${version}"/>
</manifest>
<service type="org.testng.ITestNGListener" provider="mockit.integration.testng.Initializer"/>
</jar>
</target>
<target name="createjar-coverage">
<jar destfile="jmockit-coverage.jar">
<fileset file="LICENSE.txt"/>
<fileset dir="coverage/src" includes="mockit/coverage/**/*.java"/>
<fileset
dir="coverage/classes" includes="jmockit.properties mockit/coverage/**/*.class **/*.css **/*.js **/*.png"/>
<fileset dir="main/classes" includes="mockit/external/asm4/*.class"/>
<manifest>
<attribute name="Main-Class" value="mockit.coverage.CodeCoverage"/>
<attribute name="Premain-Class" value="mockit.coverage.standalone.Startup"/>
<attribute name="Can-Redefine-Classes" value="true"/>
<attribute name="Implementation-Version" value="${version}"/>
</manifest>
</jar>
</target>
<target name="createjar-incremental">
<jar destfile="incremental/jmockit-incremental.jar" basedir="incremental/classes">
<manifest><attribute name="Class-Path" value="jmockit-coverage.jar"/></manifest>
</jar>
</target>
<target name="createjar-hibernate3emul">
<jar destfile="hibernate3emul/jmockit-hibernate3emul.jar" basedir="hibernate3emul/classes">
<manifest><attribute name="Class-Path" value="../jmockit.jar"/></manifest>
</jar>
</target>
<target name="createjar-multicore">
<jar destfile="multicore/jmockit-multicore.jar">
<fileset file="LICENSE.txt"/>
<fileset dir="multicore/src" includes="**/*.java"/>
<fileset dir="multicore/classes"/>
<manifest><attribute name="Class-Path" value="../jmockit.jar"/></manifest>
</jar>
</target>
<target name="createzip">
<zip
destfile="jmockit-${version}.zip" basedir=".." includes="jmockit/**"
excludes="**/*.i*, jmockit/*.zip, **/*.ser, **/Temp.java, jmockit/**/lib/**,
**/target/**, **/classes/**, **/test-classes/**, **/test-output/**,
jmockit/hibernate3emul/**, jmockit/incremental/**, jmockit/multicore/**,
jmockit/www/tutorial/Incremental*.*,
jmockit/main/JMockitTests.html, jmockit/samples/JMockitSampleTests.html,
jmockit/coverage/coverage-report/**, jmockit/samples/**/coverage-report/**,
jmockit/main/coverage-report/**, jmockit/coverage-report/**, **/testRun.properties"
encoding="UTF-8"/>
</target>
<target name="createLibsZip">
<zip destfile="jmockit-libs.zip" basedir="." includes="**/lib/**"/>
</target>
<!-- Targets for running tests and generating corresponding test reports in HTML -->
<macrodef name="testReport">
<attribute name="name"/>
<sequential>
<junitreport>
<fileset dir="." includes="TEST-*.xml"/>
<report format="noframes" styledir="${ant.home}/etc"/>
</junitreport>
<delete dir="." includes="TEST*-*.xml" quiet="true"/>
<move file="junit-noframes.html" tofile="@{name}.html"/>
</sequential>
</macrodef>
<target name="tests">
<junit fork="yes" forkmode="once" dir="main">
<jvmarg value="-javaagent:../jmockit.jar"/>
<sysproperty key="jmockit-mocks" value="mockit.integration.logging.Slf4jMocks"/>
<classpath refid="common.classpath"/>
<classpath location="main/test-classes"/>
<classpath location="main/classes"/>
<batchtest>
<fileset dir="main/test-classes">
<include name="**/*Test.class"/>
<exclude name="**/*CodeUnderTest.class"/>
<exclude name="**/Base*Test.class"/>
<exclude name="mockit/integration/testng/*Test.class"/>
<exclude name="**/MockStateBetweenTestMethodsNGTest.class"/>
<exclude name="**/ExecutingTest.class"/>
<exclude name="**/OverlappingStubsAndMocksTest.class"/>
</fileset>
</batchtest>
<formatter type="xml"/>
</junit>
<testReport name="main/JMockitTests"/>
<testng workingdir="main">
<classpath refid="common.classpath"/>
<classpath path="jmockit.jar"/>
<classpath>
<pathelement location="main/test-classes"/>
</classpath>
<classfileset
dir="main/test-classes"
includes="mockit/integration/testng/*Test.class **/MockStateBetweenTestMethodsNGTest.class"
excludes="mockit/integration/testng/BaseTestNGDecoratorTest.class
mockit/integration/testng/TestNGViolatedExpectationsTest.class"/>
</testng>
</target>
<target name="sampleTests">
<junit fork="yes" forkmode="once" dir="samples" showoutput="true">
<classpath path="jmockit.jar"/>
<classpath path="jmockit-coverage.jar"/>
<sysproperty key="jmockit-coverage-output" value="serial"/>
<classpath refid="common.classpath"/>
<classpath>
<fileset dir="samples" includes="**/lib/*.jar"/>
<pathelement location="hibernate3emul/jmockit-hibernate3emul.jar"/>
<dirset dir="samples">
<include name="*/classes"/>
<include name="*/WEB-INF/classes"/>
<include name="*/test-classes"/>
</dirset>
</classpath>
<batchtest>
<fileset dir="samples/jbossaop/test-classes" includes="**/*Test.class"/>
<fileset dir="samples/easymock/test-classes" includes="**/*Test.class"/>
<fileset dir="samples/jmock/test-classes" includes="**/*Test.class"/>
<fileset dir="samples/mockito/test-classes" includes="**/*Test.class"/>
<fileset dir="samples/unitils/test-classes" includes="**/*Test.class"/>
<fileset dir="samples/powermock/test-classes" includes="**/*Test.class"/>
<fileset dir="samples/orderMngmntWebapp/test-classes" includes="**/*Test.class"/>
<fileset dir="samples/tutorial/test-classes" includes="**/*Test.class"/>
<fileset dir="samples/TimingFramework/test-classes" includes="**/*Test.class" excludes="end2end/*"/>
<fileset dir="samples/AnimatedTransitions/test-classes" includes="**/*Test.class"/>
<fileset dir="samples/tourdemock/test-classes" includes="**/*Test.class"/>
<fileset dir="samples/fakingXmocking/test-classes"
includes="**/*Test.class" excludes="**/*IntegrationTest.class"/>
</batchtest>
<formatter type="xml"/>
</junit>
<testReport name="samples/JMockitSampleTests"/>
<property name="sampleDir" value="samples/LoginService"/>
<testng workingdir="${sampleDir}">
<classpath refid="common.classpath"/>
<classpath path="jmockit.jar"/>
<classpath path="jmockit-coverage.jar"/>
<sysproperty key="jmockit-coverage-output" value="serial"/>
<classpath>
<fileset dir="samples" includes="lib/*.jar"/>
<pathelement location="${sampleDir}/classes"/>
<pathelement location="${sampleDir}/test-classes"/>
</classpath>
<classfileset dir="${sampleDir}/test-classes" includes="**/*Test.class"/>
</testng>
<java fork="yes" dir="samples" jar="jmockit-coverage.jar">
<arg line="-Djmockit-coverage-output=html . LoginService"/>
</java>
</target>
</project>