-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
389 lines (303 loc) · 13.2 KB
/
build.xml
File metadata and controls
389 lines (303 loc) · 13.2 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
<project name="Template" default="dist" basedir=".">
<!--
This documents this build.xml file and explains the properties
file associated with each project. Each pascal project contains
a project.properties which defines information on how to build and
how to build the application.
PRE_REQUISITES:
General:
-> javadoc installed and in your path environment
-> javac installed and in your path environment
-> junit.jar and ant-junit.jar in ANT_HOME/lib.
-> All JUNit test must finish with *Test.java
The following variables can be used in project.properties and will
be replaced at runtime with the correct information:
These can be used to add specific path directories.
The following targets exists:
all Build and test everything; create a distribution, optionally install using freepascal
clean Delete all generated files and directories.
dist Produce the distributables
distclean Clean up the distribution files only.
docs Generate all documentation.
init Initialize the build: create directories, call <tstamp> and other common actions.
test Run the unit tests using freepascal in path
build Build using java compiler in path
help
-->
<description>Sample build script</description>
<!-- Internal properties -->
<!-- set global properties for this build -->
<property name="src" value="src"/>
<property name="bin" value="bin"/>
<property name="dist" value="dist"/>
<property name="docs" value="doc"/>
<property name="lib" value="lib"/>
<property name="res" value="res"/>
<property name="test" value="test"/>
<property environment="env"/>
<property name="general_delete_file_patterns"
value="**/*.aux **/*.log **/*.out **/*.toc **/*.tex **/*.tmp" />
<property name="build_delete_file_patterns"
value="**/*.class **/*.bak **/*.dcu **/*.ppu **/*.ppw **/*.ppa **/*.ow **/*.oo2 **/*.ppo **/*.ol **/*.o **/*.obj **/*.aw **/*.tpw **/*.tpp **/*.tpu **/*.TPW **/*.TPP **/*.TPU" />
<property file="project.properties" />
<target name="init">
<!-- Create the target directories if they do not exist -->
<mkdir dir="${dist}"/>
<mkdir dir="${src}"/>
<mkdir dir="${bin}"/>
<mkdir dir="${lib}"/>
<mkdir dir="${docs}"/>
<mkdir dir="${docs}${file.separator}output/html"/>
<mkdir dir="${test}"/>
<property name="build.resolved" location="${bin}" />
<property name="build.relative" value=".${file.separator}${bin}" />
<property name="dir.units" value="" />
<property name="dir.includes" value="" />
<property name="dir.objects" value="" />
<property name="defines" value="" />
<filelist id="dirlist" dir="." files="${package.dir.units}" />
<pathconvert pathsep=" " property="package.dir.units.native" refid="dirlist">
</pathconvert>
<filelist id="dirlist.relative" dir="." files="${package.dir.units.native}" />
<pathconvert pathsep=" " property="package.dir.units.relative" refid="dirlist.relative">
<globmapper from="${basedir}${file.separator}*" to=".${file.separator}*" />
</pathconvert>
<filelist id="filelist" dir="." files="${package.file}" />
<pathconvert pathsep=" " property="package.file.native" refid="filelist">
</pathconvert>
<filelist id="filelist.relative" dir="." files="${package.file}" />
<pathconvert pathsep=" " property="package.file.native.relative" refid="filelist.relative">
<globmapper from="${basedir}${file.separator}*" to=".${file.separator}*" />
</pathconvert>
<filelist id="tstdirlist" dir="." files="${package.dir.tests}" />
<pathconvert pathsep=" " property="package.dir.tests.native" refid="tstdirlist">
</pathconvert>
<filelist id="tstdirlist.relative" dir="." files="${package.dir.tests.native}" />
<pathconvert pathsep=" " property="package.dir.tests.relative" refid="tstdirlist.relative">
<globmapper from="${basedir}${file.separator}*" to=".${file.separator}*" />
</pathconvert>
<filelist id="tstfilelist" dir="." files="${package.dir.tests}${file.separator}testit.pas" />
<pathconvert pathsep=" " property="package.file.tests.native" refid="tstfilelist">
</pathconvert>
</target>
<target name="all" depends="init">
<echo>Building...</echo>
<antcall target="docs" />
<antcall target="build" />
<antcall target="dist" />
<antcall target="build" />
<antcall target="test" />
</target>
<target name="help" depends="init">
<echo level="info">
all Build and test everything; create a distribution
clean Delete all generated files and directories.
dist Produce the distributables
distclean Clean up the distribution files only.
docs Generate all documentation.
init Initialize the build: create directories
test Run the unit tests using freepascal in path
build Build using java compiler in path
help
</echo>
</target>
<target name="build" depends="init" description="Compile the source " >
<clean />
<javac
includeantruntime="false"
srcdir="${src}"
destdir="${bin}"
debug="false"
/>
<!-- We only give a warning and never fail -->
<copy failonerror="false" todir="${bin}/${res}" >
<fileset dir="${src}/${res}"/>
</copy>
</target>
<target name="test" depends="build" description="Run the unitary tests " >
<path id="master-classpath">
<fileset dir="${env.ANT_HOME}/lib">
<include name="*.jar"/>
</fileset>
<pathelement path="${bin}"/>
</path>
<javac
includeantruntime="false"
srcdir="${src}"
destdir="${bin}"
debug="true"
/>
<!-- Compile the unitary tests -->
<javac
includeantruntime="false"
srcdir="${test}"
destdir="${bin}"
debug="true"
>
<classpath refid="master-classpath"/>
</javac>
<!-- We only give a warning and never fail -->
<copy failonerror="false" todir="${bin}/${res}">
<fileset dir="${test}/${res}"/>
</copy>
<junit>
<classpath>
<pathelement location="${bin}" />
</classpath>
<batchtest>
<fileset dir="${test}">
<include name="**/*Test*" />
</fileset>
</batchtest>
<formatter type="brief" usefile="false"/>
</junit>
</target>
<target name="distclean" depends="init" description="Clean the distribution files">
<delete>
<fileset dir="${dist}" includes="*.*"/>
</delete>
</target>
<!-- Prepare a distribution zip file. Requires package.properties to be present and valid -->
<target name="dist" depends="init,build,docs" description="Generate the distribution" >
<property file="package.properties" />
<!-- Create the distribution packages -->
<tstamp>
<format property="current_day" pattern="dd" />
<format property="current_month" pattern="MM" />
<format property="current_year" pattern="yyyy" />
</tstamp>
<copy overwrite="true" file="master_pad_file.xml" tofile="pad_file.xml" />
<replace file="pad_file.xml">
<replacefilter
token="<Primary_Download_URL>"
value="<Primary_Download_URL>${package.url}${package.name}-${package.version}-src.zip"/>
<replacefilter
token="<Program_Version>"
value="<Program_Version>${package.version}"/>
<replacefilter
token="<Program_Release_Month>"
value="<Program_Release_Month>${current_month}"/>
<replacefilter
token="<Program_Release_Year>"
value="<Program_Release_Year>${current_year}"/>
<replacefilter
token="<Program_Release_Day>"
value="<Program_Release_Day>${current_day}"/>
<replacefilter
token="<Program_Name>"
value="<Program_Name>${package.title}"/>
</replace>
<!-- Create the source package that contains the following information
- test directory
- tst directory
- docs directory
- src directory
-->
<zip destfile=".${file.separator}${dist}${file.separator}${package.name}-${package.version}-src.zip" comment="${package.title} source package, version ${package.version}">
<zipfileset dir="${basedir}" includes="pad_file.xml ${src}/** ${docs}/output/** ${package.documents} ${test}/** ${bin} ${lib}" prefix="${package.name}" />
</zip>
<zip destfile=".${file.separator}${dist}${file.separator}${package.name}-${package.version}-docs.zip" comment="${package.title} documentation, version ${package.version}">
<zipfileset dir="${basedir}" includes="pad_file.xml ${docs}/output/** ${package.documents}" prefix="${package.name}" />
</zip>
<!-- Set package,internal.arch to correct string depending on the compiler type -->
<condition property="package.internal.arch" else="${package.cpu}-${package.os}" value="${package.cpu}-${package.os}-${package.compiler}${package.compiler.version}">
<istrue value="${package.library}"/>
</condition>
<dist-bin
package-name="${package.name}"
package-title="${package.title}"
package-version="${package.version}"
package-arch="${package.internal.arch}"
package-documents="${package.documents}"
package-binaries="${package.binaries}"
package-url="${package.url}"
/>
</target>
<target name="docs" description="Create the automated java documentation" depends="init">
<javadoc
sourcepath="${src}"
defaultexcludes="yes"
destdir="${docs}${file.separator}output/html"
author="true"
version="true"
use="true"
windowtitle="${package.name}">
</javadoc>
</target>
<target name="clean" description="clean up" depends="init">
<clean />
</target>
<macrodef name="clean" description="Clean macro" backtrace="true">
<sequential>
<!-- Delete the ${bin} directory trees -->
<delete file="pad_file.xml" />
<delete>
<fileset dir="." includes="pad_file?.xml"/>
<fileset dir="." includes="package.properties"/>
</delete>
<delete>
<fileset dir="." includes="${general_delete_file_patterns}"/>
</delete>
<delete dir="${docs}${file.separator}output/html" />
<delete includeemptydirs="true">
<fileset dir="${bin}" includes="**/*"/>
</delete>
</sequential>
</macrodef>
<!-- Create a zip distribution file for the specified platform with
the specified parameters -->
<macrodef name="dist-bin" description="Create binary distributable macro" backtrace="true">
<attribute name="package-name" description="The package name" />
<attribute name="package-title" description="The package title" />
<attribute name="package-version" description="Package version" />
<attribute name="package-arch" description="Package target arch" />
<attribute name="package-documents" description="Package documents" />
<attribute name="package-binaries" description="Package binaries" />
<attribute name="package-url" description="Package url" />
<sequential>
<local name="current_day" />
<local name="current_month" />
<local name="current_year" />
<!-- Create the distribution packages -->
<tstamp>
<format property="current_day" pattern="dd" />
<format property="current_month" pattern="MM" />
<format property="current_year" pattern="yyyy" />
</tstamp>
<copy overwrite="true" file="master_pad_file.xml" tofile="pad_file.xml" />
<replace file="pad_file.xml">
<replacefilter
token="<Primary_Download_URL>"
value="<Primary_Download_URL>@{package-url}@{package-name}-@{package-version}-@{package-arch}.zip"/>
<replacefilter
token="<Program_Version>"
value="<Program_Version>@{package-version}"/>
<replacefilter
token="<Program_OS_Support>"
value="<Program_OS_Support>Java"/>
<replacefilter
token="<Program_Release_Month>"
value="<Program_Release_Month>${current_month}"/>
<replacefilter
token="<Program_Release_Year>"
value="<Program_Release_Year>${current_year}"/>
<replacefilter
token="<Program_Release_Day>"
value="<Program_Release_Day>${current_day}"/>
<replacefilter
token="<Program_Name>"
value="<Program_Name>@{package-title}"/>
</replace>
<jar destfile="${dist}/@{package-name}.jar" basedir="${bin}">
<manifest>
<!-- Who is building this jar? -->
<attribute name="Built-By" value="${user.name}"/>
<!-- Information about the program itself -->
<attribute name="Implementation-Vendor" value="Optima SC Inc."/>
<attribute name="Implementation-Title" value="@{package-name}"/>
<attribute name="Implementation-Version" value="@{package-version}"/>
</manifest>
</jar>
</sequential>
</macrodef>
</project>