forked from unclebob/fitnesse
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
378 lines (330 loc) · 16.2 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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
<project name="Fitnesse" default="all" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<description>
Fitnesse is a wiki wrapper for fit, an acceptance test framework.
</description>
<property environment="env"/>
<property name="env.FITNESSE_TEST_PORT" value="8080"/>
<property name="src.dir" location="src"/>
<property name="test.src.dir" location="test"/>
<property name="classes.dir" location="classes"/>
<property name="test.classes.dir" location="test-classes"/>
<property name="fitnesseRoot" value="FitNesseRoot"/>
<property name="results.dir" location="test-results"/>
<property name="dist.dir" location="dist"/>
<property name="javadoc.dir" location="javadoc"/>
<property name="lib.dir" location="lib"/>
<property name="antlib.dir" location="antlib"/>
<property name="port" value="8001"/>
<target name="all" depends="unit_tests, acceptance_tests" description="Run this target any time you change code or acceptance tests. It will clean, then compile the source, run all the unit test and fitnesse acceptance tests."/>
<target name="build" depends="clean, compile" description="clean, then compile the source"/>
<target name="unit_tests" depends="clean, unit_test" description="builds code from scratch, runs all the unit tests"/>
<zipfileset id="wikipages.fileset" prefix="Resources/FitNesseRoot" dir="FitNesseRoot">
<include name="FitNesse/**"/>
<include name="FrontPage/**"/>
<include name="PageHeader/**"/>
<include name="PageFooter/**"/>
<include name="TemplateLibrary/**"/>
<exclude name="**/*.zip"/>
</zipfileset>
<target name="run" depends="compile, compile-bootstrap-less, retrieve" description="Start FitNesse from the command line">
<ivy:cachepath pathid="standalone.classpath" conf="standalone"/>
<java classname="fitnesseMain.FitNesseMain" fork="true" failonerror="true">
<arg value="-o" />
<arg value="-v" />
<arg value="-p" />
<arg value="${port}" />
<classpath>
<path refid="standalone.classpath"/>
<pathelement location="${classes.dir}"/>
</classpath>
</java>
</target>
<!--
Bundling
-->
<target name="jar" depends="compile, compile-bootstrap-less, createUpdateLists" description="generate the jar file">
<defaultexcludes remove="**/.gitignore"/>
<mkdir dir="${dist.dir}" />
<delete file="${dist.dir}/fitnesse.jar" />
<jar jarfile="${dist.dir}/fitnesse.jar" basedir="${classes.dir}">
<include name="**" />
<zipfileset refid="wikipages.fileset" />
<manifest>
<attribute name="Built-By" value="Object Mentor, Inc." />
<attribute name="Main-Class" value="fitnesseMain.FitNesseMain" />
</manifest>
</jar>
</target>
<target name="standalone-jar" depends="jar" description="generate the standalone jar file">
<ivy:cachefileset setid="standalone.jar.fileset" conf="standalone" />
<!-- Create a temporary file, so we can remove all META-INF stuff when packaging the real thing -->
<zip destfile="${dist.dir}/.fitnesse-standalone-jar-dependencies.tmp">
<zipgroupfileset refid="standalone.jar.fileset" />
</zip>
<jar destfile="${dist.dir}/fitnesse-standalone.jar">
<zipfileset src="${dist.dir}/fitnesse.jar" />
<zipfileset src="${dist.dir}/.fitnesse-standalone-jar-dependencies.tmp" excludes="META-INF/**" />
<manifest>
<attribute name="Built-By" value="Object Mentor, Inc." />
<attribute name="Main-Class" value="fitnesseMain.FitNesseMain" />
</manifest>
</jar>
<delete file="${dist.dir}/.fitnesse-standalone-jar-dependencies.tmp" />
</target>
<target name="sources-jar" depends="stamp-version">
<jar jarfile="${dist.dir}/fitnesse-sources.jar" basedir="src">
<include name="**" />
<zipfileset refid="wikipages.fileset" />
</jar>
</target>
<target name="javadoc-jar" depends="compile">
<mkdir dir="${javadoc.dir}" />
<javadoc sourcepath="${src.dir}" destdir="${javadoc.dir}" classpathref="compile.classpath" />
<jar jarfile="${dist.dir}/fitnesse-javadoc.jar" basedir="${javadoc.dir}" />
</target>
<target name="createUpdateLists" depends="compile" description="creates two lists of files to be updated">
<mkdir dir="${classes.dir}/Resources/FitNesseRoot" />
<java classpath="${classes.dir}" classname="fitnesse.updates.UpdateFileList" failonerror="true">
<arg value="-baseDirectory:." />
<arg value="-outputDirectory:${classes.dir}/Resources" />
<arg value="-doNotReplace:FitNesseRoot/FrontPage/content.txt" />
<arg value="-doNotReplace:FitNesseRoot/FrontPage/properties.xml" />
<arg value="-doNotReplace:FitNesseRoot/PageHeader/content.txt" />
<arg value="-doNotReplace:FitNesseRoot/PageHeader/properties.xml" />
<arg value="-doNotReplace:FitNesseRoot/PageFooter/content.txt" />
<arg value="-doNotReplace:FitNesseRoot/PageFooter/properties.xml" />
<arg value="-doNotReplace:FitNesseRoot/PageFooter/properties.xml" />
<arg value="-doNotReplace:FitNesseRoot/TemplateLibrary/content.txt" />
<arg value="-doNotReplace:FitNesseRoot/TemplateLibrary/properties.xml" />
<arg value="-doNotReplace:FitNesseRoot/TemplateLibrary/StaticPage/content.txt" />
<arg value="-doNotReplace:FitNesseRoot/TemplateLibrary/StaticPage/properties.xml" />
<arg value="-doNotReplace:FitNesseRoot/TemplateLibrary/SuitePage/content.txt" />
<arg value="-doNotReplace:FitNesseRoot/TemplateLibrary/SuitePage/properties.xml" />
<arg value="-doNotReplace:FitNesseRoot/TemplateLibrary/TestPage/content.txt" />
<arg value="-doNotReplace:FitNesseRoot/TemplateLibrary/TestPage/properties.xml" />
<arg value="-doNotReplace:FitNesseRoot/.gitignore" />
<arg value="FitNesseRoot/FitNesse" />
<arg value="FitNesseRoot/FrontPage" />
<arg value="FitNesseRoot/PageFooter" />
<arg value="FitNesseRoot/PageHeader" />
<arg value="FitNesseRoot/TemplateLibrary" />
<arg value="FitNesseRoot/.gitignore" />
</java>
<copy file="FitNesseRoot/.gitignore" todir="${classes.dir}/Resources/FitNesseRoot" />
<replace file="${classes.dir}/Resources/FitNesseRoot/.gitignore" token="###" value="" />
</target>
<!--
Building
-->
<target name="compile" depends="compile-fit,compile-slim,compile-server" description="compile all FitNesse sources">
</target>
<target name="compile-server" depends="stamp-version, resolve" description="compile FitNesse sources">
<mkdir dir="${classes.dir}" />
<ivy:cachepath pathid="compile.classpath" conf="default"/>
<javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true" source="1.6" target="1.6" includeantruntime="false">
<classpath>
<path refid="compile.classpath"/>
</classpath>
</javac>
<copy todir="${classes.dir}">
<fileset dir="${src.dir}">
<include name="fitnesse/resources/**" />
<include name="**/*.properties" />
</fileset>
</copy>
</target>
<target name="compile-fit" description="compile FIT sources only">
<mkdir dir="${classes.dir}" />
<javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true" source="1.6" target="1.6" includeantruntime="false">
<include name="fit/**/*.java"/>
<include name="util/*.java"/>
</javac>
</target>
<target name="compile-slim" depends="resolve" description="compile SLIM sources only">
<mkdir dir="${classes.dir}" />
<ivy:cachepath pathid="slim.classpath" conf="slim"/>
<javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="slim.classpath" debug="true" source="1.6" target="1.6" includeantruntime="false">
<include name="fitnesse/html/*.java"/>
<include name="fitnesse/slim/**/*.java"/>
<include name="fitnesse/socketservice/*.java"/>
<include name="util/*.java"/>
</javac>
</target>
<target name="test-compile" depends="compile" description="compile the tests">
<mkdir dir="${test.classes.dir}" />
<ivy:cachepath pathid="test.classpath" conf="test"/>
<javac srcdir="${test.src.dir}" destdir="${test.classes.dir}" debug="true" source="1.6" target="1.6" includeantruntime="false" >
<classpath>
<path refid="test.classpath"/>
<pathelement location="${classes.dir}"/>
</classpath>
</javac>
</target>
<target name="post-compile" depends="stamp-version, retrieve" description="post-compile steps, use those in your IDE" />
<target name="bootstrap-needs-update">
<uptodate property="bootstrap-css-up-to-date" targetfile="${classes.dir}/fitnesse/resources/bootstrap/css/fitnesse-bootstrap.css" >
<srcfiles dir="${src.dir}/fitnesse/resources/bootstrap/less" includes="*.less" />
</uptodate>
</target>
<target name="compile-bootstrap-less" depends="ivy-init, bootstrap-needs-update" description="compile bootstrap less.js scripts" unless="bootstrap-css-up-to-date">
<mkdir dir="${classes.dir}/fitnesse/resources/bootstrap/css" />
<ivy:cachepath pathid="lesscss.classpath" conf="lesscss" />
<java classname="org.mozilla.javascript.tools.shell.Main"
classpathref="lesscss.classpath"
failonerror="true"
fork="true"
output="${classes.dir}/fitnesse/resources/bootstrap/css/fitnesse-bootstrap.css">
<arg value="extra/lesscss/less-rhino-1.7.0.js" />
<arg value="${src.dir}/fitnesse/resources/bootstrap/less/fitnesse-bootstrap.less" />
</java>
</target>
<condition property="phantomjs-present">
<or>
<available file="/usr/local/bin/phantomjs" />
<available file="/usr/bin/phantomjs" />
</or>
</condition>
<target name="jasmine" description="Runs Javascript Unit Tests" if="phantomjs-present">
<exec executable="phantomjs" failonerror="true">
<arg line="extra/phantomjs/run-jasmine.js" />
<arg line="src/fitnesse/resources/javascript/javascript-test.html" />
</exec>
<exec executable="phantomjs" failonerror="true">
<arg line="extra/phantomjs/run-jasmine.js" />
<arg line="src/fitnesse/resources/wysiwyg/wysiwyg-test.html" />
</exec>
</target>
<target name="set-version-if-not-manualy-set" unless="version">
<tstamp />
<property name="version" value="${DSTAMP}" />
</target>
<target name="stamp-version" depends="set-version-if-not-manualy-set" >
<echo message="Stamping fitnesse with version ${version}" />
<mkdir dir="${classes.dir}/META-INF" />
<echo message="v${version}" file="${classes.dir}/META-INF/FitNesseVersion.txt" />
</target>
<target name="clean" description="delete everything in the classes directory">
<delete dir="${classes.dir}" />
<delete dir="${test.classes.dir}" />
<delete dir="${results.dir}" />
<delete dir="${lib.dir}" />
<delete dir="${dist.dir}" />
<delete dir="${javadoc.dir}" />
<delete file="updateList"/>
<delete file="updateDoNotCopyOverList"/>
</target>
<target name="unit_test" depends="test-compile" description="run the unit tests">
<mkdir dir="${results.dir}" />
<junit forkmode="once" fork="yes" printsummary="no" haltonfailure="yes" haltonerror="yes" dir="${basedir}">
<classpath>
<path refid="compile.classpath" />
<path refid="test.classpath" />
<pathelement location="${classes.dir}" />
<pathelement location="${test.classes.dir}" />
</classpath>
<formatter type="xml" usefile="true" />
<formatter type="plain" usefile="false" />
<batchtest todir="${results.dir}">
<fileset dir="${test.src.dir}">
<include name="**/*Test.java" />
</fileset>
</batchtest>
</junit>
</target>
<target name="release" depends="unit_tests, acceptance_tests" />
<target name="release_xml" depends="unit_tests, acceptance_tests_xml" />
<target name="release_jar" depends="unit_tests, jar, standalone-jar, sources-jar, javadoc-jar"/>
<target name="acceptance_tests_xml" depends="standalone-jar">
<java jar="${dist.dir}/fitnesse-standalone.jar" failonerror="true" fork="true" output="fitnesse-results.xml">
<arg value="-c" />
<arg value="FitNesse.SuiteAcceptanceTests?suite&format=xml" />
</java>
</target>
<target name="acceptance_tests" depends="standalone-jar">
<java jar="${dist.dir}/fitnesse-standalone.jar" failonerror="true" fork="true">
<arg value="-c" />
<arg value="FitNesse.SuiteAcceptanceTests?suite&format=text" />
</java>
</target>
<target name="retrieve" depends="resolve" description="Copy dependencies to lib/, mainly for Acceptance tests and IDE's">
<ivy:retrieve pattern="${lib.dir}/[artifact].[ext]" conf="standalone,default,test" />
</target>
<target name="dependencies" depends="resolve" description="Generate a dependencies graph">
<ivy:report conf="default,standalone,test,maven" todir="dependencies" />
</target>
<target name="resolve" depends="ivy-init">
<ivy:resolve />
</target>
<target name="install" depends="set-version-if-not-manualy-set,jar,sources-jar" description="Install FitNesse in a local Ivy repository">
<ivy:deliver deliverpattern="${dist.dir}/ivy.xml" pubrevision="${version}" status="integration" />
<ivy:publish resolver="local"
pubrevision="${version}"
overwrite="true" conf="default">
<ivy:artifacts pattern="${dist.dir}/[artifact](-[classifier]).[ext]" />
</ivy:publish>
</target>
<target name="pom" depends="resolve,set-version-if-not-manualy-set">
<ivy:deliver deliverpattern="${dist.dir}/ivy.xml" pubrevision="${version}" status="release" />
<ivy:makepom ivyfile="${dist.dir}/ivy.xml" templatefile="extra/maven/pom.xml.template" pomfile="${dist.dir}/fitnesse.pom" conf="maven,default,test">
<ivy:mapping conf="maven" scope="compile" />
<ivy:mapping conf="test" scope="test" />
</ivy:makepom>
</target>
<target name="snapshot" depends="pom,jar,standalone-jar,sources-jar,javadoc-jar" description="Publish a snapshot to oss.sonatype.org">
<ivy:settings id="ivy.publish.instance"
file="ivysettings-sonatype.xml" />
<ivy:publish resolver="sonatype-nexus-snapshots"
settingsref="ivy.publish.instance"
pubrevision="${version}-SNAPSHOT"
publishivy="false"
overwrite="true" conf="maven">
<ivy:artifacts pattern="${dist.dir}/[artifact](-[classifier]).[ext]" />
</ivy:publish>
</target>
<target name="publish" depends="pom,jar,standalone-jar,sources-jar,javadoc-jar" description="Publish a release to oss.sonatype.org">
<fail unless="upload.user" message="supply upload.user on the command line"/>
<fail unless="upload.password" message="supply upload.password on the command line"/>
<fail unless="pgp.password" message="supply pgp.password on the command line"/>
<ivy:settings id="ivy.publish.instance"
file="ivysettings-sonatype.xml" />
<ivy:publish resolver="sonatype-nexus-staging"
settingsref="ivy.publish.instance"
pubrevision="${version}"
publishivy="false"
overwrite="true" conf="maven">
<ivy:artifacts pattern="${dist.dir}/[artifact](-[classifier]).[ext]" />
</ivy:publish>
</target>
<!--
Dependency management boilerplate
-->
<property name="maven.central.url" value="http://repo2.maven.org/maven2" />
<available file="${antlib.dir}/ivy.jar" type="file" property="have.ivy.jar"/>
<available file="${antlib.dir}/bcprov.jar" type="file" property="have.bcprov.jar"/>
<available file="${antlib.dir}/bcpg.jar" type="file" property="have.bcpg.jar"/>
<condition property="ivy.download.not.required">
<and>
<istrue value="${have.ivy.jar}" />
<istrue value="${have.bcprov.jar}" />
<istrue value="${have.bcpg.jar}" />
</and>
</condition>
<target name="ivy-init" depends="ivy-download">
<path id="ivy.class.path">
<fileset dir="${antlib.dir}">
<include name="*.jar"/>
</fileset>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant"
classpathref="ivy.class.path" />
</target>
<target name="ivy-download" unless="ivy.download.not.required">
<mkdir dir="${antlib.dir}" />
<get src="${maven.central.url}/org/apache/ivy/ivy/2.4.0/ivy-2.4.0.jar" dest="${antlib.dir}/ivy.jar" usetimestamp="true" verbose="true" />
<!-- The following libs are used for signing artifacts
when deployed to Maven Central. -->
<get src="${maven.central.url}/org/bouncycastle/bcprov-jdk16/1.46/bcprov-jdk16-1.46.jar" dest="${antlib.dir}/bcprov.jar" usetimestamp="true" verbose="true" />
<get src="${maven.central.url}/org/bouncycastle/bcpg-jdk16/1.46/bcpg-jdk16-1.46.jar" dest="${antlib.dir}/bcpg.jar" usetimestamp="true" verbose="true" />
</target>
</project>