-
Notifications
You must be signed in to change notification settings - Fork 12
/
build.xml
401 lines (340 loc) · 17.4 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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
<?xml version="1.0"?>
<project name="Helma" default="usage" basedir=".">
<!-- =================================================================== -->
<!-- Initializes some variables -->
<!-- =================================================================== -->
<target name="init">
<property name="Name" value="helma"/>
<property name="year" value="1998-${year}"/>
<property name="version" value="1.7.4"/>
<property name="project" value="helma"/>
<property name="home.dir" value="."/>
<property name="build.dir" value="${home.dir}/build"/>
<property name="build.src" value="${home.dir}/src"/>
<property name="build.lib" value="${home.dir}/lib"/>
<property name="build.classes" value="${home.dir}/classes"/>
<property name="build.docs" value="${home.dir}/docs"/>
<property name="build.externals" value="${build.dir}/externals"/>
<property name="build.work" value="${home.dir}/work"/>
<property name="build.dist" value="${home.dir}/dist"/>
<property name="jar.name" value="${project}"/>
<property name="package.name" value="${project}-${version}"/>
<property name="core.name" value="${project}-core-${version}"/>
<property name="debug" value="on"/>
<property name="optimize" value="on"/>
<property name="deprecation" value="off"/>
<path id="build.class.path">
<fileset dir="${home.dir}/lib">
<exclude name="**/helma*.jar" />
<include name="**/*.jar" />
</fileset>
</path>
<tstamp/>
<filter token="year" value="${year}"/>
<filter token="version" value="${version}"/>
<filter token="date" value="${TODAY}"/>
</target>
<!-- =================================================================== -->
<!-- Help on usage -->
<!-- =================================================================== -->
<target name="help" depends="usage" />
<target name="usage">
<echo message=""/>
<echo message=""/>
<echo message="Helma build instructions"/>
<echo message="-------------------------------------------------------------"/>
<echo message=""/>
<echo message=" available targets are:"/>
<echo message=""/>
<echo message=" compile --> compiles the source code to ./classes"/>
<echo message=" jar --> generates the ./lib/helma-YYYYMMDD.jar file"/>
<echo message=" package --> generates the distribution (zip and tar.gz)"/>
<echo message=" app [name] --> gets an application from svn and zips it"/>
<echo message=" module [name] --> gets a module from svn and zips it"/>
<echo message=" core --> generates core for production updates (zip and tar.gz)"/>
<echo message=" clean --> clean up temporary build directories and files"/>
<echo message=""/>
<echo message=" usage --> provides help on using the build tool (default)"/>
<echo message=""/>
<echo message=" See comments inside the build.xml file for more details."/>
<echo message="-------------------------------------------------------------"/>
<echo message=""/>
<echo message=""/>
</target>
<!-- =================================================================== -->
<!-- Compiles the source directory -->
<!-- =================================================================== -->
<target name="compile" depends="init">
<mkdir dir="${build.classes}"/>
<!-- copy the imageio file -->
<copy file="${build.src}/META-INF/services/javax.imageio.spi.ImageWriterSpi"
todir="${build.classes}/META-INF/services"/>
<!-- copy helma db style sheet -->
<copy file="${build.src}/helma/objectmodel/dom/helma.xsl"
todir="${build.classes}/helma/objectmodel/dom" />
<!-- copy source files over to work directory -->
<delete dir="${build.work}/src" quiet="true"/>
<mkdir dir="${build.work}/src" />
<copy todir="${build.work}/src" overwrite="true">
<fileset dir="${build.src}" includes="**/*.java"/>
</copy>
<replace file="${build.work}/src/helma/main/Server.java"
token="__builddate__" value="${TODAY}"/>
<javac srcdir="${build.work}/src"
source="1.8"
target="1.8"
destdir="${build.classes}"
debug="${debug}"
deprecation="${deprecation}"
optimize="${optimize}"
includeAntRuntime="no">
<classpath refid="build.class.path" />
</javac>
<delete dir="${build.work}/src"/>
</target>
<!-- =================================================================== -->
<!-- Creates a helma.jar file (snapshot) in the lib-directory -->
<!-- =================================================================== -->
<target name="jar" depends="compile">
<jar jarfile="${build.lib}/${jar.name}-${DSTAMP}.jar"
basedir="${build.classes}"
excludes="**/package.html,**/main/launcher/**"/>
<jar jarfile="${home.dir}/launcher.jar"
basedir="${build.classes}"
includes="**/main/launcher/**"
manifest="${build.src}/helma/main/launcher/manifest.txt"/>
<!-- Copy timestamped helma jar file to lib/helma.jar -->
<copy file="${build.lib}/${jar.name}-${DSTAMP}.jar"
tofile="${build.lib}/${jar.name}.jar"/>
</target>
<!-- =================================================================== -->
<!-- Get the documentation (currently can fail due to request time-out -->
<!-- or missing support for proxies) -->
<!-- =================================================================== -->
<!-- <target name="docs" depends="init"> -->
<!-- <get src="http://www.helma.org/docs/reference/print" -->
<!-- dest="${build.docs}/reference.html" -->
<!-- ignoreerrors="true" -->
<!-- /> -->
<!-- </target> -->
<!-- =================================================================== -->
<!-- Builds and packages only the core for the deployment and updating -->
<!-- of production environments -->
<!-- =================================================================== -->
<target name="core" depends="init, jar">
<mkdir dir="${build.work}"/>
<!-- copy all libraries except helma-YYYYMMDD.jar -->
<copy todir="${build.work}/lib">
<fileset dir="${home.dir}/lib">
<exclude name="**/helma-*.jar" />
<include name="**/*.jar" />
</fileset>
</copy>
<!-- copy the launcher jar and start files-->
<copy file="${home.dir}/launcher.jar" todir="${build.work}/lib"/>
<!-- create lib/ext directory -->
<mkdir dir="${build.work}/lib/ext"/>
<!-- copy the license files -->
<copy todir="${build.work}/licenses">
<fileset dir="${home.dir}/licenses" excludes="**/.svn**"/>
</copy>
<copy file="${home.dir}/license.txt" todir="${build.work}/licenses"/>
<!-- zip up the whole thing -->
<antcall target="package-zip">
<param name="filename" value="${core.name}"/>
</antcall>
<antcall target="package-tgz">
<param name="filename" value="${core.name}"/>
</antcall>
<!-- clean up -->
<delete dir="${build.work}"/>
</target>
<!-- =================================================================== -->
<!-- Creates the full helma distribution -->
<!-- =================================================================== -->
<target name="package" depends="init">
<mkdir dir="${build.work}"/>
<!-- checkout the demo apps (and zip manage-app) -->
<antcall target="package-apps" />
<!-- create the main part of helma -->
<antcall target="package-raw">
<param name="distribution" value="main" />
</antcall>
<!-- copy modules -->
<antcall target="package-modules" />
<chmod perm="755">
<fileset dir="${build.work}">
<include name="start.sh"/>
</fileset>
</chmod>
<!-- zip up the whole thing -->
<antcall target="package-zip">
<param name="filename" value="${package.name}"/>
</antcall>
<antcall target="package-tgz">
<param name="filename" value="${package.name}"/>
</antcall>
<!-- make the src distributions -->
<antcall target="package-src-zip">
<param name="filename" value="${package.name}"/>
</antcall>
<antcall target="package-src-tgz">
<param name="filename" value="${package.name}"/>
</antcall>
<!-- clean up -->
<delete dir="${build.work}"/>
</target>
<!-- =================================================================== -->
<!-- Compile Helma and prepare the skeleton in a temporary directory. -->
<!-- Used by package . -->
<!-- =================================================================== -->
<target name="package-raw" depends="init, jar">
<!-- copy the framework (apps.props, server.props, hop/db, hop/static) -->
<copy todir="${build.work}">
<fileset dir="${build.dir}/${distribution}" excludes="**/.svn**"/>
</copy>
<!-- copy the launcher jar and start files -->
<copy file="${home.dir}/launcher.jar" todir="${build.work}/"/>
<copy file="${home.dir}/start.sh" todir="${build.work}"/>
<copy file="${home.dir}/start.bat" todir="${build.work}"/>
<!-- copy README.txt -->
<copy file="${home.dir}/README.txt" todir="${build.work}/"/>
<!-- copy all libraries except helma-YYYYMMDD.jar -->
<copy todir="${build.work}/lib">
<fileset dir="${home.dir}/lib">
<exclude name="**/helma-*.jar" />
<include name="**/*.jar" />
</fileset>
</copy>
<!-- create lib/ext directory -->
<mkdir dir="${build.work}/lib/ext"/>
<!-- copy the license files -->
<copy todir="${build.work}/licenses">
<fileset dir="${home.dir}/licenses" excludes="**/.svn**"/>
</copy>
<copy file="${home.dir}/license.txt" todir="${build.work}/licenses"/>
<!-- copy the scripts directory -->
<copy todir="${build.work}/scripts">
<fileset dir="${home.dir}/scripts" excludes="**/.svn**"/>
</copy>
<!-- zip the sourcecode -->
<!-- mkdir dir="${build.work}/src"/>
<tar tarfile="${build.work}/src/helma-src.tar" basedir="${build.src}/">
<tarfileset dir="${build.src}">
<include name="${build.src}/**"/>
</tarfileset>
</tar>
<gzip zipfile="${build.work}/src/helma-src.tar.gz" src="${build.work}/src/helma-src.tar"/>
<delete file="${build.work}/src/helma-src.tar"/ -->
</target>
<!-- =================================================================== -->
<!-- zip manage app -->
<!-- =================================================================== -->
<target name="package-apps" depends="init">
<mkdir dir="${build.work}/apps" />
<mkdir dir="${build.work}/apps/manage"/>
<zip zipfile="${build.work}/apps/manage/manage.zip" basedir="${home.dir}/apps/manage/"
includes="**" excludes="**/properties,readme/**" />
<copy todir="${build.work}/apps/manage">
<fileset dir="${home.dir}/apps/manage" includes="app.properties,class.properties,readme.txt"/>
</copy>
<!-- delete dir="${build.work}/manage" /-->
</target>
<!-- =================================================================== -->
<!-- Checkout modules including helmaTools -->
<!-- =================================================================== -->
<target name="package-modules" depends="init">
<!-- add a copy of the modules -->
<mkdir dir="${build.work}/modules"/>
<copy todir="${build.work}/modules">
<fileset dir="${home.dir}/modules"/>
</copy>
</target>
<!-- =================================================================== -->
<!-- Packages the work directory with TAR-GZIP -->
<!-- needs parameter ${filename} for final dist-file -->
<!-- =================================================================== -->
<target name="package-tgz" depends="init">
<mkdir dir="${build.dist}" />
<fixcrlf srcdir="${build.work}" eol="lf" eof="remove" includes="**/*.txt, **/*.properties, **/*.hac, **/*.js, **/*.skin" />
<tar tarfile="${build.dist}/${filename}.tar" basedir="${build.work}" excludes="**">
<tarfileset prefix="${filename}" dir="${build.work}" mode="755">
<include name="start.sh"/>
</tarfileset>
<tarfileset prefix="${filename}" dir="${build.work}">
<include name="**"/>
<exclude name="start.sh"/>
<exclude name="lib/jimi.jar"/>
<exclude name="lib/apache-dom.jar"/>
</tarfileset>
</tar>
<gzip zipfile="${build.dist}/${filename}.tar.gz" src="${build.dist}/${filename}.tar"/>
<delete file="${build.dist}/${filename}.tar"/>
</target>
<!-- =================================================================== -->
<!-- Packages the work directory with ZIP -->
<!-- needs parameter ${filename} for final dist-file -->
<!-- =================================================================== -->
<target name="package-zip" depends="init">
<mkdir dir="${build.dist}" />
<fixcrlf srcdir="${build.work}" eol="crlf" includes="**/*.txt, **/*.properties, **/*.hac, **/*.js, **/*.skin, **/*.xml" />
<zip zipfile="${build.dist}/${filename}.zip">
<zipfileset dir="${build.work}" prefix="${filename}">
<include name="**"/>
<exclude name="start.sh"/>
<exclude name="lib/jimi.jar"/>
<exclude name="lib/apache-dom.jar"/>
</zipfileset>
</zip>
</target>
<!-- =================================================================== -->
<!-- Packages Helma src and build directories with TAR-GZIP -->
<!-- needs parameter ${filename} for final dist-file -->
<!-- =================================================================== -->
<target name="package-src-tgz" depends="init">
<mkdir dir="${build.dist}" />
<tar tarfile="${build.dist}/${filename}-src.tar">
<tarfileset prefix="${filename}" dir="${home.dir}">
<include name="src/**"/>
<include name="build/**"/>
<include name="build.xml"/>
<include name="licenses/**"/>
<include name="license.txt"/>
<include name="lib/jimi.jar"/>
<include name="lib/apache-dom.jar"/>
</tarfileset>
</tar>
<gzip zipfile="${build.dist}/${filename}-src.tar.gz" src="${build.dist}/${filename}-src.tar"/>
<delete file="${build.dist}/${filename}-src.tar"/>
</target>
<!-- =================================================================== -->
<!-- Packages Helma src and build directories with ZIP -->
<!-- needs parameter ${filename} for final dist-file -->
<!-- =================================================================== -->
<target name="package-src-zip" depends="init">
<mkdir dir="${build.dist}" />
<zip zipfile="${build.dist}/${filename}-src.zip">
<zipfileset dir="${home.dir}" prefix="${filename}">
<include name="src/**"/>
<include name="build/**"/>
<include name="build.xml"/>
<include name="licenses/**"/>
<include name="license.txt"/>
<include name="lib/jimi.jar"/>
<include name="lib/apache-dom.jar"/>
</zipfileset>
</zip>
</target>
<!-- =================================================================== -->
<!-- Cleans up temporary build directories -->
<!-- =================================================================== -->
<target name="clean" depends="init">
<delete dir="${build.work}" />
<delete dir="${build.classes}" />
<delete dir="${build.dist}"/>
<delete file="${home.dir}/launcher.jar" quiet="true"/>
<delete>
<fileset dir="${build.lib}" includes="${jar.name}*.jar"/>
</delete>
</target>
</project>