fixed traj. plot bug when manual bounds
[iDMC.git] / build.xml
blob6b45bd0aca61ad892ae5ec0f99a12150bd91c8fc
1 <?xml version="1.0"?>
3 <!-- -->
4 <!--  Ant file for dmcDue -->
5 <!--  Written by Daniele Pizzoni <auouo@tin.it> - 2003 -->
6 <!--  Modified by Antonio, Fabio Di Narzo <antonio.fabio@gmail.com> - 2006,2007 -->
7 <!-- -->
9 <project name="dmcDue" default="jar" basedir=".">
11 <!--            -->
12 <!-- properties -->
13 <!--            -->
15     <property name="name"    value="iDmc"/>
16     <property name="version" value="2.0.9"/>
17     <property name="libVersion" value="0.9.0"/>
19     <!-- directories -->
20     <property name="src.java"  value="src/java"/>
21     <property name="build"     value="build"/>
22     <property name="dist"      value="dist"/>
23     <property name="dist-win"  value="dist-win"/>
24     <property name="javadoc"   value="javadoc"/>
25     <property name="doc"    value="doc"/>
26     <property name="models"    value="models"/>
28     <!-- external sources -->
29     <property name="idmclib.src"    location="../idmclib-${libVersion}-Source/build/jidmc"/>
30     <property name="jcommon.src"    location="../jcommon-0.9.3/src"/>
31     <property name="jfreechart.src" location="../jfreechart-0.9.18/src"/>
32     <property name="forms.src"      location="../forms-1.0.3/src/jforms"/>
33     <property name="log4j.src"      location="../logging-log4j-1.2.14/src/java"/>
35     <!-- files -->
36     <property name="idmclib.lib.unix" value="${idmclib.src}/jidmclib.so"/>
37     <property name="idmclib.lib.win" value="${idmclib.src}/jidmclib.dll"/>
38     <property name="jar_file"      value="${basedir}/${name}.jar"/>
40 <!--              -->
41 <!-- work targets -->
42 <!--              -->
44     <!--      -->
45     <!-- init -->
46     <!--      -->
47     <target name="init" depends="version">
48             <tstamp/>
49         <mkdir dir="${build}"/>
50     </target>
52         
53     <!--     -->
54     <!-- all -->
55     <!--     -->
56     <target name="all"
57                 description="compiles and creates all the archives (source and binary)"
58                 depends="all-linux, all-win"/>
60     <!--           -->
61     <!-- all-linux -->
62     <!--           -->
63     <target name="all-linux"
64                 description="compiles and creates all the bonary archives"
65                 depends="tar-dist, zip-dist, tar-src, zip-src"/>
68     <!--         -->
69     <!-- all-win -->
70     <!--         -->
71     <target name="all-win"
72                 description="compiles and creates all the bonary archives"
73                 depends="zip-dist-win, zip-src"/>
75     <!--         -->
76     <!-- run     -->
77     <!--         -->
78     <target name="run-linux" description="run the application" depends="dist">
79         <java jar="${jar_file}" fork="true" dir="${dist}" classpath="${dist}" spawn="true"/>
80     </target>
81     <target name="run-windows" description="run the application" depends="dist-win">
82         <java jar="${jar_file}" fork="true" dir="${dist-win}" spawn="true"/>
83     </target>
85     <!--         -->
86     <!-- compile -->
87     <!--         -->
88     <target name="compile"
89                 depends="init, version"
90                 description="compile the java sources in the 'build' directory">
92         <!-- they say fork resolves some problems on Windows -->
93         <javac
94             srcdir="${src.java}"
95             destdir="${build}"
96             deprecation="yes"
97             failonerror="no"
98             fork="true"
99             target="1.4"
100             source="1.4"
101                 debug="yes"
102         >
103             <exclude name="**/junit/*"/>
104             <exclude name="**/*Test*"/>
105             
106             <sourcepath>
107                 <dirset dir="${idmclib.src}"/>
108                 <dirset dir="${jcommon.src}"/>
109                 <dirset dir="${jfreechart.src}"/>
110                 <dirset dir="${forms.src}"/>
111                 <dirset dir="${log4j.src}"/>
112             </sourcepath>
113         </javac>
114                 <!-- files used by reflection -->
115             <javac
116                 srcdir="${jcommon.src}"
117             destdir="${build}"
118             deprecation="yes"
119             failonerror="no"
120             fork="true" 
121             target="1.4"
122             source="1.4"
123             >
124                 <include name="org/jfree/resources/JCommonResources.java"/>
125                 <include name="org/jfree/ui/about/resources/AboutResources.java"/>
126         </javac>
128         <javac
129                 srcdir="${jfreechart.src}"
130             destdir="${build}"
131             deprecation="yes"
132             failonerror="no"
133             fork="true" 
134             target="1.4"
135             source="1.4"
136         >
137                 <include name="org/jfree/chart/resources/JFreeChartResources.java"/>
138                 <include name="org/jfree/resources/JCommonResources.java"/>
139         </javac>
141         <!-- copy the localization bundles -->
142         <copy todir="${build}">
143                 <fileset dir="${jcommon.src}">
144                         <include name="**/LocalizationBundle.properties"/>
145                 </fileset>
146                 <fileset dir="${jfreechart.src}">
147                         <include name="**/LocalizationBundle.properties"/>
148                 </fileset>
149         </copy>
151     </target>
152     
153     <target name="version">
154         <copy file="${basedir}/Version.template"
155             tofile="${basedir}/${src.java}/org/tsho/dmc2/Version.java">
156           <filterchain>
157               <replacetokens begintoken=" " endtoken=" ">
158                   <token key="versionAnchor" value="&quot;${version}&quot;" />
159               </replacetokens>
160           </filterchain>
161         </copy>
162     </target>
165     <!--     -->
166     <!-- jar -->
167     <!--     -->
168     <target name="jar"
169             depends="compile"
170             description="create the jarfile in the base directory">
171         <jar jarfile="${jar_file}"
172              basedir="${build}"
173              index="yes"
174              manifest="${src.java}/org/tsho/dmc2/dmc2.manifest">
175         </jar>
176     </target>
179     <!--                                    -->
180     <!-- dist target for non-win32 platforms-->
181     <!--                                    -->
182     <target name="dist"
183             depends="jar"
184             description="populate the linux distribuition directory">
185                         
186         <copy failonerror="true"
187             file="${idmclib.lib.unix}/"
188             todir="${dist}"
189           overwrite="yes"/>
191         <copy failonerror="true"
192               file="${jar_file}/"
193               tofile="${dist}/${name}-${version}.jar"
194               overwrite="yes"/>
196         <copy failonerror="true"
197               file="${basedir}/README"
198               todir="${dist}"
199               overwrite="yes"/>
201         <copy failonerror="true"
202               file="${basedir}/NEWS"
203               todir="${dist}"
204               overwrite="yes"/>
206         <copy failonerror="true"
207               file="${basedir}/COPYING"
208               todir="${dist}"
209               overwrite="yes"/>
210         
211         <copy failonerror="true"
212               file="${basedir}/logo_new.jpg"
213               todir="${dist}"
214               overwrite="yes"/>
216         <mkdir dir="${dist}/doc"/>
217         <fixcrlf srcdir="${doc}"
218                 destdir="${dist}/doc"
219                 eol="lf"
220                 eof="remove"
221         />
224         <mkdir dir="${dist}/models"/>
226         <fixcrlf srcdir="${models}"
227                  destdir="${dist}/models"
228                  eol="lf"
229                  eof="remove"
230         />
232         <fixcrlf srcdir="${dist}"
233                  eol="lf"
234                  eof="remove"
235                  includes="README"
236         />
238         <fixcrlf srcdir="${dist}"
239                  eol="lf"
240                  eof="remove"
241                  includes="COPYING"
242         />
243     </target>
245     <target name="dist-win"
246             depends="jar"
247             description="populate the windows distribuition directory">
248                         
249         <copy failonerror="true"
250             file="${idmclib.lib.win}"
251             todir="${dist-win}"
252         overwrite="yes"/>
254         <copy failonerror="true"
255               file="${jar_file}/"
256               tofile="${dist-win}/${name}-${version}.jar"
257               overwrite="yes"/>
259         <copy failonerror="true"
260               file="${basedir}/README"
261               todir="${dist-win}"
262               overwrite="yes"/>
264         <copy failonerror="true"
265               file="${basedir}/NEWS"
266               todir="${dist-win}"
267               overwrite="yes"/>
268         
269         <copy failonerror="true"
270               file="${basedir}/COPYING"
271               todir="${dist-win}"
272               overwrite="yes"/>
274         <copy failonerror="true"
275               file="${basedir}/logo_new.jpg"
276               todir="${dist-win}"
277               overwrite="yes"/>         
279         <mkdir dir="${dist-win}/doc"/>
280         <fixcrlf srcdir="${doc}"
281                  destdir="${dist-win}/doc"
282                  eol="crlf"
283                  eof="remove"
284         />
286         <mkdir dir="${dist-win}/models"/>
288         <fixcrlf srcdir="${models}"
289                  destdir="${dist-win}/models"
290                  eol="crlf"
291                  eof="remove"
292         />
294         <fixcrlf srcdir="${dist-win}"
295                  eol="crlf"
296                  includes="README"
297         />
298         <fixcrlf srcdir="${dist-win}"
299                  eol="crlf"
300                  includes="COPYING"
301         />
302     </target>
305     <!--         -->
306     <!-- javadoc -->
307     <!--         -->
308     <target name="javadoc">
309         <delete dir="${javadoc}" />
310         <mkdir dir="${javadoc}" />
312         <javadoc sourcepath="."
313                  classpath="."
314                 destdir="${javadoc}"
315                 doctitle="Dynamical Model Cruncher 2 (version ${version})">
316             <packageset dir="${src.java}" defaultexcludes="no"/>
317         </javadoc>
319     </target>
322 <!--               -->
323 <!-- clean targets -->
324 <!--               -->
327     <!--           -->
328     <!-- clean-all -->
329     <!--           -->
330     <target name="clean-all"
331                 depends="clean-build, clean-dist, clean-javadoc, clean-archives"
332                 description="clean-build, clean-dist, clean-javadoc, clean-archives"/>
335     <!--             -->
336     <!-- clean-build -->
337     <!--             -->
338     <target name="clean-build"
339                 description="remove the build directory">
340         <delete dir="${build}"/>
341         <delete file="${src.java}/org/tsho/dmc2/Version.java"/>
342     </target>
344     <!--            -->
345     <!-- clean-dist -->
346     <!--            -->
347     <target name="clean-dist"
348                 description="remove the distribution directory">
349         <delete dir="${dist}"/>
350         <delete dir="${dist-win}"/>
351     </target>
354     <!--               -->
355     <!-- clean-javadoc -->
356     <!--               -->
357     <target name="clean-javadoc" 
358                 description="remove the javadoc directory" >
359         <delete dir="${javadoc}"/>
360     </target>
362     <!--                -->
363     <!-- clean-archives -->
364     <!--                -->
365     <target name="clean-archives"
366                 description="remove the archives (*.bz2, *.zip)" >
367         <delete>
368                 <fileset dir="${basedir}" includes="*.bz2"/>
369                 <fileset dir="${basedir}" includes="*.zip"/>
370                 <fileset dir="${basedir}" includes="*.jar"/>
371                 <fileset dir="${basedir}" includes="*.exe"/>
372         </delete>
373     </target>
376     <!--             -->
377     <!-- clean-stale -->
378     <!--             -->
379     <target name="clean-stale"
380                 description="clean up stale .class files in src" >
381             <delete>
382                 <fileset dir="${src.java}" includes="**/*.class"/>
383             </delete>
384     </target>  
387 <!--                 -->
388 <!-- archive targets -->
389 <!--                 -->
391     <!-- sources patternset -->
392     <patternset id="sources">
393         <exclude name="**/*.aux"/>
394         <exclude name="**/*.dvi"/>
395         <exclude name="**/*.log"/>
396         <exclude name="doc/snapshots/"/>
397         <exclude name="build-eclipse/"/>
398         <exclude name="${javadoc}/"/>
399         <exclude name="${build}/"/>
400         <exclude name="${dist}/"/>
401         <exclude name="${dist-win}/"/>
402         <exclude name="**/.*"/>
403         <exclude name=".git/**"/>
404         <exclude name="**/*.class"/>
405         <exclude name="**/*.o"/>
406         <exclude name="**/*.d"/>
407         <exclude name="**/*.so"/>
408         <exclude name="**/*.dll"/>
409         <exclude name="**/*.jar"/>
410         <exclude name="**/*.tar*"/>
411         <exclude name="**/*.zip"/>
412         <exclude name="**/*.exe"/>
413     </patternset>
416     <!--         -->
417     <!-- tar-src -->
418     <!--         -->
419     <target name="tar-src" 
420                 description="create the source tar archive">
422         <property name="prefix" value="${name}-${version}"/>
424         <tar destfile="${name}-${version}-src.tar.bz2"
425              compression="bzip2">
427         <tarfileset dir="${basedir}" prefix="${prefix}">
428             <patternset refid="sources"/>
429         </tarfileset>
431         </tar>
433     </target>  
436     <!--          -->
437     <!-- tar-dist -->
438     <!--          -->
439     <target name="tar-dist" 
440             depends="dist"
441             description="create the distribution tar archive">
443         <property name="prefix" value="${name}-${version}"/>
445         <tar destfile="${name}-${version}-bin.tar.bz2"
446              compression="bzip2">
448         <tarfileset dir="${dist}" prefix="${prefix}"/>
450         </tar>
452     </target>  
455     <!--         -->
456     <!-- zip-src -->
457     <!--         -->
458     <target name="zip-src" 
459             description="create the source zip archive">
461         <zip destfile="${name}-${version}-src.zip">
463             <zipfileset dir="${basedir}"
464                         prefix="${name}-${version}">
465                 <patternset refid="sources"/>
466             </zipfileset>
468         </zip>
470     </target> 
473     <!--                -->
474     <!-- zip-dist       -->
475     <!--                -->
476     <target name="zip-dist"
477             description="create the linux distribution zip archive"
478             depends="dist">
480         <zip destfile="${name}-${version}-linux.zip">
481             <zipfileset dir="${dist}"
482                         prefix="${name}-${version}"
483             />
484         </zip>
486     </target>  
489     <!--              -->
490     <!-- zip-dist-win -->
491     <!--              -->
492     <target name="zip-dist-win"
493             description="create the windows distribution zip archive"
494             depends="dist-win">
496         <zip destfile="${name}-${version}-win.zip">
497             <zipfileset dir="${dist-win}"
498                         prefix="${name}-${version}"
499             />
500         </zip>
502     </target>  
505     <!--                     -->
506     <!-- cross-win-installer -->
507     <!--                     -->
508     <target name="cross-win-installer"
509             description="create the windows installer package from linux with wine"
510             depends="dist-win">
512         <copy failonerror="true"
513               file="${basedir}/misc/dmcDue.nsi"
514               todir="${dist-win}"
515               overwrite="yes"/>
517         <exec os="Linux"
518               dir="dist-win"
519               executable="wine">
521               <arg value="/opt/NSIS-2.0/makensis.exe"/>
522               <arg value="dmcDue.nsi"/>
523         </exec>
525         <move failonerror="true"
526               todir="${basedir}"
527               overwrite="yes">
529             <fileset dir="${dist-win}">
530                 <include name="**/*.exe"/>
531             </fileset>
532         </move>
533      </target>  
535 </project>