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
|
<?xml version="1.0"?>
<project name="IT Mill Toolkit" basedir="../" default="package">
<!-- Package creation - - - - - - - - - - - - - - - - - - - - - - - - - -->
<target name="package" depends="clean-all,libs,themes,demo,docs,license" description="Build public release">
<zip zipfile="build/result/${package-file-name}">
<fileset dir="build/result">
<patternset>
<include name="${product-file}-${version}/**" />
</patternset>
</fileset>
</zip>
</target>
<!-- As release, but no javadoc or docbook tasks -->
<target name="package-without-documentation" depends="clean-all,libs,themes,demo,package-docs,license" description="Build testing package without javadocs or manual">
<zip zipfile="build/result/TESTING-${package-file-name}">
<fileset dir="build/result">
<patternset>
<include name="${product-file}-${version}/**" />
</patternset>
</fileset>
</zip>
</target>
<!-- Initialization - - - - - - - - - - - - - - - - - - - - - - - - -->
<target name="init">
<!-- Create result dir unless already exists -->
<mkdir dir="build/result" />
<property file="build/VERSION" />
<property name="product-file" value="itmill-toolkit" />
<property name="product-name" value="IT Mill Toolkit" />
<property name="toolkit-package" value="com/itmill/toolkit" />
<property file="build/html-style.properties" />
<!-- Destination files -->
<property name="package-file-name" value="${product-file}-${version}.zip" />
<property name="lib-bin-jar-name" value="${product-file}-${version}.jar" />
<property name="demo-lib-jar-name" value="${product-file}-demo-${version}.jar" />
<property name="lib-src-jar-name" value="${product-file}-src-${version}.jar" />
<property name="themes-jar-name" value="${product-file}-themes-${version}.jar" />
<property name="demo-war-name" value="${product-file}-demo-${version}.war" />
<echo message="Prepared to build ${product-file} version ${version} packages" />
<!-- Output directory -->
<property name="output-dir" value="build/result/${product-file}-${version}" />
<mkdir dir="${output-dir}" />
<!-- Create Output Directory Hierarchy -->
<mkdir dir="${output-dir}/doc/manual" />
<mkdir dir="${output-dir}/doc/api" />
<mkdir dir="${output-dir}/lib" />
<mkdir dir="${output-dir}/demo" />
</target>
<!-- License - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<target name="license" depends="init">
<copy todir="${output-dir}/lib">
<fileset dir="WebContent/WEB-INF">
<exclude name="**/.svn" />
<include name="itmill-toolkit-license.xml" />
</fileset>
</copy>
</target>
<!-- Themes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<target name="themes" depends="init">
<copy todir="${output-dir}/lib/themes">
<fileset dir="WebContent/WEB-INF/lib/themes">
<exclude name="**/.svn" />
<include name="corporate/**/*" />
<include name="demo/**/*" />
<include name="base/**/*" />
<include name="example/**/*" />
</fileset>
</copy>
<!-- Brokes CSS, do not use
<echo>CSS syntax check and optimizing.</echo>
<for param="file">
<path>
<fileset dir="${output-dir}/lib/themes">
<include name="**/*.css" />
</fileset>
</path>
<sequential>
<echo>@{file}</echo>
<exec dir="build" executable="cmd.exe" os="Windows 2000, Windows XP" failonerror="true">
<arg line="/c bin\csstidy-win.exe @{file} @{file}" />
</exec>
<exec dir="build" executable="bin/csstidy-osx.sh" os="Mac OS X" failonerror="true">
<arg line="@{file}" />
</exec>
<exec dir="build" executable="bin/csstidy-linux.sh" os="Linux" failonerror="true">
<arg line="@{file}" />
</exec>
</sequential>
</for>
-->
<echo>JavaScript syntax check, optimizing and obfuscation.</echo>
<for param="file">
<path>
<fileset dir="${output-dir}/lib/themes">
<include name="**/*.js" />
</fileset>
</path>
<sequential>
<echo>@{file}</echo>
<!-- TODO: ERROR: for some reason this does not work on Windows platform, please fix! -->
<java dir="${output-dir}/lib/themes" jar="build/lib/custom_rhino.jar" fork="true" failonerror="true" maxmemory="64m" output="@{file}">
<arg value="-c" />
<arg value="@{file}" />
</java>
</sequential>
</for>
<fixcrlf srcdir="${output-dir}/lib/themes" includes="**/*.js **/*.css" eol="lf" eof="remove" />
<jar jarfile="${output-dir}/lib/${themes-jar-name}" compress="false">
<fileset dir="${output-dir}/lib/themes">
<patternset>
<include name="corporate/**/*" />
<include name="base/**/*" />
</patternset>
</fileset>
</jar>
</target>
<!-- Libs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Copy and preprocess sources for packaging -->
<target name="preprocess-src" depends="init">
<mkdir dir="build/result/src" />
<copy todir="build/result/src">
<filterset>
<filter token="VERSION" value="${version}" />
</filterset>
<fileset dir="src">
<patternset>
<include name="**/*.java" />
<include name="**/*.html" />
</patternset>
</fileset>
</copy>
<!-- Convert to CRLF's and tabs -->
<fixcrlf srcdir="build/result/src" eol="crlf" tablength="4" tab="remove" includes="**/*.java" />
<!-- Un-Filtered files -->
<copy todir="build/result/src">
<fileset dir="src">
<patternset>
<include name="**/*.gif" />
<include name="**/*.jpg" />
<include name="**/*.swf" />
<include name="**/*.png" />
</patternset>
</fileset>
</copy>
</target>
<target name="compile-java" depends="preprocess-src">
<!-- Compile -->
<mkdir dir="build/result/classes" />
<javac source="1.4" target="1.4" srcdir="build/result/src" destdir="build/result/classes" classpath="build/lib/servlet-api.jar" includes="${toolkit-package}/**" debug="true" />
</target>
<target name="libs" depends="compile-java">
<!-- Create binary JAR -->
<jar jarfile="${output-dir}/lib/${lib-bin-jar-name}" compress="true" includes="${toolkit-package}/**" basedir="build/result/classes" excludes="${toolkit-package}/demo/**" />
<!-- Create source JAR -->
<jar jarfile="${output-dir}/lib/${lib-src-jar-name}" compress="true">
<fileset dir="build/result/src">
<patternset>
<include name="${toolkit-package}/**/*.java" />
<exclude name="${toolkit-package}/demo/**/*.java" />
</patternset>
</fileset>
</jar>
</target>
<!-- Demo - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<target name="demo" depends="libs,compile-java,themes">
<echo>Building demo</echo>
<java2html srcdir="build/result/src/${toolkit-package}/demo" destdir="build/result/src/${toolkit-package}/demo" includes="**/*.java" style="eclipse" showLineNumbers="true" showFileName="true" showTableBorder="false" />
<!-- have to use "temp" dir for some reason here. Overwrite does not work, at least on Linux Eclipse 3.2.2 -->
<copy todir="build/result/srcTemp" overwrite="true">
<filterchain>
<expandproperties />
<replacetokens begintoken="<" endtoken=">">
<token key="body" value="${html.body.tag}${html.body.start1}${product-name}${html.body.start2}" />
<token key="/body" value="${html.body.end}${html.body.endtag}" />
<token key="head" value="${html.head.tag}${html.head.style}" />
</replacetokens>
</filterchain>
<fileset dir="build/result/src">
<exclude name="**/.svn" />
<include name="**/*.html" />
</fileset>
</copy>
<!-- Create demo binary JAR, including pictures -->
<mkdir dir="build/result/lib" />
<jar jarfile="build/result/lib/${demo-lib-jar-name}" includes="${toolkit-package}/demo/**" basedir="build/result/classes" compress="true">
<fileset dir="build/result/src">
<patternset>
<include name="${toolkit-package}/demo/**/*.swf" />
<include name="${toolkit-package}/demo/**/*.jpg" />
<include name="${toolkit-package}/demo/**/*.png" />
<include name="${toolkit-package}/demo/**/*.gif" />
</patternset>
</fileset>
</jar>
<!-- Copy demo directory (Jetty) -->
<copy todir="${output-dir}/demo">
<fileset dir="build/demo">
<exclude name="**/.svn" />
</fileset>
</copy>
<!-- Create demo WAR -->
<war warfile="${output-dir}/demo/${product-file}.war" webxml="WebContent/WEB-INF/web.xml">
<!-- WebContent: htmls, styles, license-->
<fileset dir="WebContent">
<exclude name="**/.svn" />
<exclude name="WEB-INF/web.xml" />
<exclude name="WEB-INF/lib/themes/**/*" />
<exclude name="WEB-INF/classes" />
<exclude name="WEB-INF/classes/**/*" />
<include name="**/*" />
</fileset>
<!-- Toolkit package and themes -->
<lib dir="${output-dir}/lib">
<include name="${lib-bin-jar-name}" />
<include name="${themes-jar-name}" />
</lib>
<!-- Demo package and themes -->
<lib dir="build/result/lib">
<include name="${demo-lib-jar-name}" />
</lib>
<lib dir="${output-dir}/lib">
<include name="themes/demo/**/*" />
<include name="themes/example/**/*" />
</lib>
<!-- All demo source and html source -->
<fileset dir="build/result">
<include name="src/${toolkit-package}/demo/**/*" />
</fileset>
</war>
<!-- Sources -->
<copy todir="${output-dir}/demo/src">
<fileset dir="build/result/src">
<include name="src/${toolkit-package}/demo/**/*" />
</fileset>
</copy>
</target>
<!-- Documentation- - - - - - - - - - - - - - - - - - - - - - - - - -->
<target name="docs" depends="javadoc,manual-pdf,manual-html,package-docs">
</target>
<target name="package-docs" depends="init">
<copy todir="${output-dir}">
<filterchain>
<expandproperties />
<replacetokens begintoken="<" endtoken=">">
<token key="body" value="${html.body.tag}${html.body.start1}${product-name}${html.body.start2}" />
<token key="/body" value="${html.body.end}${html.body.endtag}" />
</replacetokens>
</filterchain>
<fileset dir="">
<exclude name="**/.svn" />
<exclude name="ReleaseNotes.html" />
<include name="*.html" />
<include name="*.txt" />
</fileset>
</copy>
<copy todir="${output-dir}">
<fileset dir="">
<filename name="*.pdf" />
</fileset>
</copy>
<copy todir="${output-dir}">
<fileset dir="">
<filename name="ReleaseNotes.html" />
</fileset>
</copy>
<copy todir="${output-dir}/doc/manual/html-style">
<fileset dir="doc/manual/html-style">
<exclude name="**/.svn" />
<exclude name="**/test.html" />
</fileset>
</copy>
<copy todir="${output-dir}/doc">
<fileset dir="doc">
<exclude name="**/.svn" />
<include name="dtd/**/*.dtd" />
</fileset>
</copy>
</target>
<target name="javadoc" depends="preprocess-src">
<javadoc destdir="${output-dir}/doc/api" author="true" version="true" use="true" windowtitle="${product-name}" classpath="build/lib/servlet-api.jar">
<packageset dir="build/result/src">
<include name="${toolkit-package}/**" />
<exclude name="${toolkit-package}/demo/**" />
</packageset>
<doctitle>${javadoc.doctitle}</doctitle>
<!-- <header><![CDATA[<script type="text/javascript" src=".html-style/style.js"></script>]]></header> -->
<bottom>${javadoc.bottom}</bottom>
<link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/" packagelistLoc="build/javadoc/j2se-1.5.0" />
<link offline="true" href="http://java.sun.com/j2ee/1.4/docs/api/" packagelistLoc="build/javadoc/j2ee-1.4" />
</javadoc>
</target>
<target name="book-part2" depends="dbdoclet">
<!-- TODO Add XSLT to transform dbdoclet results to book part 2 -->
</target>
<target name="dbdoclet" depends="preprocess-src">
<javadoc access="public" charset="UTF-8" docencoding="UTF-8" encoding="ISO-8859-15" failonerror="yes" classpath="build/lib/servlet-api.jar" maxmemory="512m" source="1.5">
<packageset dir="build/result/src">
<include name="${toolkit-package}/**" />
<exclude name="${toolkit-package}/demo/**" />
</packageset>
<doclet name="org.dbdoclet.doclet.docbook.DocBookDoclet" path="build/lib/jdk${java.specification.version}/dbdoclet.jar">
<param name="-d" value="result/docbook" />
</doclet>
</javadoc>
</target>
<target name="manual-pdf" depends="init">
<!-- TODO Include XEP-based FO building in future -->
</target>
<target name="manual-html" depends="init">
<delete file="build/docbook/conf/temp.xsl" />
<copy file="build/docbook/conf/custom-html-docbook.xsl" tofile="build/docbook/conf/temp.xsl">
<filterchain>
<replacetokens>
<token key="BODYHEADER" value="${html.body.start1}${docbook.head.title}${html.body.start2}" />
<token key="BODYFOOTER" value="${html.body.end}" />
</replacetokens>
</filterchain>
</copy>
<path id="docbook-xsl.classpath">
<pathelement path="build/lib/fserializer.jar" />
<pathelement path="build/lib/xalan.jar" />
<pathelement path="build/lib/xercesImpl.jar" />
<pathelement path="build/lib/xml-apis.jar" />
</path>
<java classname="org.apache.xalan.xslt.Process" failonerror="yes" fork="yes" maxmemory="1300m">
<arg value="-in" />
<arg value="doc/manual/book.xml" />
<arg value="-xsl" />
<arg value="build/docbook/conf/temp.xsl" />
<arg value="-out" />
<arg value="${output-dir}/doc/manual/index.html" />
<arg value="-param" />
<arg value="use.extensions" />
<arg value="1" />
<classpath refid="docbook-xsl.classpath" />
</java>
<delete file="build/docbook/conf/temp.xsl" />
<copy todir="${output-dir}/doc/manual/img">
<fileset dir="doc/manual/img">
<exclude name="**/.svn" />
</fileset>
</copy>
</target>
<!-- Clean results - - - - - - - - - - - - - - - - - - - - - - - - - -->
<target name="clean-all" depends="">
<delete includeemptydirs="true" defaultexcludes="false">
<fileset dir="build/result" includes="**/*" />
</delete>
<delete file="build/docbook/conf/temp.xsl" />
</target>
<!-- ant contrib required for flow control (for loop) -->
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="build/lib/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
<!-- java2html converter -->
<taskdef name="java2html" classname="de.java2html.anttasks.Java2HtmlTask" classpath="build/lib/java2html.jar" />
</project>
|