-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
486 lines (424 loc) · 18.7 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
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
<!--
Copyright (C) 2008 Harri Kaimio
This file is part of Freecine
Freecine is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, see <http://www.gnu.org/licenses>.
Additional permission under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or combining it
with Java Advanced Imaging (or a modified version of that library), containing
parts covered by the terms of Java Distribution License, or leJOS, containing
parts covered by the terms of Mozilla Public License, the licensors of this
Program grant you additional permission to convey the resulting work.
-->
<project name="freecine" default="dist" basedir=".">
<description>
Movie film scanning with flatbed scanner
</description>
<!-- set global properties for this build -->
<property name="project.name" value="freecine"/>
<property name="src-common" location="src/main/common"/>
<property name="src-pcapp" location="src/main/pcapp"/>
<property name="src-nxj" location="src/main/nxj"/>
<property name="src-test" location="src/test/pcapp"/>
<property name="build" location="build"/>
<property name="build-pccommon" location="${build}/pc/common"/>
<property name="build-pcapp" location="${build}/pc/pcapp"/>
<property name="build-nxj" location="${build}/nxj"/>
<property name="build-test" location="${build}/test"/>
<property name="dist" location="dist"/>
<property name="lib" location="lib"/>
<property name="basedir" location="."/>
<!-- Executable main classes -->
<property name="pcapp-main-class" value="org.freecine.swingui.Moviescan"/>
<property name="nxj-main-class" value="org.freecine.nxj.FilmMover"/>
<property name="nxj-binary" value="Freecine-mover"/>
<property file="build.properties"/>
<property file="nxj_build.properties"/>
<path id="runtime.path">
<fileset id="runtime.fileset" dir="${build.lib.dir}">
<include name="*"/>
</fileset>
</path>
<path id="project.class.path">
<fileset dir="${build.lib.dir}">
<include name="**/*.jar"/>
</fileset>
<pathelement path="${java.class.path}/"/>
<pathelement path="${build-pccommon}"/>
<pathelement path="${build-pcapp}"/>
<pathelement path="conf"/>
<pathelement path="src/main/resources"/>
</path>
<path id="test.class.path">
<path refid="project.class.path"/>
<pathelement path="${project.class.path}"/>
<pathelement location="${build-test}"/>
<pathelement location="${lib}/test/testng.jar"/>
</path>
<path id="debug.sourcepath" >
<pathelement path="${src-common}"/>
<pathelement path="${src-pcapp}"/>
<pathelement path="${src-test}"/>
</path>
<property environment="env"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build-pccommon}"/>
<mkdir dir="${build-pcapp}"/>
<mkdir dir="${build-nxj}"/>
<mkdir dir="${build-test}"/>
<property file="conf/versioninfo.properties"/>
</target>
<target name="compile" depends="init"
description="Compile the source" >
<!-- Compile the java code from ${src} into ${build} -->
<javac destdir="${build-pccommon}" debug="on">
<src path="${src-common}"/>
</javac>
<javac destdir="${build-pcapp}" debug="on" classpathref="project.class.path">
<src path="${src-pcapp}"/>
</javac>
<copy todir="${build-pcapp}">
<fileset dir="${src-pcapp}" includes="**/*.properties"/>
</copy>
</target>
<target name="compile-nxj" depends="init"
description="compile the source for NXJ" >
<!-- Compile the java code from ${src} -->
<javac source="1.3" target="1.1" destdir="${build-nxj}">
<src path="${src-common}"/>
<bootclasspath>
<pathelement location="lib/classes.jar"/>
</bootclasspath>
</javac>
<javac source="1.3" target="1.1" destdir="${build-nxj}">
<src path="${src-nxj}"/>
<bootclasspath>
<pathelement location="lib/classes.jar"/>
</bootclasspath>
</javac>
</target>
<target name="link-nxj" depends="compile-nxj"
description="link the binary for NXJ" >
<!-- Link the binary and create a signature file -->
<java classname="js.tinyvm.TinyVM">
<arg value="--classpath"/>
<arg path="${nxj.classes.home}/lib/classes.jar:${build-nxj}" />
<arg value="--writeorder" />
<arg value="LE" />
<arg value="${nxj-main-class}"/>
<arg value="-o"/>
<arg value="${nxj-binary}"/>
<arg value="-v"/>
<classpath>
<pathelement location="${nxj.jtools.home}/lib/jtools.jar"/>
<pathelement location="${nxj.jtools.home}/3rdparty/lib/commons-cli-1.0.jar"/>
<pathelement location="${nxj.jtools.home}/3rdparty/lib/bcel-5.1.jar"/>
</classpath>
</java>
</target>
<target name="upload-nxj" depends="link-nxj"
description="upload the binary " >
<java classname="lejos.pc.tools.NXJUpload" fork="true">
<jvmarg value="-Djava.library.path=${nxj.library.path}"/>
<arg value="${binary}"/>
<classpath>
<pathelement location="${nxj.jtools.home}/lib/jtools.jar"/>
<pathelement location="${nxj.pctools.home}/lib/pctools.jar"/>
<pathelement location="${nxj.pccomm.home}/lib/pccomm.jar"/>
<pathelement location="${nxj.jtools.home}/3rdparty/lib/commons-cli-1.0.jar"/>
<pathelement location="${nxj.jtools.home}/3rdparty/lib/bcel-5.1.jar"/>
<pathelement location="${nxj.pccomm.home}/3rdparty/lib/bluecove.jar"/>
</classpath>
</java>
</target>
<target name="uploadandrun-nxj" depends="link-nxj"
description="upload and run the binary " >
<java classname="lejos.pc.tools.NXJUpload" fork="true">
<jvmarg value="-Djava.library.path=${nxj.library.path}"/>
<arg value="${nxj-binary}"/>
<arg value="-r"/>
<classpath>
<pathelement location="${nxj.jtools.home}/lib/jtools.jar"/>
<pathelement location="${nxj.pctools.home}/lib/pctools.jar"/>
<pathelement location="${nxj.pccomm.home}/lib/pccomm.jar"/>
<pathelement location="${nxj.jtools.home}/3rdparty/lib/commons-cli-1.0.jar"/>
<pathelement location="${nxj.jtools.home}/3rdparty/lib/bcel-5.1.jar"/>
<pathelement location="${nxj.pccomm.home}/3rdparty/lib/bluecove.jar"/>
</classpath>
</java>
</target>
<target name="dist" depends="compile"
description="Build Freecine JAR files" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/${project.name}-latest"/>
<delete>
<fileset dir="${dist}/${project.name}-latest" includes="**/*"/>
</delete>
<!-- Convert the CLASSPATH from Ant path structure to a form that can be
passed to MANIFEST Class-Path property -->
<pathconvert property="runtime-path" pathsep=" ">
<path refid="runtime.path"></path>
<mapper type="flatten"/>
</pathconvert>
<!-- Create the jar file -->
<jar jarfile="${dist}/${project.name}-latest/${project.name}.jar">
<manifest>
<attribute name="Main-Class" value="${pcapp-main-class}"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Implementation-Version" value="build_${DSTAMP}"/>
<attribute name="Class-Path" value="${runtime-path}"/>
<attribute name="Build-time" value="${DSTAMP}_${TSTAMP}"/>
</manifest>
<fileset dir="${build-pccommon}">
<exclude name="**/Test*.class"/>
</fileset>
<fileset dir="${build-pcapp}">
<exclude name="**/Test*.class"/>
</fileset>
<!-- Include resources into the JAR -->
<fileset dir="conf" includes="*"/>
<fileset dir="src/main/resources" includes="*" excludes="README"/>
</jar>
<!-- Copy needed JAR files to distribution directory -->
<copy todir="${dist}/${project.name}-latest">
<fileset refid="runtime.fileset"/>
</copy>
</target>
<target name="-compile-test" depends="dist" description="Compile test cases">
<!-- Compile the java code from ${src} into ${build} -->
<javac destdir="${build-test}" debug="on">
<src path="${src-test}"/>
<classpath>
<path refid="project.class.path"/>
<pathelement location="lib/test/testng.jar"/>
</classpath>
</javac>
</target>
<target name="testng" depends="-compile-test,dist" description="TestNG test">
<taskdef resource="testngtasks" classpath="lib/test/testng.jar"/>
<testng outputDir="${reports.test}/testresults"
haltOnFailure="false" verbose="2" classpathref="test.class.path">
<classfileset dir="${build-test}">
<include name="**/**.class"/>
</classfileset>
</testng>
</target>
<target name="testng.debug.single" depends="-compile-test,dist" description="TestNG debug single file">
<taskdef resource="testngtasks" classpath="lib/test/testng.jar"/>
<nbjpdastart name="${classname}" addressproperty="jpda.address" transport="dt_socket">
<classpath refid="project.class.path"/>
<sourcepath refid="debug.sourcepath"/>
</nbjpdastart>
<echo message="selected_file: ${selected_file}"/>
<testng outputDir="${reports.test}/testresults"
haltOnFailure="true" verbose="2" classpathref="test.class.path">
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=none"/>
<jvmarg value="-Dbasedir=${basedir}"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
<classfileset dir="${build-test}">
<include name="${selected_file}.class"/>
</classfileset>
</testng>
</target>
<!-- Profile single test case in Netbeans-->
<target name="testng.profile.single" depends="dist" description="Profile in Netbeans profiler">
<fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
<taskdef resource="testngtasks" classpath="lib/testng.jar"/>
<!-- Start the profiler & waint for Java VM -->
<nbprofiledirect>
<classpath refid="project.class.path"/>
</nbprofiledirect>
<!-- Start application. Use basically the same command as for running the application -->
<testng outputDir="${reports.test}/testresults"
haltOnFailure="true" verbose="2">
<jvmarg value="${run.jvmargs}"/>
<jvmarg value="-Dbasedir=${basedir}"/>
<jvmarg value="${profiler.info.jvmargs.agent}"/>
<classpath>
<path refid="project.class.path"/>
<pathelement location="${build.dir}"/>
<pathelement location="${conf.dir}"/>
</classpath>
<classfileset dir="build">
<include name="${selected_file}.class"/>
</classfileset>
</testng>
</target>
<target name="test" depends="dist" description="Run JUnit tests">
<delete dir="./${reports.test}/testresults"/>
<mkdir dir="./${reports.test}/testresults"/>
<junit fork="yes" dir="${basedir}" showoutput="yes" printsummary="yes">
<sysproperty key="moviescan.propFname" value="${junittest.properties}"/>
<sysproperty key="moviescan.configfile" value="${junittest.configfile}"/>
<sysproperty key="basedir" value="${basedir}"/>
<formatter type="xml"/>
<formatter usefile="false" type="brief"/>
<classpath>
<path refid="project.class.path"/>
<pathelement location="${build.dir}"/>
<pathelement location="${conf.dir}"/>
</classpath>
<!--<test name="imginfo.PhotoInfoTest" outfile="${reports.test}/imginfo"/>-->
<batchtest todir="${reports.test}/testresults">
<fileset dir="${build-pcapp}">
<include name="**/Test_*.class"/>
<!-- Exlude inner classes since these do not contain any test cases -->
<exclude name="**/*$$*.class"/>
</fileset>
</batchtest>
</junit>
<!-- Create a summary report -->
<junitreport todir="${reports.test}">
<fileset dir="${reports.test}/testresults">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="./${reports.test}/html"/>
</junitreport>
</target>
<target name="run" depends="dist" description="Run Moviescan">
<java fork="true" classname="${pcapp-main-class}">
<!-- Use large enough heap to fit also big images -->
<jvmarg value="-Xmx${heap.max_size}M"/>
<jvmarg value="-Djava.library.path=${jlibnxt.path}"/>
<!-- jvmarg value="${run.jvmargs}"/>-->
<classpath>
<path refid="project.class.path"/>
</classpath>
</java>
</target>
<target name="debug" depends="dist" if="netbeans.home" description="Debug in Netbeans">
<nbjpdastart name="Moviescan" addressproperty="jpda.address" transport="dt_socket">
<classpath refid="project.class.path"/>
<sourcepath refid="debug.sourcepath"/>
</nbjpdastart>
<java fork="true" classname="${pcapp-main-class}">
<jvmarg value="-Xmx${heap.max_size}M"/>
<jvmarg value="-Djava.library.path=${jlibnxt.path}"/>
<!--<jvmarg value="-XX:+PrintGCDetails"/>-->
<!--jvmarg value="${run.jvmargs}"/-->
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=none"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
<classpath>
<path refid="project.class.path"/>
</classpath>
</java>
</target>
<target name="debug-selected-files" depends="compile" if="netbeans.home" description="Debug a single file in Netbeans">
<fail unless="classname">Must set property 'classname'</fail>
<nbjpdastart name="${classname}" addressproperty="jpda.address" transport="dt_socket">
<classpath refid="project.class.path"/>
<sourcepath refid="debug.sourcepath"/>
</nbjpdastart>
<java classname="${classname}" fork="true">
<jvmarg value="-Xmx${heap.max_size}M"/>
<jvmarg value="-Djava.library.path=${jlibnxt.path}"/>
<!--<jvmarg value="-XX:+PrintGCDetails"/>-->
<!--jvmarg value="${run.jvmargs}"/-->
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=none"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
<classpath>
<path refid="project.class.path"/>
</classpath>
</java>
</target>
<!-- Profile in Netbeans 5 -->
<target name="profile" depends="dist" description="Profile in Netbeans profiler">
<fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
<!-- Start the profiler & waint for Java VM -->
<nbprofiledirect>
<classpath refid="project.class.path"/>
</nbprofiledirect>
<!-- Start application. Use basically the same command as for running the application -->
<java fork="true" classname="${pcapp-main-class}" jvm="${profiler.info.jvm}">
<!-- Use large enough heap to fit also big images -->
<jvmarg value="-Xmx${heap.max_size}M"/>
<jvmarg value="${run.jvmargs}"/>
<jvmarg value="${profiler.info.jvmargs.agent}"/>
<classpath>
<path refid="project.class.path"/>
</classpath>
</java>
</target>
<target name="doc" description="Create Javadoc documentation">
<javadoc packagenames = "*"
destdir="docs/api"
author="true"
version="true"
use="true"
windowtitle="Freecine API documentation">
<fileset dir="${src-pcapp}" includes="**/*.java"/>
<fileset dir="${src-nxj}"/>
<fileset dir="${src-common}"/>
<classpath refid="project.class.path"/>
<doctitle><![CDATA[<h1>Freecine</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright © 2007 Harri Kaimio</i>]]></bottom>
<tag name="todo" scope="all" description="To do:" />
<link href="http://java.sun.com/j2se/1.5.0/docs/api/"/>
</javadoc>
</target>
<target name="clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
<target name="dist-bin-tgz" depends="dist"
description="Creates the binary distribution">
<property name="version" value="${build.major}.${build.minor}.${build.patch}${build.version_shorttag}"/>
<property name="tardir" value="${project.name}-${build.major}.${build.minor}.${build.patch}${build.version_shorttag}"/>
<tar destfile="${dist}/${project.name}-${version}.tar.gz" compression="gzip">
<tarfileset dir="${dist}/${project.name}-latest" prefix="${tardir}/lib">
<!-- Exclude JAI libraries since their license is not GPL compatible -->
<exclude name="**/jai_core.jar"/>
<exclude name="**/jai_codec.jar"/>
</tarfileset>
<tarfileset dir="." prefix="${tardir}">
<include name="relnotes.txt"/>
<include name="LICENSE.txt"/>
</tarfileset>
</tar>
</target>
<target name="dist-src-tgz" depends="dist"
description="Creates the source distribution tar file">
<property name="version" value="${build.major}.${build.minor}.${build.patch}${build.version_shorttag}"/>
<property name="tardir" value="${project.name}-${build.major}.${build.minor}.${build.patch}"/>
<tar destfile="${dist}/${project.name}-src-${version}.tar.gz" compression="gzip">
<tarfileset dir="src" prefix="${tardir}/src">
<exclude name="**/.svn"/>
</tarfileset>
<tarfileset dir="lib" prefix="${tardir}/lib">
<exclude name="**/.svn"/>
<exclude name="**/jai_core.jar"/>
<exclude name="**/jai_codec.jar"/>
</tarfileset>
<tarfileset dir="conf" prefix="${tardir}/conf">
<exclude name="**/.svn"/>
</tarfileset>
<tarfileset dir="." prefix="${tardir}">
<include name="relnotes.txt"/>
<include name="LICENSE.txt"/>
<include name="build.xml"/>
<include name="build.properties"/>
<include name="forrest.properties"/>
</tarfileset>
</tar>
</target>
<target name="dist-files" depends="dist-bin-tgz,dist-src-tgz"
description="Creates the distribution packages"/>
</project>