forked from markmandel/coldspring
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
509 lines (425 loc) · 20.3 KB
/
build.xml
File metadata and controls
509 lines (425 loc) · 20.3 KB
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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2010 Mark Mandel
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="narwhal" default="deploy">
<!-- GENERAL PROPERTIES -->
<property name="src" location="./coldspring" />
<property name="tmp" location="/tmp" />
<property name="coldspring.version" value="2.0" />
<property name="coldspring.server" value="www.coldspringframework.org"/>
<property name="coldspring.server.schema" value="/Application/schema"/>
<property name="coldspring.sourceforge.server" value="web.sourceforge.net"/>
<property name="coldspring.sourceforge.webroot" value="/home/project-web/coldspring/htdocs" />
<property name="coldspring.sourceforge.docs" value="${coldspring.sourceforge.webroot}/ber/docs"/>
<property name="coldspring.sourceforge.files" value="frs.sourceforge.net"/>
<property name="coldspring.sourceforge.fileroot" value="/home/pfs/project/c/co/coldspring" />
<property name="coldspring.localserver" value="coldspring"/>
<property name="coldspring.localport" value="80"/>
<property name="coldspring.defaultcontext" value="/cf9"/>
<property name="test.results" location="./results"/>
<property name="docs" location="./docs"/>
<property name="docs.xsddoc" location="${docs}/xsd"/>
<property name="docs.api" location="${docs}/api"/>
<property name="xsddoc" location="${docs}/gen/xsddoc"/>
<property name="xsddoc.lib" location="${xsddoc}/lib"/>
<property name="xsddoc.templates" location="${xsddoc}/templates"/>
<property name="antlr.src" location="./antlr"/>
<property name="antlr.lib" location="${antlr.src}/lib"/>
<property name="antlr.jar" location="${src}/core/java/lib/" />
<property name="antlr.cp" location="${antlr.lib}/antlr-3.3-complete.jar"/>
<property name="antlr.results" location="${test.results}/antlr" />
<property name="varscoper.results" location="${test.results}/varscoper"/>
<property name="varscoper.filePath" value="${src}"/>
<property name="varscoper.url" value="${coldspring.localserver}:${coldspring.localport}${coldspring.defaultcontext}/varscoper/varScoper.cfm"/>
<property name="build" location="./build" />
<property name="uuid.file" location="./build.uuid" />
<taskdef name="mxunittask" classname="org.mxunit.ant.MXUnitAntTask" classpath="${build}/mxunit-ant.jar"/>
<taskdef resource="net/jtools/classloadertask/antlib.xml" classpath="${build}/ant-classloadertask.jar"/>
<classloader loader="system" classpath="${build}/commons-net-2.0.jar"/>
<taskdef name="ftp" classname="org.apache.tools.ant.taskdefs.optional.net.FTP"/>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${build}/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<!-- =================================
target: deploy-jenkins
================================= -->
<target name="integrate" description="script for continuous integration to run">
<antcall target="clean-results" />
<antcall target="aop-parser-test"/>
<antcall target="unittest"/>
<antcall target="varscoper"/>
<echo message="Unit Tests Passes, generating documentation" />
<antcall target="colddoc"/>
<antcall target="xsddoc"/>
</target>
<!-- =================================
target: deploy
================================= -->
<target name="deploy" depends="" description="Deploy the current build of ColdSpring">
<antcall target="upload-schemas"/>
<antcall target="xsddoc"/>
<antcall target="colddoc"/>
<antcall target="upload-documentation"/>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: varscoper
- - - - - - - - - - - - - - - - - -->
<target name="varscoper">
<mkdir dir="${test.results}/varscoper" />
<get src="http://${varscoper.url}?filePath=${varscoper.filePath}&submitButton=start&displayFormat=screen&recursiveDirectory=true&parseCfscript=true"
dest="${test.results}/varscoper/index.html" />
</target>
<!-- - - - - - - - - - - - - - - - - -
target: clean-results
- - - - - - - - - - - - - - - - - -->
<target name="clean-results">
<delete dir="${test.results}"/>
<mkdir dir="${test.results}"/>
</target>
<target name="generate-build-guid" description="Generates a Guid for this build, which Jenkins can fingerprint.">
<generateguid property="guid" />
<echo message="${guid}" file="${uuid.file}"/>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: unittest
- - - - - - - - - - - - - - - - - -->
<target name="unittest-async">
<antcall target="unittest-async-${suite.name}" />
</target>
<target name="unittest-async-cf9">
<antcall target="run-tests">
<param name="test.context" value="/cf9"/>
<param name="test.excludes" value="serial"/>
<param name="test.package" value="tests.cf9"/>
</antcall>
</target>
<target name="unittest-async-cf8">
<antcall target="run-tests">
<param name="test.context" value="/cf8"/>
<param name="test.excludes" value="cf9,serial"/>
<param name="test.package" value="tests.cf8"/>
</antcall>
</target>
<target name="unittest-async-railo">
<antcall target="run-tests">
<param name="test.context" value="/railo"/>
<param name="test.excludes" value="serial"/>
<param name="test.package" value="tests.railo"/>
</antcall>
</target>
<target name="unittest-async-cf10">
<antcall target="run-tests">
<param name="test.context" value="/cf10"/>
<param name="test.excludes" value="serial"/>
<param name="test.package" value="tests.cf10"/>
</antcall>
</target>
<target name="unittest-sync">
<antcall target="unittest-sync-${suite.name}" />
</target>
<target name="unittest-sync-cf9">
<antcall target="run-tests">
<param name="test.context" value="/cf9"/>
<param name="test.componentPath" value="unittests.serial"/>
<param name="test.package" value="tests.cf9"/>
</antcall>
</target>
<target name="unittest-sync-cf8">
<antcall target="run-tests">
<param name="test.context" value="/cf8"/>
<param name="test.componentPath" value="unittests.serial"/>
<param name="test.package" value="tests.cf8"/>
</antcall>
</target>
<target name="unittest-sync-railo">
<antcall target="run-tests">
<param name="test.context" value="/railo"/>
<param name="test.componentPath" value="unittests.serial"/>
<param name="test.package" value="tests.railo"/>
</antcall>
</target>
<target name="unittest-sync-cf10">
<antcall target="run-tests">
<param name="test.context" value="/cf10"/>
<param name="test.componentPath" value="unittests.serial"/>
<param name="test.package" value="tests.cf10"/>
</antcall>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: run-tests
- - - - - - - - - - - - - - - - - -->
<target name="run-tests">
<echo message="Running unit tests for ${test.context}"/>
<property name="test.results.path" location="${test.results}/tests"/>
<mkdir dir="${test.results.path}"/>
<property name="test.excludes" value=""/>
<property name="test.componentPath" value="unittests"/>
<propertyregex input="${test.componentPath}" property="test.directory" regexp="\." replace="/" global="true"
defaultvalue="${test.componentPath}"/>
<propertyregex input="${test.context}" property="test.package" regexp="/" replace="" />
<echo message="replaced: ${test.package}" />
<mxunittask server="${coldspring.localserver}" port="${coldspring.localport}"
mxunithome="${test.context}/mxunit"
haltonerror="false"
haltonfailure="false"
defaultrunner="${test.context}/unittests/HttpAntRunner.cfc"
verbose="true"
outputdir="${test.results.path}"
>
<directory path="/${test.directory}" componentpath="${test.componentPath}" recurse="true" excludes="${test.excludes}" packagename="${test.package}"/>
</mxunittask>
<junitreport todir="${test.results.path}">
<fileset dir="${test.results.path}">
<include name="*.xml"/>
</fileset>
<report format="frames" todir="${test.results.path}" styledir="${build}/xsl"/>
</junitreport>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: uploadSchemas
- - - - - - - - - - - - - - - - - -->
<target name="upload-schemas" description="upload schemas to the ColdSpring website">
<input addproperty="schema-upload.do" message="Should we upload the XSDs?" validargs="Y,N" />
<antcall target="upload-schemas-${schema-upload.do}" />
</target>
<target name="upload-schemas-Y">
<echo message="Uploading Schemas to ${coldspring.server}"/>
<input addproperty="upload.schema.user" message="What is the FTP Username?"></input>
<input addproperty="upload.schema.password" message="What is the FTP Password?"></input>
<ftp server="${coldspring.server}" userid="${upload.schema.user}" password="${upload.schema.password}"
remotedir="${coldspring.server.schema}" verbose="true">
<fileset file="${src}/beans/xml/config/coldspring-beans-${coldspring.version}.xsd"/>
<fileset file="${src}/beans/xml/config/coldspring-util-${coldspring.version}.xsd"/>
<fileset file="${src}/aop/config/coldspring-aop-${coldspring.version}.xsd"/>
<fileset file="${src}/transaction/config/coldspring-tx-${coldspring.version}.xsd"/>
<fileset file="${src}/orm/hibernate/config/coldspring-hibernate-${coldspring.version}.xsd"/>
</ftp>
</target>
<target name="upload-schemas-N"/>
<!-- - - - - - - - - - - - - - - - - -
target: colddoc
- - - - - - - - - - - - - - - - - -->
<target name="colddoc" depends="colddoc-clean">
<get src="http://${coldspring.localserver}:${coldspring.localport}${coldspring.defaultcontext}/docs/gen/colddoc/run.cfm" dest="${tmp}/colddoc.html" />
<loadfile property="colddoc.return" srcfile="${tmp}/colddoc.html"></loadfile>
<echo message="Colddoc: ${colddoc.return}"></echo>
<condition property="colddoc.complete">
<contains string="${colddoc.return}" substring="Done!" casesensitive="false" />
</condition>
<echo message="Colddoc: ${colddoc.complete}"></echo>
<antcall target="colddoc-${colddoc.complete}" />
</target>
<target name="colddoc-true"></target>
<target name="colddoc-false">
<fail message="Error with ColdDoc"/>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: colddoc-clean
- - - - - - - - - - - - - - - - - -->
<target name="colddoc-clean">
<delete dir="${docs.api}/coldspring"/>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: xsddoc
Generates each of the xsddoc generation
- - - - - - - - - - - - - - - - - -->
<target name="xsddoc" depends="xsddoc-clean">
<mkdir dir="${docs.xsddoc}/beans"/>
<!-- beans documentation -->
<property name="cp" value="${xsddoc.lib}/xml-apis.jar;${xsddoc.lib}/xercesImpl.jar;${xsddoc.lib}/docflex-xml-re.jar"/>
<!--
Execute the DocFlex/XML generator.
IMPORTANT: The 'maxmemory' attribute sets the maximum heap size
available to Java VM when running DocFlex/XML.
Check this attribute when you need to process large quantities of data
(e.g. when you generate documentation by XML schemas with a great number
of component definitions).
The 'fork' attribute forces Ant to launch a separate instance of JVM.
This is needed to ensure that the memory specified in the 'maxmemory'
attribute will be allocated indeed. However, you may remain using Ant's
JVM instance, if you have already specified for it that much of memory.
-->
<java classname="com.docflex.xml.Generator" classpath="${cp}" maxmemory="512m" fork="true">
<!-- specify the template -->
<arg value="-template"/>
<arg value="${xsddoc.templates}/XSDDoc/FramedDoc.tpl"/>
<!-- specify the output format -->
<arg value="-format"/>
<arg value="HTML"/>
<!-- specify the output directory -->
<arg value="-d"/>
<arg value="${docs.xsddoc}/beans"/>
<!-- specify to not launch the generator GUI -->
<arg value="-nodialog"/>
<!-- specify to not launch the default viewer for the output file -->
<arg value="-launchviewer=false"/>
<!-- pass the template parameter (the documentation title, in this case) -->
<arg value="-p:docTitle=ColdSpring ${coldspring.version} Schemas"/>
<arg value="-p:html.renderLineBreaks=true"/>
<!--
Specify the data source XML file to be processed by the specified template.
(In this case, it is the XML schema to be documented.)
Easiest to grab it all off the web, as then it all resolves nicely.
-->
<arg value="http://${coldspring.server}/schema/coldspring-beans-${coldspring.version}.xsd"/>
<arg value="http://${coldspring.server}/schema/coldspring-util-${coldspring.version}.xsd"/>
<arg value="http://${coldspring.server}/schema/coldspring-aop-${coldspring.version}.xsd"/>
<arg value="http://${coldspring.server}/schema/coldspring-tx-${coldspring.version}.xsd"/>
<arg value="http://${coldspring.server}/schema/coldspring-hibernate-${coldspring.version}.xsd"/>
</java>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: xsddoc-clean
- - - - - - - - - - - - - - - - - -->
<target name="xsddoc-clean">
<delete dir="${docs.xsddoc}/beans"/>
</target>
<target name="upload-documentation">
<input addproperty="upload-documentation.do" message="Should we upload the Documentation to Sourceforge?" validargs="Y,N" />
<antcall target="upload-documentation-${upload-documentation.do}" />
</target>
<target name="upload-documentation-N"/>
<target name="upload-documentation-Y">
<input addproperty="upload-documentation.user" message="What is the Sourceforge Username?"></input>
<echo message="Rsync Schemas from ${coldspring.sourceforge.server}"/>
<property name="rsync.line" value="-rv --delete --exclude=/gen ./ ${upload-documentation.user}@${coldspring.sourceforge.server}:${coldspring.sourceforge.docs}"/>
<echo message="rsync ${rsync.line}"/>
<exec executable="rsync" dir="${docs}" logerror="true">
<arg line="${rsync.line}"/>
</exec>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: aop-parser
- - - - - - - - - - - - - - - - - -->
<target name="build-aop-parser" depends="aop-parser-clean" description="Build the AOP Parser.">
<echo message="Generating Lexer & Parser"/>
<java classname="org.antlr.Tool" classpath="${antlr.cp}" fork="true" dir="${antlr.src}">
<arg value="-report"/>
<arg value="${antlr.src}/com/coldspring/aop/expression/AopExpression.g"/>
</java>
<javac classpath="${antlr.cp}" srcdir="${antlr.src}" debug="true" debuglevel="lines,vars,source">
</javac>
<jar destfile="${antlr.jar}/aop-parser.jar" basedir="${antlr.src}" >
<include name="**/*.class"/>
</jar>
</target>
<!-- =================================
target: aop-parser-test
================================= -->
<target name="aop-parser-test" description="Run the AOP Parser tests">
<mkdir dir="${antlr.results}" />
<echo message="Running gUnit Tests"/>
<!-- need this, as gunit was foobar'd on the 3.3 release -->
<property name="gunit.cp" location="${antlr.lib}/gunit-3.3.1-SNAPSHOT.jar"/>
<property name="aop-parser.cp" location="${src}/core/java/lib/aop-parser.jar"/>
<echo message="classpath: ${gunit.cp};${antlr.cp};${aop-parser.cp};"></echo>
<java classname="org.antlr.gunit.Interp" classpath="${gunit.cp};${antlr.cp};${aop-parser.cp};" fork="true" outputproperty="gunit.output">
<arg value="${antlr.src}/com/coldspring/aop/expression/AopExpression.gunit"/>
</java>
<echo message="${gunit.output}" />
<echo message="<pre>${gunit.output}</pre>" file="${antlr.results}/index.html" />
<if description="fail if there is failures in the ">
<not>
<contains string="${gunit.output}" substring="Failures: 0" />
</not>
<then>
<fail message="AOP Parser failed." />
</then>
</if>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: aop-parser-clean
- - - - - - - - - - - - - - - - - -->
<target name="aop-parser-clean">
<delete dir="${antlr.src}">
<include name="**/*.java"/>
<include name="**/*.class"/>
<include name="**/*.tokens"/>
</delete>
<delete dir="${antlr.src}/output"/>
</target>
<!-- =================================
target: release
================================= -->
<target name="release" depends="xsddoc,colddoc" description="description">
<input addproperty="release.user" message="Sourceforge username" />
<input addproperty="release.version" message="Version for release" defaultvalue="${coldspring.version}" />
<input addproperty="release.message" message="Tag message" />
<property name="release.sourceforge.docs" value="${coldspring.sourceforge.webroot}/${release.version}"/>
<property name="release.sourceforge.files" value="${coldspring.sourceforge.fileroot}/${release.version}"/>
<property name="release.dir" location="${tmp}/coldspring-release" />
<property name="release.dir.file" location="${release.dir}/files" />
<property name="release.dir.file.version" location="${release.dir.file}/${release.version}" />
<property name="release.filename" value="coldspring-v${release.version}.zip" />
<property name="release.dir.docs" location="${release.dir}/docs" />
<property name="release.dir.docs.version" location="${release.dir.docs}/${release.version}" />
<!-- clean it all up -->
<delete dir="${release.dir}" />
<!-- make directories -->
<mkdir dir="${release.dir.file.version}"/>
<mkdir dir="${release.dir.docs.version}"/>
<zip destfile="${release.dir.file.version}/${release.filename}" >
<zipfileset dir="${src}" prefix="coldspring"></zipfileset>
</zip>
<property name="rsync.line1" value="-rv --delete --exclude=/gen ./ ${release.dir.docs.version}/docs"/>
<echo message="rsync ${rsync.line1}"/>
<exec executable="rsync" dir="${docs}" logerror="true">
<arg line="${rsync.line1}"/>
</exec>
<echo message="Rsync documents to ${coldspring.sourceforge.server}"/>
<property name="rsync.line3" value="-rv --delete ${release.dir.docs.version}/ ${release.user}@${coldspring.sourceforge.server}:${release.sourceforge.docs}/"/>
<echo message="rsync ${rsync.line3}"/>
<exec executable="rsync" logerror="true">
<arg line="${rsync.line3}"/>
</exec>
<echo message="Rsync files to ${coldspring.sourceforge.files}"/>
<property name="rsync.line2" value="-rv --delete ${release.dir.file.version}/ ${release.user}@${coldspring.sourceforge.files}:${release.sourceforge.files}/"/>
<echo message="rsync ${rsync.line2}"/>
<exec executable="rsync" logerror="true">
<arg line="${rsync.line2}"/>
</exec>
<git command="tag">
<args>
<arg value="-a" />
<arg value="${release.version}" />
<arg value="-m ${release.message}" />
</args>
</git>
</target>
<!--
macro for git.
http://tlrobinson.net/blog/2008/11/13/ant-tasks-for-git/
-->
<macrodef name = "git">
<attribute name = "command" />
<attribute name = "dir" default = "" />
<element name = "args" optional = "true" />
<sequential>
<echo message = "git @{command}" />
<exec executable = "git" dir = "@{dir}">
<arg value = "@{command}" />
<args/>
</exec>
</sequential>
</macrodef>
<scriptdef name="generateguid" language="javascript">
<attribute name="property" />
<![CDATA[
importClass( java.util.UUID );
var uuid = UUID.randomUUID();
project.setProperty( attributes.get( "property" ), uuid );
]]>
</scriptdef>
</project>