-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.xml
357 lines (290 loc) · 12.8 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
<project name="XlsReader library" default="build" basedir="./">
<description>
This XlsReader build file is based upon
the Processing libraries build file.
</description>
<target name="settings">
<!-- == Change these two for building == -->
<property file="local.properties"/>
<property name="poi.version" value="5.2.3"/>
<condition property="props.present">
<available file="local.properties"/>
</condition>
<fail unless="processing.dir"
message="To make the build work, create a file named local.properties, with the following:
${line.separator}processing.dir=/path/to/processing-git
${line.separator}with the path to where you have the code for Processing checked out.
${line.separator}(This script will look for the 'core' directory inside that folder.)"/>
<fail unless="libraries.dir"
message="To make the build work, create a file named local.properties, with the following
${line.separator}libraries.dir=/path/to/sketchbook/libraries
${line.separator}with the full path to the 'libraries' folder inside your sketchbook."/>
<!-- == No changes or adjustments required below == -->
<property name="author" value="Florian Jenett"/>
<property name="copyright" value="(c) 2007 - 2023"/>
<property name="library.name" value="XlsReader"/>
<property name="version_number" value="0.1.4"/>
<property name="project.url" value="http://bezier.de/"/>
<property name="keywords" value="Excel, reader, xls, data"/>
<property name="javaVersion" value="1.8"/>
<path id="library-classes-add">
<fileset dir="lib/poi-${poi.version}/">
<include name="poi-${poi.version}.jar"/>
<include name="poi-scratchpad-${poi.version}.jar"/>
</fileset>
<fileset dir="lib/poi-${poi.version}/lib/">
<include name="commons-io-*.jar"/>
<include name="log4j-*.jar"/>
</fileset>
<fileset dir="lib/apache-log4j-2.19.0-bin/">
<include name="log4j-core-*.jar"/>
</fileset>
</path>
<path id="library-classpath">
<fileset dir="${processing.dir}">
<include name="core/library/core.jar"/>
</fileset>
<path refid="library-classes-add"/>
</path>
<property name="jarFile" value="${library.name}.jar"/>
<property name="src" location="src"/>
<property name="bin" location="bin"/>
<property name="javadoc" location="documentation"/>
<property name="dist" value="${library.name}"/>
<property name="build" location="build"/>
<echo>Properties initialized.
src path ${src}
bin path ${bin}
libraryClasspath ${processing.dir}
processing Libraries ${libraries.dir}
java version ${javaVersion}
</echo>
</target>
<!-- + + + + + + + + + + + + + + + + + + + + + + +
INIT
+ + + + + + + + + + + + + + + + + + + + + + + -->
<target name="init" depends="settings">
<buildnumber file="lib/build.number"/>
<tstamp> <!-- Create the time stamp -->
<format property="date" pattern="MM/dd/yyyy" offset="0" unit="hour"/>
</tstamp>
<echo>Start to build the library ... this is vers. ${version_number}, build #${build.number} on ${date}</echo>
<!--
add ant-contrib package, needed for <foreach>
-->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="lib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
</target>
<!-- + + + + + + + + + + + + + + + + + + + + + + +
COMPILE
+ + + + + + + + + + + + + + + + + + + + + + + -->
<target name="compile" depends="init" description="compile the source">
<mkdir dir="${bin}"/>
<javac srcdir="${src}" destdir="${bin}" source="${javaVersion}" target="${javaVersion}">
<classpath>
<path refid="library-classpath"/>
</classpath>
</javac>
</target>
<!-- + + + + + + + + + + + + + + + + + + + + + + +
BUILD
+ + + + + + + + + + + + + + + + + + + + + + + -->
<target name="build" depends="compile" description="generate library jar and collect other jars">
<!-- delete the previous content of the ${dist} folder -->
<delete dir="${dist}"/>
<!-- build the structure for ${dist} -->
<mkdir dir="${dist}"/>
<mkdir dir="${dist}/library"/>
<jar jarfile="${dist}/library/${jarFile}" basedir="${bin}"/>
<copy todir="${dist}/library">
<path refid="library-classes-add"/>
</copy>
</target>
<!-- + + + + + + + + + + + + + + + + + + + + + + +
EXAMPLES
+ + + + + + + + + + + + + + + + + + + + + + + -->
<target name="examples" depends="build" description="add examples to dist directory">
<mkdir dir="${dist}/examples"/>
<copy todir="${dist}/examples">
<fileset dir="examples"/>
</copy>
</target>
<!-- + + + + + + + + + + + + + + + + + + + + + + +
DOCUMENTATION
+ + + + + + + + + + + + + + + + + + + + + + + -->
<target name="documentation" depends="build" description="generate documentation and add to dist directory">
<!-- create the java documentation of the library -->
<mkdir dir="${javadoc}"/>
<javadoc bottom="processing library ${library.name} by ${author}. ${copyright}"
destdir="${javadoc}"
verbose="false"
stylesheetfile="resources/stylesheet.css"
doctitle="Javadocs: ${library.name}"
public="true" version="false"
windowtitle="Javadocs: ${library.name}">
<fileset dir="${src}" defaultexcludes="yes">
<include name="**/*"/>
</fileset>
<classpath>
<path refid="library-classpath"/>
</classpath>
</javadoc>
<mkdir dir="${dist}/reference"/>
<copy todir="${dist}/reference">
<fileset dir="${javadoc}"/>
</copy>
</target>
<!-- + + + + + + + + + + + + + + + + + + + + + + +
PACKAGE the library
+ + + + + + + + + + + + + + + + + + + + + + + -->
<target name="package" depends="documentation,examples" description="assemble all files">
<!-- Add sources -->
<copy todir="${dist}/src">
<fileset dir="${src}"/>
</copy>
<!-- Add properties file and README -->
<copy todir="${dist}">
<fileset file="resources/library.properties"/>
<fileset file="readme.md"/>
</copy>
<replaceregexp file="${dist}/library.properties" flags="g"
match="@@LIBRARY_NAME@@" replace="${library.name}"/>
<replaceregexp file="${dist}/library.properties" flags="g"
match="@@VERSION@@" replace="${build.number}"/>
<replaceregexp file="${dist}/library.properties" flags="g"
match="@@PRETTY_VERSION@@" replace="${version_number}"/>
</target>
<!-- + + + + + + + + + + + + + + + + + + + + + + +
INSTALL the library in local Processing
+ + + + + + + + + + + + + + + + + + + + + + + -->
<target name="install" depends="package" description="install the library to local processing">
<!-- copy the jar file to processing's libraries -->
<delete dir="${libraries.dir}/${library.name}"/>
<mkdir dir="${libraries.dir}/${library.name}"/>
<copy todir="${libraries.dir}/${library.name}">
<fileset dir="${dist}"/>
</copy>
<!-- finish library's distribution -->
<!-- <copy todir="${libraries.dir}/${library.name}/reference">
<fileset dir="${javadoc}"/>
</copy>-->
<!-- done, finished. -->
<!--<delete dir="${dist}"/>-->
</target>
<!-- + + + + + + + + + + + + + + + + + + + + + + +
RELEASE a version
+ + + + + + + + + + + + + + + + + + + + + + + -->
<target name="release" depends="package" description="generate a release package">
<delete dir="release"/>
<mkdir dir="release"/>
<!-- zip the distribution of the library -->
<zip destfile="releases/${library.name}-${version_number}.zip">
<zipfileset dir="">
<include name="${dist}/**/**"/>
</zipfileset>
</zip>
<copy file="releases/${library.name}-${version_number}.zip"
tofile="release/${library.name}.zip"/>
<copy file="${dist}/library.properties"
tofile="release/${library.name}.txt"/>
</target>
<!-- + + + + + + + + + + + + + + + + + + + + + + +
WEBSITE
+ + + + + + + + + + + + + + + + + + + + + + + -->
<target name="web" depends="documentation, examples" description="generate a website">
<!-- organize the ${dist} folder -->
<mkdir dir="web"/>
<copy todir="web/documentation">
<fileset dir="${dist}/reference"/>
</copy>
<copy todir="web/examples">
<fileset dir="${dist}/examples"/>
</copy>
<!--delete dir="${dist}/library" /-->
<!-- <copy todir="web">
<fileset dir="web" />
</copy> -->
<!--
format the index.html file.
regular expressions are used to parse the web index.html file.
key words starting and ending with ## are replaced by values
defined earlier in the beginning of this build file.
-->
<replaceregexp file="web/index.html"
match="##yourLibrary##"
replace="${library.name}"
flags="g"/>
<replaceregexp file="web/index.html"
match="##author##"
replace="${author}"
flags="g"/>
<replaceregexp file="web/index.html"
match="##version_number##"
replace="${version_number}"
flags="g"/>
<replaceregexp file="web/index.html"
match="##project.url##"
replace="${project.url}"
flags="g"/>
<replaceregexp file="web/index.html"
match="##date##"
replace="${date}"
flags="g"/>
<replaceregexp file="web/index.html"
match="##keywords##"
replace="${keywords}"
flags="g"/>
<!-- <antcall target="processExamples" /> -->
<mkdir dir="web/download"/>
<copy file="releases/${library.name}-${version_number}.zip" todir="web/download"/>
</target>
<!-- + + + + + + + + + + + + + + + + + + + + + + +
CLEAN
+ + + + + + + + + + + + + + + + + + + + + + + -->
<target name="clean" depends="settings">
<echo>Starting clean ..</echo>
<delete dir="${dist}"/>
<delete dir="${bin}"/>
<delete dir="${javadoc}"/>
<delete dir="${build}"/>
<delete dir="library"/>
<echo>Done clean ..</echo>
</target>
<!-- + + + + + + + + + + + + + + + + + + + + + + +
EXAMPLES, all
+ + + + + + + + + + + + + + + + + + + + + + + -->
<target name="processExamples">
<dirset id="examples.contents" dir="examples" excludes="*/*"/>
<property name="examples.list" refid="examples.contents"/>
<foreach list="${examples.list}" target="addExamples" param="exampleDir" delimiter=";">
</foreach>
<!--echo>${examples.list}</echo-->
<!--foreach param="exampleDir" target="addExamples">
<path>
<dirset id="examples.contents" dir="examples" excludes="*/*"/>
</path>
</foreach-->
<replaceregexp
file="web/index.html"
match="(##examples##)"
replace=""
flags="g"/>
</target>
<!-- + + + + + + + + + + + + + + + + + + + + + + +
EXAMPLES, one
+ + + + + + + + + + + + + + + + + + + + + + + -->
<target name="addExamples" depends="settings">
<property name="exampleZipped" value="${examples.dir}.zip"/>
<zip destfile="web/examples/${exampleZipped}"
basedir="web/examples/${examples.dir}/"
excludes="**/_DS.Store"/>
<replaceregexp
file="web/index.html"
match="(##examples##)"
replace="<li><a href="examples/${exampleZipped}">${examples.dir}</a></li> \1"
flags="g"/>
</target>
</project>