fixed variation option in trajectory plot
[iDMC.git] / build.xml
blob2549e909aac3c22bfb1350a44c1454cc1a40af70
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.6"/>
17     <property name="libVersion" value="0.7.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="**/*.class"/>
404         <exclude name="**/*.o"/>
405         <exclude name="**/*.d"/>
406         <exclude name="**/*.so"/>
407         <exclude name="**/*.dll"/>
408         <exclude name="**/*.jar"/>
409         <exclude name="**/*.tar*"/>
410         <exclude name="**/*.zip"/>
411         <exclude name="**/*.exe"/>
412     </patternset>
415     <!--         -->
416     <!-- tar-src -->
417     <!--         -->
418     <target name="tar-src" 
419                 description="create the source tar archive">
421         <property name="prefix" value="${name}-${version}"/>
423         <tar destfile="${name}-${version}-src.tar.bz2"
424              compression="bzip2">
426         <tarfileset dir="${basedir}" prefix="${prefix}">
427             <patternset refid="sources"/>
428         </tarfileset>
430         </tar>
432     </target>  
435     <!--          -->
436     <!-- tar-dist -->
437     <!--          -->
438     <target name="tar-dist" 
439             depends="dist"
440             description="create the distribution tar archive">
442         <property name="prefix" value="${name}-${version}"/>
444         <tar destfile="${name}-${version}-bin.tar.bz2"
445              compression="bzip2">
447         <tarfileset dir="${dist}" prefix="${prefix}"/>
449         </tar>
451     </target>  
454     <!--         -->
455     <!-- zip-src -->
456     <!--         -->
457     <target name="zip-src" 
458             description="create the source zip archive">
460         <zip destfile="${name}-${version}-src.zip">
462             <zipfileset dir="${basedir}"
463                         prefix="${name}-${version}">
464                 <patternset refid="sources"/>
465             </zipfileset>
467         </zip>
469     </target> 
472     <!--                -->
473     <!-- zip-dist       -->
474     <!--                -->
475     <target name="zip-dist"
476             description="create the linux distribution zip archive"
477             depends="dist">
479         <zip destfile="${name}-${version}-linux.zip">
480             <zipfileset dir="${dist}"
481                         prefix="${name}-${version}"
482             />
483         </zip>
485     </target>  
488     <!--              -->
489     <!-- zip-dist-win -->
490     <!--              -->
491     <target name="zip-dist-win"
492             description="create the windows distribution zip archive"
493             depends="dist-win">
495         <zip destfile="${name}-${version}-win.zip">
496             <zipfileset dir="${dist-win}"
497                         prefix="${name}-${version}"
498             />
499         </zip>
501     </target>  
504     <!--                     -->
505     <!-- cross-win-installer -->
506     <!--                     -->
507     <target name="cross-win-installer"
508             description="create the windows installer package from linux with wine"
509             depends="dist-win">
511         <copy failonerror="true"
512               file="${basedir}/misc/dmcDue.nsi"
513               todir="${dist-win}"
514               overwrite="yes"/>
516         <exec os="Linux"
517               dir="dist-win"
518               executable="wine">
520               <arg value="/opt/NSIS-2.0/makensis.exe"/>
521               <arg value="dmcDue.nsi"/>
522         </exec>
524         <move failonerror="true"
525               todir="${basedir}"
526               overwrite="yes">
528             <fileset dir="${dist-win}">
529                 <include name="**/*.exe"/>
530             </fileset>
531         </move>
532      </target>  
534 </project>