-
Notifications
You must be signed in to change notification settings - Fork 24
/
build.xml
314 lines (245 loc) · 9.08 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
<project name="BezierSQLib" default="install" basedir="./">
<description>
BezierSQLib (formerly SQLibrary) build file, based on Processing libraries build file.
</description>
<target name="settings">
<!-- == Change these two for building == -->
<property file="local.properties" />
<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.)
${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) 2005 - 2023"/>
<property name="libraryName" value="BezierSQLib"/>
<property name="versionNumber" value="0.3.2"/>
<property name="yourLink" value="http://bezier.de/" />
<property name="keywords" value="MySQL, SQLite, PostgreSQL, SQL, database"/>
<property name="javaVersion" value="1.8"/>
<buildnumber file="resources/build.number" />
<path id="library-classes-add">
<fileset dir="lib">
<include name="mysql-connector-j-8.0.31.jar"/> <!-- MySQL -->
<include name="sqlite-jdbc-3.7.2.jar"/> <!-- SQLite -->
<include name="postgresql-9.2-1002.jdbc3.jar"/> <!-- PostgreSQL -->
</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="${libraryName}.jar"/>
<property name="src" location="src"/>
<property name="bin" location="bin"/>
<property name="javadoc" location="documentation"/>
<property name="dist" value="${libraryName}"/>
<property name="build" location="build"/>
<property name="web" location="../sql-website" />
</target>
<target name="init" depends="settings">
<echo>
Properties initialized.
src path ${src}
bin path ${bin}
Processing dir ${processing.dir}
processing Libraries ${libraries.dir}
java version ${javaVersion}
</echo>
<buildnumber file="lib/build.number"/>
<tstamp>
<format property="date" pattern="MM/dd/yyyy" offset="0" unit="hour"/>
</tstamp>
<echo>Start to build the library ... this is vers. ${versionNumber}, 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>
<mkdir dir="${dist}"/>
</target>
<!-- + + + + + + + + + + + + + + + + + + + + + + +
COMPILE, BUILD
+ + + + + + + + + + + + + + + + + + + + + + + -->
<target name="compile" depends="init" description="compile the source" >
<delete dir="${bin}" />
<mkdir dir="${bin}"/>
<javac srcdir="${src}" destdir="${bin}" source="${javaVersion}">
<classpath>
<path refid="library-classpath"/>
</classpath>
</javac>
</target>
<target name="documentation" depends="compile">
<mkdir dir="${javadoc}" />
<javadoc bottom="Processing library ${libraryName} (formerly SQLibrary) by ${author}. ${copyright}"
destdir="${javadoc}"
verbose="false"
stylesheetfile="resources/stylesheet.css"
doctitle="Javadocs: ${libraryName}"
public="true" version="false"
windowtitle="Javadocs: ${libraryName} (formerly SQLibrary)">
<fileset dir="${src}" defaultexcludes="yes">
<include name="**/*"/>
</fileset>
<classpath>
<path refid="library-classpath"/>
</classpath>
</javadoc>
</target>
<!-- + + + + + + + + + + + + + + + + + + + + + + +
PACKAGE
+ + + + + + + + + + + + + + + + + + + + + + + -->
<target name="package" depends="documentation" description="generate the distribution" >
<delete dir="${dist}" />
<mkdir dir="${dist}" />
<mkdir dir="${dist}/library" />
<mkdir dir="${dist}/examples" />
<mkdir dir="${dist}/documentation" />
<mkdir dir="${dist}/source" />
<jar jarfile="${dist}/library/${jarFile}" basedir="${bin}"/>
<copy todir="${dist}/examples">
<fileset dir="examples"/>
</copy>
<copy todir="${dist}/source">
<fileset dir="${src}" />
</copy>
<copy todir="${dist}/library">
<path refid="library-classes-add" />
</copy>
<copy todir="${dist}/documentation">
<fileset dir="${javadoc}" />
</copy>
<copy todir="${dist}">
<fileset file="resources/library.properties" />
<fileset file="readme.md" />
</copy>
<replaceregexp file="${dist}/library.properties" flags="g"
match="@@LIBRARY_NAME@@" replace="${libraryName}" />
<replaceregexp file="${dist}/library.properties" flags="g"
match="@@VERSION@@" replace="${build.number}" />
<replaceregexp file="${dist}/library.properties" flags="g"
match="@@PRETTY_VERSION@@" replace="${versionNumber}" />
<!-- zip the distribution of the library -->
<zip destfile="releases/${libraryName}-${versionNumber}.zip">
<zipfileset dir="">
<include name="${dist}/**/**" />
</zipfileset>
</zip>
<!-- library contribution system -->
<mkdir dir="release" />
<copy tofile="release/${libraryName}.zip">
<fileset file="releases/${libraryName}-${versionNumber}.zip" />
</copy>
<copy tofile="release/${libraryName}.txt">
<fileset file="${dist}/library.properties" />
</copy>
</target>
<!-- + + + + + + + + + + + + + + + + + + + + + + +
INSTALL
+ + + + + + + + + + + + + + + + + + + + + + + -->
<target name="install" depends="package">
<mkdir dir="${libraries.dir}/${libraryName}" />
<copy todir="${libraries.dir}/${libraryName}">
<fileset dir="${dist}"/>
</copy>
</target>
<!-- + + + + + + + + + + + + + + + + + + + + + + +
RELEASE
+ + + + + + + + + + + + + + + + + + + + + + + -->
<target name="release" depends="install">
<mkdir dir="${web}" />
<move todir="${web}/documentation">
<fileset dir="${dist}/documentation" />
</move>
<move todir="${web}/examples">
<fileset dir="${dist}/examples" />
</move>
<copy todir="${web}">
<fileset dir="resources/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="${libraryName}"
flags="g" />
<replaceregexp file="${web}/index.html"
match="##author##"
replace="${author}"
flags="g" />
<replaceregexp file="${web}/index.html"
match="##versionNumber##"
replace="${versionNumber}"
flags="g" />
<replaceregexp file="${web}/index.html"
match="##yourLink##"
replace="${yourLink}"
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/${libraryName}-${versionNumber}.zip" todir="${web}/download" />
</target>
<!-- + + + + + + + + + + + + + + + + + + + + + + +
CLEAN
+ + + + + + + + + + + + + + + + + + + + + + + -->
<target name="clean" >
<delete dir="${dist}" />
<delete dir="${javadoc}" />
<delete dir="${build}" />
<delete dir="${web}" />
</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="${exampleDir}.zip"/>
<zip destfile="${web}/examples/${exampleZipped}"
basedir="${web}/examples/${exampleDir}/"
excludes="**/_DS.Store" />
<replaceregexp file="${web}/index.html"
match="(##examples##)"
replace="<li><a href="examples/${exampleZipped}">${exampleDir}</a></li> \1"
flags="g" />
</target>
</project>