root / build.xml

Revision 59:0a46f5cdb2cd, 18.7 kB (checked in by Harri Kaimio <harri@…>, 4 years ago)

Added dialog for scanning a preview image and selecting scan area.

Currently scan area selection is not yet ysed, the dialog just scans
the preview image.

Line 
1<!--
2Copyright (C) 2008 Harri Kaimio
3 
4This file is part of Freecine
5 
6Freecine is free software; you can redistribute it and/or modify it
7under the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3 of the License, or (at your option)
9any later version.
10 
11This program is distributed in the hope that it will be useful, but WITHOUT
12ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14You should have received a copy of the GNU General Public License along with
15this program; if not, see <http://www.gnu.org/licenses>.
16 
17Additional permission under GNU GPL version 3 section 7
18 
19If you modify this Program, or any covered work, by linking or combining it
20with Java Advanced Imaging (or a modified version of that library), containing
21parts covered by the terms of Java Distribution License, or leJOS, containing
22parts covered by the terms of Mozilla Public License, the licensors of this
23Program grant you additional permission to convey the resulting work.
24-->
25
26
27<project name="freecine" default="dist" basedir=".">
28<description>
29    Movie film scanning with flatbed scanner
30</description>
31<!-- set global properties for this build -->
32<property name="project.name" value="freecine"/>
33<property name="src-common" location="src/main/common"/>
34<property name="src-pcapp" location="src/main/pcapp"/>
35<property name="src-nxj" location="src/main/nxj"/>
36<property name="src-test" location="src/test/pcapp"/>
37<property name="build" location="build"/>
38<property name="build-pccommon" location="${build}/pc/common"/>
39<property name="build-pcapp" location="${build}/pc/pcapp"/>
40<property name="build-nxj" location="${build}/nxj"/>
41<property name="build-test" location="${build}/test"/>
42<property name="dist"  location="dist"/>
43<property name="lib"  location="lib"/>
44<property name="basedir" location="."/>
45
46<!-- Executable main classes -->
47<property name="pcapp-main-class" value="org.freecine.swingui.Moviescan"/>
48<property name="nxj-main-class" value="org.freecine.nxj.FilmMover"/>
49<property name="nxj-binary" value="Freecine-mover"/>
50
51<property file="build.properties"/> 
52<property file="nxj_build.properties"/> 
53
54<path id="runtime.path">
55    <fileset id="runtime.fileset" dir="${build.lib.dir}">
56        <include name="*"/>
57    </fileset>
58</path>
59
60<path id="project.class.path">
61    <fileset dir="${build.lib.dir}">
62        <include name="**/*.jar"/>
63    </fileset>
64    <pathelement path="${java.class.path}/"/>
65    <pathelement path="${build-pccommon}"/>
66    <pathelement path="${build-pcapp}"/>
67    <pathelement path="conf"/>
68    <pathelement path="src/main/resources"/>
69</path>
70
71<path id="test.class.path">
72    <path refid="project.class.path"/>
73    <pathelement path="${project.class.path}"/>
74    <pathelement location="${build-test}"/>
75    <pathelement location="${lib}/test/testng.jar"/>
76</path>
77
78<path id="debug.sourcepath" >
79    <pathelement path="${src-common}"/>
80    <pathelement path="${src-pcapp}"/>
81    <pathelement path="${src-test}"/>
82</path>
83
84<property environment="env"/>
85
86
87<target name="init">
88    <!-- Create the time stamp -->
89    <tstamp/>
90    <!-- Create the build directory structure used by compile -->
91    <mkdir dir="${build-pccommon}"/>
92    <mkdir dir="${build-pcapp}"/>
93    <mkdir dir="${build-nxj}"/>
94    <mkdir dir="${build-test}"/>
95
96    <property file="conf/versioninfo.properties"/>   
97</target>
98
99<target name="compile" depends="init"
100        description="Compile the source" >
101   
102   
103    <!-- Compile the java code from ${src} into ${build} -->
104    <javac destdir="${build-pccommon}" debug="on">
105        <src path="${src-common}"/>
106        </javac>
107    <javac destdir="${build-pcapp}" debug="on" classpathref="project.class.path">
108        <src path="${src-pcapp}"/>
109    </javac>
110    <copy todir="${build-pcapp}">
111        <fileset dir="${src-pcapp}" includes="**/*.properties"/>
112    </copy>
113</target>
114
115<target name="compile-nxj" depends="init"
116        description="compile the source for NXJ" >
117        <!-- Compile the java code from ${src}  -->
118    <javac source="1.3" target="1.1" destdir="${build-nxj}">
119        <src path="${src-common}"/>
120        <bootclasspath>
121            <pathelement location="lib/classes.jar"/>
122        </bootclasspath>
123    </javac>
124    <javac source="1.3" target="1.1" destdir="${build-nxj}">
125        <src path="${src-nxj}"/>
126        <bootclasspath>
127            <pathelement location="lib/classes.jar"/>
128        </bootclasspath>
129    </javac>
130</target>
131
132  <target name="link-nxj" depends="compile-nxj"
133        description="link the binary for NXJ" >
134    <!-- Link the binary and create a signature file -->
135    <java classname="js.tinyvm.TinyVM">
136      <arg value="--classpath"/>
137      <arg path="${nxj.classes.home}/lib/classes.jar:${build-nxj}" /> 
138      <arg value="--writeorder" />
139      <arg value="LE" />
140      <arg value="${nxj-main-class}"/>
141      <arg value="-o"/>
142      <arg value="${nxj-binary}"/>
143      <arg value="-v"/>
144      <classpath>
145        <pathelement location="${nxj.jtools.home}/lib/jtools.jar"/>
146        <pathelement location="${nxj.jtools.home}/3rdparty/lib/commons-cli-1.0.jar"/>
147        <pathelement location="${nxj.jtools.home}/3rdparty/lib/bcel-5.1.jar"/>
148      </classpath>
149    </java>
150  </target>
151       
152  <target name="upload-nxj" depends="link-nxj"
153        description="upload the binary " >
154    <java classname="lejos.pc.tools.NXJUpload" fork="true">
155      <jvmarg value="-Djava.library.path=${nxj.library.path}"/>
156      <arg value="${binary}"/>
157      <classpath>
158        <pathelement location="${nxj.jtools.home}/lib/jtools.jar"/>
159        <pathelement location="${nxj.pctools.home}/lib/pctools.jar"/>
160        <pathelement location="${nxj.pccomm.home}/lib/pccomm.jar"/>
161        <pathelement location="${nxj.jtools.home}/3rdparty/lib/commons-cli-1.0.jar"/>
162        <pathelement location="${nxj.jtools.home}/3rdparty/lib/bcel-5.1.jar"/>
163        <pathelement location="${nxj.pccomm.home}/3rdparty/lib/bluecove.jar"/>
164      </classpath>
165    </java>
166  </target>
167       
168  <target name="uploadandrun-nxj" depends="link-nxj"
169        description="upload and run the binary " >
170    <java classname="lejos.pc.tools.NXJUpload" fork="true">
171      <jvmarg value="-Djava.library.path=${nxj.library.path}"/>
172      <arg value="${nxj-binary}"/>
173      <arg value="-r"/>
174      <classpath>
175        <pathelement location="${nxj.jtools.home}/lib/jtools.jar"/>
176        <pathelement location="${nxj.pctools.home}/lib/pctools.jar"/>
177        <pathelement location="${nxj.pccomm.home}/lib/pccomm.jar"/>
178        <pathelement location="${nxj.jtools.home}/3rdparty/lib/commons-cli-1.0.jar"/>
179        <pathelement location="${nxj.jtools.home}/3rdparty/lib/bcel-5.1.jar"/>
180        <pathelement location="${nxj.pccomm.home}/3rdparty/lib/bluecove.jar"/>
181      </classpath>
182    </java>
183  </target>
184
185<target name="dist" depends="compile"
186        description="Build Freecine JAR files" >
187   
188    <!-- Create the distribution directory -->
189    <mkdir dir="${dist}/${project.name}-latest"/>
190    <delete>
191        <fileset dir="${dist}/${project.name}-latest" includes="**/*"/>
192       
193    </delete>
194   
195   
196    <!-- Convert the CLASSPATH from Ant path structure to a form that can be
197    passed to MANIFEST Class-Path property -->
198    <pathconvert property="runtime-path" pathsep=" ">
199        <path refid="runtime.path"></path>
200        <mapper type="flatten"/>
201    </pathconvert>   
202   
203    <!-- Create the jar file  -->
204    <jar jarfile="${dist}/${project.name}-latest/${project.name}.jar">
205        <manifest>
206            <attribute name="Main-Class" value="${pcapp-main-class}"/>
207            <attribute name="Built-By" value="${user.name}"/>
208            <attribute name="Implementation-Version" value="build_${DSTAMP}"/>
209            <attribute name="Class-Path" value="${runtime-path}"/>
210            <attribute name="Build-time" value="${DSTAMP}_${TSTAMP}"/>
211        </manifest>
212        <fileset dir="${build-pccommon}">
213            <exclude name="**/Test*.class"/>
214        </fileset>
215        <fileset dir="${build-pcapp}">
216            <exclude name="**/Test*.class"/>
217        </fileset>
218       
219       
220        <!-- Include resources into the JAR -->
221        <fileset dir="conf" includes="*"/>
222        <fileset dir="src/main/resources" includes="*" excludes="README"/>
223    </jar>
224   
225    <!-- Copy needed JAR files to distribution directory -->
226    <copy todir="${dist}/${project.name}-latest">
227        <fileset refid="runtime.fileset"/>   
228    </copy>
229   
230</target>
231
232<target name="-compile-test" depends="dist" description="Compile test cases">
233    <!-- Compile the java code from ${src} into ${build} -->
234    <javac destdir="${build-test}" debug="on">
235        <src path="${src-test}"/>
236        <classpath>
237            <path refid="project.class.path"/>
238            <pathelement location="lib/test/testng.jar"/>
239           
240        </classpath>
241    </javac>
242</target>
243
244<target name="testng" depends="-compile-test,dist" description="TestNG test">
245    <taskdef  resource="testngtasks" classpath="lib/test/testng.jar"/>
246   
247    <testng outputDir="${reports.test}/testresults"
248            haltOnFailure="false" verbose="2" classpathref="test.class.path">
249        <classfileset dir="${build-test}"> 
250            <include name="**/**.class"/>
251        </classfileset>
252    </testng>         
253</target>
254
255<target name="testng.debug.single" depends="-compile-test,dist" description="TestNG debug single file">
256    <taskdef  resource="testngtasks" classpath="lib/test/testng.jar"/>
257    <nbjpdastart name="${classname}" addressproperty="jpda.address" transport="dt_socket">
258        <classpath refid="project.class.path"/>
259        <sourcepath refid="debug.sourcepath"/> 
260    </nbjpdastart>
261    <echo message="selected_file: ${selected_file}"/>
262    <testng outputDir="${reports.test}/testresults"
263            haltOnFailure="true" verbose="2" classpathref="test.class.path">
264        <jvmarg value="-Xdebug"/>
265        <jvmarg value="-Xnoagent"/>
266        <jvmarg value="-Djava.compiler=none"/>
267        <jvmarg value="-Dbasedir=${basedir}"/>
268       
269        <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>               
270
271       
272        <classfileset dir="${build-test}"> 
273            <include name="${selected_file}.class"/>
274        </classfileset>
275    </testng>         
276</target>
277
278<!-- Profile single test case in Netbeans-->
279<target name="testng.profile.single" depends="dist" description="Profile in Netbeans profiler">
280    <fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
281    <taskdef  resource="testngtasks" classpath="lib/testng.jar"/>
282    <!-- Start the profiler & waint for Java VM -->
283    <nbprofiledirect>
284        <classpath refid="project.class.path"/>
285    </nbprofiledirect>
286    <!-- Start application. Use basically the same command as for running the application -->
287    <testng outputDir="${reports.test}/testresults"
288            haltOnFailure="true" verbose="2">
289        <jvmarg value="${run.jvmargs}"/>
290        <jvmarg value="-Dbasedir=${basedir}"/>
291        <jvmarg value="${profiler.info.jvmargs.agent}"/>
292       
293        <classpath>
294            <path refid="project.class.path"/>
295            <pathelement location="${build.dir}"/>
296            <pathelement location="${conf.dir}"/>
297        </classpath>
298       
299        <classfileset dir="build"> 
300            <include name="${selected_file}.class"/>
301        </classfileset>
302    </testng>         
303</target>   
304
305<target name="test" depends="dist" description="Run JUnit tests">
306    <delete dir="./${reports.test}/testresults"/>
307    <mkdir dir="./${reports.test}/testresults"/>
308    <junit fork="yes" dir="${basedir}" showoutput="yes" printsummary="yes">
309        <sysproperty key="moviescan.propFname" value="${junittest.properties}"/>
310        <sysproperty key="moviescan.configfile" value="${junittest.configfile}"/>     
311        <sysproperty key="basedir" value="${basedir}"/>
312        <formatter type="xml"/>
313        <formatter usefile="false" type="brief"/>
314        <classpath>
315            <path refid="project.class.path"/>
316            <pathelement location="${build.dir}"/>
317            <pathelement location="${conf.dir}"/>
318        </classpath>
319        <!--<test name="imginfo.PhotoInfoTest" outfile="${reports.test}/imginfo"/>-->
320        <batchtest todir="${reports.test}/testresults">
321            <fileset dir="${build-pcapp}"> 
322                <include name="**/Test_*.class"/>
323                <!-- Exlude inner classes since these do not contain any test cases --> 
324                <exclude name="**/*$$*.class"/>
325            </fileset>
326        </batchtest>
327    </junit>
328   
329    <!-- Create a summary report -->
330    <junitreport todir="${reports.test}">
331        <fileset dir="${reports.test}/testresults">
332            <include name="TEST-*.xml"/>
333        </fileset>
334        <report format="frames" todir="./${reports.test}/html"/>
335    </junitreport>
336   
337</target>
338
339
340<target name="run" depends="dist" description="Run Moviescan">
341    <java fork="true" classname="${pcapp-main-class}">
342        <!-- Use large enough heap to fit also big images -->
343        <jvmarg value="-Xmx${heap.max_size}M"/>
344        <jvmarg value="-Djava.library.path=${jlibnxt.path}"/>
345        <!-- jvmarg value="${run.jvmargs}"/>-->
346        <classpath>
347            <path refid="project.class.path"/>
348        </classpath>
349    </java> 
350</target>
351
352<target name="debug" depends="dist" if="netbeans.home" description="Debug in Netbeans"> 
353    <nbjpdastart name="Moviescan" addressproperty="jpda.address" transport="dt_socket">
354        <classpath refid="project.class.path"/>
355        <sourcepath refid="debug.sourcepath"/> 
356    </nbjpdastart>
357
358    <java fork="true" classname="${pcapp-main-class}">
359        <jvmarg value="-Xmx${heap.max_size}M"/>
360        <jvmarg value="-Djava.library.path=${jlibnxt.path}"/>
361        <!--<jvmarg value="-XX:+PrintGCDetails"/>-->
362        <!--jvmarg value="${run.jvmargs}"/-->
363        <jvmarg value="-Xdebug"/>
364        <jvmarg value="-Xnoagent"/>
365        <jvmarg value="-Djava.compiler=none"/>
366        <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
367        <classpath>
368            <path refid="project.class.path"/>
369        </classpath>
370    </java>
371</target>   
372
373<target name="debug-selected-files" depends="compile" if="netbeans.home" description="Debug a single file in Netbeans">
374    <fail unless="classname">Must set property 'classname'</fail>
375    <nbjpdastart name="${classname}" addressproperty="jpda.address" transport="dt_socket">
376        <classpath refid="project.class.path"/>
377        <sourcepath refid="debug.sourcepath"/> 
378    </nbjpdastart>
379    <java classname="${classname}" fork="true">
380        <jvmarg value="-Xmx${heap.max_size}M"/>
381        <jvmarg value="-Djava.library.path=${jlibnxt.path}"/>
382        <!--<jvmarg value="-XX:+PrintGCDetails"/>-->
383        <!--jvmarg value="${run.jvmargs}"/-->
384        <jvmarg value="-Xdebug"/>
385        <jvmarg value="-Xnoagent"/>
386        <jvmarg value="-Djava.compiler=none"/>
387        <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
388        <classpath>
389            <path refid="project.class.path"/>
390        </classpath>
391    </java>
392</target>
393
394<!-- Profile in Netbeans 5 -->
395<target name="profile" depends="dist" description="Profile in Netbeans profiler">
396    <fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
397    <!-- Start the profiler & waint for Java VM -->
398    <nbprofiledirect>
399        <classpath refid="project.class.path"/>
400    </nbprofiledirect>
401    <!-- Start application. Use basically the same command as for running the application -->
402    <java fork="true" classname="${pcapp-main-class}" jvm="${profiler.info.jvm}">
403        <!-- Use large enough heap to fit also big images -->
404        <jvmarg value="-Xmx${heap.max_size}M"/>
405        <jvmarg value="${run.jvmargs}"/>
406        <jvmarg value="${profiler.info.jvmargs.agent}"/>
407        <classpath>
408            <path refid="project.class.path"/>
409        </classpath>
410    </java> 
411</target>   
412
413<target name="doc" description="Create Javadoc documentation">
414    <javadoc packagenames = "*"
415             destdir="docs/api"
416             author="true"
417             version="true"
418             use="true"
419             windowtitle="Freecine API documentation">
420        <fileset dir="${src-pcapp}" includes="**/*.java"/>
421        <fileset dir="${src-nxj}"/>
422        <fileset dir="${src-common}"/>
423        <classpath refid="project.class.path"/>
424        <doctitle><![CDATA[<h1>Freecine</h1>]]></doctitle>
425        <bottom><![CDATA[<i>Copyright &#169; 2007 Harri Kaimio</i>]]></bottom>
426        <tag name="todo" scope="all" description="To do:" />
427        <link href="http://java.sun.com/j2se/1.5.0/docs/api/"/>
428    </javadoc>
429</target>
430
431
432<target name="clean"
433        description="clean up" >   
434    <!-- Delete the ${build} and ${dist} directory trees -->
435    <delete dir="${build}"/>
436    <delete dir="${dist}"/>
437</target>
438
439<target name="dist-bin-tgz" depends="dist"
440        description="Creates the binary distribution">
441<property name="version" value="${build.major}.${build.minor}.${build.patch}${build.version_shorttag}"/>
442<property name="tardir" value="${project.name}-${build.major}.${build.minor}.${build.patch}${build.version_shorttag}"/>
443<tar destfile="${dist}/${project.name}-${version}.tar.gz" compression="gzip">
444    <tarfileset dir="${dist}/${project.name}-latest" prefix="${tardir}/lib">
445        <!-- Exclude JAI libraries since their license is not GPL compatible -->
446        <exclude name="**/jai_core.jar"/>
447        <exclude name="**/jai_codec.jar"/>
448    </tarfileset>
449    <tarfileset dir="." prefix="${tardir}">
450        <include name="relnotes.txt"/>
451        <include name="LICENSE.txt"/>
452    </tarfileset>
453</tar>
454</target>
455
456<target name="dist-src-tgz" depends="dist"
457        description="Creates the source distribution tar file">
458    <property name="version" value="${build.major}.${build.minor}.${build.patch}${build.version_shorttag}"/>
459    <property name="tardir" value="${project.name}-${build.major}.${build.minor}.${build.patch}"/>
460    <tar destfile="${dist}/${project.name}-src-${version}.tar.gz" compression="gzip">
461        <tarfileset dir="src" prefix="${tardir}/src">
462            <exclude name="**/.svn"/>
463        </tarfileset>
464        <tarfileset dir="lib" prefix="${tardir}/lib">
465            <exclude name="**/.svn"/>
466            <exclude name="**/jai_core.jar"/>
467            <exclude name="**/jai_codec.jar"/>
468        </tarfileset>
469        <tarfileset dir="conf" prefix="${tardir}/conf">
470            <exclude name="**/.svn"/>
471        </tarfileset>
472        <tarfileset dir="." prefix="${tardir}">
473            <include name="relnotes.txt"/>
474            <include name="LICENSE.txt"/>
475            <include name="build.xml"/>
476            <include name="build.properties"/>
477            <include name="forrest.properties"/>
478        </tarfileset>
479    </tar>
480</target>
481
482
483<target name="dist-files" depends="dist-bin-tgz,dist-src-tgz"
484        description="Creates the distribution packages"/>
485
486</project>
Note: See TracBrowser for help on using the browser.