forked from atduskgreg/opencv-processing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
392 lines (291 loc) · 14.1 KB
/
build.xml
File metadata and controls
392 lines (291 loc) · 14.1 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
390
391
<project name="ProcessingLibs" default="clean" basedir="../">
<!--
Properties for your project should be set and modified in the
build.properties file (located in the same folder as this build.xml file).
THIS FILE SHOULD NOT BE EDITED, unless you know what you are doing.
If you have recommendations for improvements, please let Elie know
-->
<property file="./resources/build.properties" />
<description>
${ant.description}
</description>
<property name="line" value="------------------------------------------------------------------------------------------------" />
<condition property="is.normal">
<equals arg1="${project.compile}" arg2="normal" />
</condition>
<!-- set the OS properties -->
<condition property="is.mac">
<os family="mac" />
</condition>
<condition property="is.windows">
<os family="windows" />
</condition>
<condition property="is.unix">
<os family="unix" />
</condition>
<property name="project.jar.name" value="${project.name}.jar"/>
<property name="project.src" location="src"/>
<property name="project.tmp" location="tmp"/>
<property name="project.web" location="web"/>
<property name="project.data" location="data"/>
<property name="project.lib" location="lib"/>
<property name="project.bin" location="bin"/>
<property name="project.bin.data" location="${project.bin}/data"/>
<property name="project.examples" location="examples"/>
<property name="project.reference" location="reference"/>
<property name="project.dist" location="distribution"/>
<property name="project.dist.version" location="distribution/${project.name}-${library.version}"/>
<property name="install.source" location="resources/install_instructions.txt"/>
<property name="install.destination" location="${project.dist.version}/INSTALL.txt"/>
<property name="libprops.source" location="resources/library.properties"/>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="./resources/code/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<path id="classpath">
<fileset dir="${classpath.local.location}" includes="${classpath.local.include}" />
<fileset dir="${classpath.libraries.location}" includes="**/*.jar" />
<fileset dir="${project.lib}" includes="**/*.jar" />
</path>
<!-- Create the time stamp -->
<tstamp>
<format property="date" pattern="MM/dd/yyyy" offset="0" unit="hour"/>
</tstamp>
<target name="init">
<echo>${line}
Building the Processing library ${project.name} ${library.version}
${line}
src path ${project.src}
bin path ${project.bin}
classpath.local ${classpath.local.location}
sketchbook ${sketchbook.location}
java version ${java.target.version}
${line}
</echo>
<mkdir dir="${project.bin}"/>
</target>
<target name="library.init" depends="init">
<echo message="init library ..." />
</target>
<target name="library.run" depends="library.init">
<echo message="building library ..." />
<antcall target="generate.structure"><param name="folder" value="library"/></antcall>
<antcall target="generate.source" />
<antcall target="compile" />
<antcall target="generate.jar"><param name="folder" value="library"/></antcall>
<antcall target="generate.javadoc" />
<antcall target="generate.libprops" />
<antcall target="copyToSketchbook"><param name="folder" value="libraries"/></antcall>
<antcall target="generate.distribution" />
<antcall target="generate.install.library" />
<antcall target="generate.web" />
<antcall target="generate.zip" />
<delete dir="${project.tmp}"/>
</target>
<target name="generate.libprops" if="is.normal">
<property name="libprops.destination" location="${project.tmp}/${project.name}/library.properties"/>
<copy file="${libprops.source}" tofile="${libprops.destination}" />
<antcall target="parse.file"><param name="file" value="${libprops.destination}"/></antcall>
</target>
<target name="copyToSketchbook">
<echo message="copying files to the ${folder} folder in your sketchbook." />
<!-- copy the jar file to processing's sketchbook libraries folder -->
<delete dir="${sketchbook.location}/${folder}/${project.name}" />
<mkdir dir="${sketchbook.location}/${folder}/${project.name}" />
<copy todir="${sketchbook.location}/${folder}/${project.name}">
<fileset dir="${project.tmp}/${project.name}"/>
</copy>
</target>
<target name="compile">
<javac srcdir="${project.tmp}/${project.name}/src" destdir="${project.bin}" source="${java.target.version}" target="${java.target.version}" includeantruntime="false">
<classpath>
<path refid="classpath"/>
</classpath>
<compilerarg value="-Xlint"/>
</javac>
<copy todir="${project.bin.data}">
<fileset dir="${project.data}" excludes="README" />
</copy>
</target>
<target name="generate.jar">
<jar jarfile="${project.tmp}/${project.name}/${folder}/${project.jar.name}" basedir="${project.bin}"/>
</target>
<target name="generate.structure">
<delete dir="${project.tmp}" />
<mkdir dir="${project.tmp}" />
<mkdir dir="${project.tmp}/${project.name}" />
<mkdir dir="${project.tmp}/${project.name}/${folder}" />
<mkdir dir="${project.tmp}/${project.name}/examples" />
<mkdir dir="${project.tmp}/${project.name}/reference" />
<mkdir dir="${project.tmp}/${project.name}/src" />
<mkdir dir="${project.tmp}/${project.name}/data" />
<copy todir="${project.tmp}/${project.name}/examples">
<fileset dir="${project.examples}">
<exclude name="**/*README*"/>
</fileset>
</copy>
<copy todir="${project.tmp}/${project.name}/src">
<fileset dir="${project.src}"/>
</copy>
<copy todir="${project.tmp}/${project.name}/data">
<fileset dir="${project.data}"/>
</copy>
<copy todir="${project.tmp}/${project.name}/${folder}">
<fileset dir="${project.lib}" excludes="README" />
</copy>
</target>
<target name="generate.source" if="is.normal">
<antcall target="generate.source.win"/>
<antcall target="generate.source.nix"/>
</target>
<!-- These two targets are pretty much the same, except for the delimiter (can't find a better way of doing this) -->
<target name="generate.source.win" if="is.windows">
<echo message="generating source (windows) ..."/>
<path id="src.contents"><fileset dir="${project.tmp}/${project.name}/src" includes="**/*.java" /></path>
<property name="src.list" refid="src.contents" />
<foreach list="${src.list}" param="file" target="parse.file" delimiter=";" />
</target>
<target name="generate.source.nix" unless="is.windows">
<echo message="generating source (mac/linux) ..."/>
<path id="src.contents"><fileset dir="${project.tmp}/${project.name}/src" includes="**/*.java" /></path>
<property name="src.list" refid="src.contents" />
<foreach list="${src.list}" param="file" target="parse.file" delimiter=":" />
</target>
<target name="generate.distribution" if="is.normal">
<mkdir dir="${project.dist}"/>
<delete dir="${project.dist.version}"/>
<mkdir dir="${project.dist.version}" />
<mkdir dir="${project.dist.version}/${project.name}" />
<move file="${project.tmp}/${project.name}" toDir="${project.dist.version}" />
</target>
<target name="generate.javadoc" if="is.normal">
<!-- create the java reference of the library -->
<javadoc bottom="Processing library ${project.name} by ${author.name}. ${library.copyright}"
classpath="${classpath.local.location}/core.jar;{project.bin}"
destdir="${project.tmp}/${project.name}/reference"
verbose="false"
stylesheetfile="resources/stylesheet.css"
doctitle="Javadocs: ${project.name}"
public="true" version="false"
windowtitle="Javadocs: ${project.name}">
<link href="${javadoc.java.href}" />
<link href="${javadoc.processing.href}" />
<taglet name="ExampleTaglet" path="resources/code" />
<fileset dir="${project.tmp}/${project.name}/src" defaultexcludes="yes">
<!-- add packages to be added to reference. -->
<include name="**/*"/>
</fileset>
</javadoc>
</target>
<target name="generate.web" if="is.normal">
<mkdir dir="${project.dist.version}/web" />
<copy todir="${project.dist.version}/web/reference">
<fileset dir="${project.dist.version}/${project.name}/reference" />
</copy>
<copy todir="${project.dist.version}/web/examples">
<fileset dir="${project.dist.version}/${project.name}/examples" />
</copy>
<copy todir="${project.dist.version}/web">
<fileset dir="${project.web}" />
</copy>
<antcall target="parse.file"><param name="file" value="${project.dist.version}/web/index.html"/></antcall>
<antcall target="processExamples" />
<replaceregexp file="${project.dist.version}/web/index.html" match="##examples##" replace="" flags="g" />
</target>
<!-- find and replace ##placeholder## keywords in a file -->
<target name="parse.file">
<echo message="${file}" />
<replaceregexp file="${file}" match="##date##" replace="${date}" flags="g" />
<replaceregexp file="${file}" match="##copyright##" replace="${library.copyright}" flags="g" />
<replaceregexp file="${file}" match="##author##" replace="${author.name} ${author.url}" flags="g" />
<replaceregexp file="${file}" match="##author.name##" replace="${author.name}" flags="g" />
<replaceregexp file="${file}" match="##author.url##" replace="${author.url}" flags="g" />
<replaceregexp file="${file}" match="##library.name##" replace="${project.prettyName}" flags="g" />
<replaceregexp file="${file}" match="##project.name##" replace="${project.name}" flags="g" />
<replaceregexp file="${file}" match="##library.version##" replace="${library.version}" flags="g" />
<replaceregexp file="${file}" match="##library.prettyVersion##" replace="${library.prettyVersion}" flags="g" />
<replaceregexp file="${file}" match="##library.url##" replace="${library.url}" flags="g" />
<replaceregexp file="${file}" match="##library.category##" replace="${library.category}" flags="g" />
<replaceregexp file="${file}" match="##library.sentence##" replace="${library.sentence}" flags="g" />
<replaceregexp file="${file}" match="##library.paragraph##" replace="${library.paragraph}" flags="g" />
<replaceregexp file="${file}" match="##library.keywords##" replace="${library.keywords}" flags="g" />
<replaceregexp file="${file}" match="##library.dependencies##" replace="${library.dependencies}" flags="g" />
<replaceregexp file="${file}" match="##source.host##" replace="${source.host}" flags="g" />
<replaceregexp file="${file}" match="##source.url##" replace="${source.url}" flags="g" />
<replaceregexp file="${file}" match="##source.repository##" replace="${source.repository}" flags="g" />
<replaceregexp file="${file}" match="##tested.platform##" replace="${tested.platform}" flags="g" />
<replaceregexp file="${file}" match="##tested.processingVersion##" replace="${tested.processingVersion}" flags="g" />
</target>
<target name="generate.install.library" if="is.normal">
<copy file="${install.source}" tofile="${project.dist.version}/INSTALL.txt" />
<antcall target="parse.file"><param name="file" value="${install.destination}"/></antcall>
</target>
<target name="generate.zip" if="is.normal">
<!-- zip the distribution of the library -->
<move todir="${project.dist.version}/tmp/${project.name}">
<fileset dir="${project.dist.version}/${project.name}" />
</move>
<copy file="${project.dist.version}/tmp/${project.name}/library.properties" tofile="${project.dist.version}/web/download/${project.name}.txt" />
<zip destfile="${project.dist.version}/${project.name}.zip"
basedir="${project.dist.version}/tmp"
excludes="**/.DS_Store"
/>
<move file="${project.dist.version}/${project.name}.zip" todir="${project.dist.version}/web/download" />
<copy file="${project.dist.version}/web/download/${project.name}.zip" tofile="${project.dist.version}/web/download/${project.name}-${library.version}.zip" />
<copy file="${project.dist.version}/web/download/${project.name}.txt" tofile="${project.dist.version}/web/download/${project.name}-${library.version}.txt" />
<move todir="${project.dist.version}">
<fileset dir="${project.dist.version}/web" />
</move>
<delete dir="${project.dist.version}/tmp" />
</target>
<!-- parsing the examples folder -->
<target name="processExamples">
<dirset id="examples.contents" dir="${project.examples}" excludes="*/*"/>
<property name="examples.list" refid="examples.contents"/>
<foreach list="${examples.list}" target="addExamples" param="exampleDir" delimiter=";">
</foreach>
</target>
<target name="addExamples">
<echo>${exampleDir}</echo>
<propertyregex property="pde"
input="${exampleDir}"
regexp="^.*\/(.*)$"
select="\1"
casesensitive="false"
defaultValue="${exampleDir}" />
<propertyregex property="data"
input="${exampleDir}"
regexp="data$"
select="true"
casesensitive="false"
defaultValue="false" />
<if>
<equals arg1="${data}" arg2="false" />
<then>
<replaceregexp file="${project.dist.version}/web/index.html"
match="(##examples##)"
replace="<li><a href="examples/${exampleDir}/${pde}.pde">${exampleDir}</a></li> \1"
flags="g" />
</then>
<else>
<echo message="Data folder, attention." />
</else>
</if>
</target>
<target name="clean" depends="library.run">
<delete dir="${project.bin}"/>
<delete dir="${project.tmp}"/>
<echo>
${line}
Name ${project.name}
Version ${library.prettyVersion} (${library.version})
Compiled ${project.compile}
Sketchbook ${sketchbook.location}
${line}
done, finished.
${line}
</echo>
</target>
</project>