forked from jmockit/jmockit1
/
build.xml
254 lines (241 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2006-2015 Rogério Liesenfeld
~ This file is subject to the terms of the MIT license (see LICENSE.txt).
-->
<project name="jmockit" basedir="." default="printDirections">
<taskdef resource="testngtasks" classpath="lib/testng-6.8.jar"/>
<taskdef
name="jacocoReport" classname="org.jacoco.ant.ReportTask"
classpath="../../Java/jacoco-0.7.3/lib/jacocoant.jar"/>
<loadfile property="version" srcFile="version.txt"/>
<path id="common.classpath">
<fileset dir="lib" includes="*.jar"/>
</path>
<target name="printDirections">
<echo>
Please use main/pom.xml for building the main library (jmockit.jar, with the mocking APIs).
For the coverage tool (jmockit-coverage.jar), use coverage/pom.xml.
For the sample test suites, use samples/pom.xml.
In any case, the Maven build must run on JDK 1.8.
</echo>
</target>
<target name="createjavadocs">
<property name="api" value="../jmockit.github.io/api1x"/>
<delete dir="${api}" includes="**/*.html" excludes="overview.html" quiet="true"/>
<delete dir="${api}/resources" includes="*.gif" quiet="true"/>
<delete file="${api}/stylesheet.css"/>
<javadoc
destdir="${api}" overview="${api}/overview.html"
classpathref="common.classpath" classpath="main/classes"
nodeprecated="false" noindex="true" notree="true" nohelp="true" breakiterator="yes"
windowtitle="JMockit Toolkit API"
encoding="UTF-8" charset="UTF-8" locale="en">
<arg line="-notimestamp -quiet -Xdoclint:none"/>
<fileset dir="${basedir}/main/src">
<include name="mockit/*.java"/>
<include name="mockit/integration/junit4/*.java"/>
</fileset>
<link href="http://docs.oracle.com/javase/8/docs/api/" offline="true" packagelistloc="${api}/external"/>
<doctitle><![CDATA[
<a href="http://jmockit.org" target="_top"><img src="resources/logo.png" style="vertical-align:middle">
JMockit</a>
- API Documentation
]]></doctitle>
<header><![CDATA[
<a href="http://jmockit.org" target="_top">
<img src="resources/logo.png" style="padding:4px;vertical-align:middle">JMockit Home</a>
]]></header>
<footer><![CDATA[
<a href="http://jmockit.org" target="_top">
<img src="resources/logo.png" style="padding:4px;vertical-align:middle">JMockit Home</a>
]]></footer>
</javadoc>
<delete file="${api}/constant-values.html"/>
<replace dir="${api}/mockit" includes="*.html" token="resources/logo.png" value="../resources/logo.png"/>
<replace
dir="${api}/mockit/integration/junit4" includes="*.html"
token="resources/logo.png" value="../../../resources/logo.png"/>
<replace dir="${api}" includes="*.html">
<replacetoken><![CDATA[</head>]]></replacetoken>
<replacevalue><![CDATA[<link rel="shortcut icon" type="image/x-icon" href="resources/favicon.ico">
</head>]]></replacevalue>
</replace>
<replace dir="${api}/mockit" includes="*.html">
<replacetoken><![CDATA[</head>]]></replacetoken>
<replacevalue><![CDATA[<link rel="shortcut icon" type="image/x-icon" href="../resources/favicon.ico">
</head>]]></replacevalue>
</replace>
<replace dir="${api}/mockit/integration" includes="*/*.html">
<replacetoken><![CDATA[</head>]]></replacetoken>
<replacevalue><![CDATA[<link rel="shortcut icon" type="image/x-icon" href="../../../resources/favicon.ico">
</head>]]></replacevalue>
</replace>
</target>
<target name="createjars" depends="createjar-main, createjar-coverage"/>
<target name="createjar-main">
<delete file="jmockit.jar"/>
<jar destfile="jmockit.jar">
<fileset file="LICENSE.txt"/>
<fileset file="NOTICE.txt"/>
<fileset dir="main/src" includes="mockit/**/*.java **/attach/**/*.java org/junit/**/*.java"/>
<fileset dir="main/classes" includes="mockit/**/*.class **/attach/**/*.class org/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="Can-Retransform-Classes" value="true"/>
<attribute name="Implementation-Version" value="${version}"/>
</manifest>
<service
type="org.testng.ITestNGListener" provider="mockit.integration.testng.internal.TestNGRunnerDecorator"/>
</jar>
</target>
<target name="createjar-coverage">
<delete file="jmockit-coverage.jar"/>
<jar destfile="jmockit-coverage.jar">
<fileset file="LICENSE.txt"/>
<fileset file="NOTICE.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">
<include name="mockit/external/asm/*.class"/>
<include name="mockit/internal/util/ClassLoad.class"/>
<include name="mockit/internal/util/StackTrace.class"/>
<include name="mockit/internal/state/TestRun.class"/>
<include name="mockit/internal/state/MockFixture.class"/>
<include name="mockit/internal/startup/Startup.class"/>
</fileset>
<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="Can-Retransform-Classes" value="true"/>
<attribute name="Implementation-Version" value="${version}"/>
</manifest>
</jar>
</target>
<target name="createzip">
<zip
destfile="../artifacts1x/jmockit-${version}.zip"
basedir=".." includes="jmockit1.org/**, jmockit.github.io/**"
excludes="jmockit1.org/**/*.i*, jmockit.github.io/*.i*,
jmockit1.org/*.zip, jmockit1.org/**/*.ser, jmockit1.org/**/lib/**, jmockit1.org/build.xml,
jmockit1.org/**/target/**, jmockit1.org/**/classes/**, jmockit1.org/**/test-classes/**,
jmockit1.org/**/test-output/**, jmockit1.org/samples/javax.inject-tck/**,
jmockit1.org/**/coverage-report/**, jmockit1.org/**/jacoco.exec, jmockit1.org/**/*.html"
encoding="UTF-8"/>
</target>
<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">
<assertions><enable/></assertions>
<jvmarg value="-javaagent:../jmockit.jar"/>
<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"/>
</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"
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" printsummary="true">
<assertions><enable/></assertions>
<classpath path="jmockit.jar"/>
<classpath path="jmockit-coverage.jar"/>
<sysproperty key="coverage-output" value="serial"/>
<classpath refid="common.classpath"/>
<classpath>
<fileset dir="samples" includes="**/lib/*.jar"/>
<dirset dir="samples">
<include name="*/classes"/>
<include name="*/test-classes"/>
</dirset>
</classpath>
<batchtest>
<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"/>
</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="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">
<jvmarg line="-Djmockit-coverage-output=html"/>
<arg line=". LoginService"/>
</java>
<delete file="samples/coverage.ser"/>
<delete file="samples/LoginService/coverage.ser"/>
</target>
<target name="jacoco-report">
<property name="moduleDir" value="samples/mockito"/>
<jacocoReport>
<executiondata>
<file file="${moduleDir}/jacoco.exec"/>
</executiondata>
<structure name="JaCoCo Ant Example">
<classfiles>
<fileset dir="${moduleDir}/classes"/>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${moduleDir}/src"/>
</sourcefiles>
</structure>
<html destdir="${moduleDir}/jacoco-report"/>
</jacocoReport>
<delete file="${moduleDir}/jacoco.exec"/>
</target>
</project>