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 -->
9 <project name="dmcDue" default="jar" basedir=".">
15 <property name="name" value="iDmc"/>
16 <property name="version" value="2.0.2"/>
17 <property name="libVersion" value="0.1.1"/>
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}/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"/>
36 <property name="idmclib.lib.unix" value="${idmclib.src}/idmc.so"/>
37 <property name="idmclib.lib.win" value="${idmclib.src}/idmc.dll"/>
38 <property name="jar_file" value="${basedir}/iDmc-${version}.jar"/>
47 <target name="init" depends="version">
49 <mkdir dir="${build}"/>
57 description="compiles and creates all the archives (source and binary)"
58 depends="all-linux, all-win"/>
63 <target name="all-linux"
64 description="compiles and creates all the bonary archives"
65 depends="tar-dist, zip-dist-linux, tar-src, zip-src"/>
71 <target name="all-win"
72 description="compiles and creates all the bonary archives"
73 depends="zip-dist-win, zip-src"/>
78 <target name="run-linux" description="run the application" depends="jar">
79 <java jar="${jar_file}" fork="true" dir="${dist}" classpath="${dist}" spawn="true"/>
81 <target name="run-windows" description="run the application" depends="dist-win">
82 <java jar="${jar_file}" fork="true" dir="${dist-win}" spawn="true"/>
88 <target name="compile"
90 description="compile the java sources in the 'build' directory">
92 <!-- they say fork resolves some problems on Windows -->
103 <exclude name="**/junit/*"/>
104 <exclude name="**/*Test*"/>
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}"/>
114 <!-- files used by reflection -->
116 srcdir="${jcommon.src}"
124 <include name="org/jfree/resources/JCommonResources.java"/>
125 <include name="org/jfree/ui/about/resources/AboutResources.java"/>
129 srcdir="${jfreechart.src}"
137 <include name="org/jfree/chart/resources/JFreeChartResources.java"/>
138 <include name="org/jfree/resources/JCommonResources.java"/>
141 <!-- copy the localization bundles -->
142 <copy todir="${build}">
143 <fileset dir="${jcommon.src}">
144 <include name="**/LocalizationBundle.properties"/>
146 <fileset dir="${jfreechart.src}">
147 <include name="**/LocalizationBundle.properties"/>
153 <target name="version">
154 <copy file="${basedir}/Version.template"
155 tofile="${basedir}/${src.java}/org/tsho/dmc2/Version.java">
157 <replacetokens begintoken=" " endtoken=" ">
158 <token key="versionAnchor" value=""${version}"" />
170 description="create the jarfile in the base directory">
171 <jar jarfile="${jar_file}"
174 manifest="${src.java}/org/tsho/dmc2/dmc2.manifest">
182 <target name="dist-linux"
184 description="populate the linux distribuition directory">
186 <copy failonerror="true"
187 file="${idmclib.lib.unix}/"
191 <copy failonerror="true"
196 <copy failonerror="true"
197 file="${basedir}/README"
201 <copy failonerror="true"
202 file="${basedir}/COPYING"
206 <copy failonerror="true"
207 file="${basedir}/logo_new.jpg"
211 <mkdir dir="${dist}/doc"/>
212 <fixcrlf srcdir="${doc}"
213 destdir="${dist}/doc"
219 <mkdir dir="${dist}/models"/>
221 <fixcrlf srcdir="${models}"
222 destdir="${dist}/models"
227 <fixcrlf srcdir="${dist}"
233 <fixcrlf srcdir="${dist}"
240 <target name="dist-win"
242 description="populate the windows distribuition directory">
244 <copy failonerror="true"
245 file="${idmclib.lib.win}"
249 <copy failonerror="true"
254 <copy failonerror="true"
255 file="${basedir}/README"
259 <copy failonerror="true"
260 file="${basedir}/COPYING"
264 <copy failonerror="true"
265 file="${basedir}/logo_new.jpg"
269 <mkdir dir="${dist-win}/doc"/>
270 <fixcrlf srcdir="${doc}"
271 destdir="${dist-win}/doc"
276 <mkdir dir="${dist-win}/models"/>
278 <fixcrlf srcdir="${models}"
279 destdir="${dist-win}/models"
284 <fixcrlf srcdir="${dist-win}"
288 <fixcrlf srcdir="${dist-win}"
298 <target name="javadoc">
299 <delete dir="${javadoc}" />
300 <mkdir dir="${javadoc}" />
302 <javadoc sourcepath="."
305 doctitle="Dynamical Model Cruncher 2 (version ${version})">
306 <packageset dir="${src.java}" defaultexcludes="no"/>
313 <!-- clean targets -->
320 <target name="clean-all"
321 depends="clean-build, clean-dist, clean-javadoc, clean-archives"
322 description="clean-build, clean-dist, clean-javadoc, clean-archives"/>
328 <target name="clean-build"
329 description="remove the build directory">
330 <delete dir="${build}"/>
337 <target name="clean-dist"
338 description="remove the distribution directory">
339 <delete dir="${dist}"/>
340 <delete dir="${dist-win}"/>
345 <!-- clean-javadoc -->
347 <target name="clean-javadoc"
348 description="remove the javadoc directory" >
349 <delete dir="${javadoc}"/>
353 <!-- clean-archives -->
355 <target name="clean-archives"
356 description="remove the archives (*.bz2, *.zip)" >
358 <fileset dir="${basedir}" includes="*.bz2"/>
359 <fileset dir="${basedir}" includes="*.zip"/>
360 <fileset dir="${basedir}" includes="*.jar"/>
361 <fileset dir="${basedir}" includes="*.exe"/>
369 <target name="clean-stale"
370 description="clean up stale .class files in src" >
372 <fileset dir="${src.java}" includes="**/*.class"/>
378 <!-- archive targets -->
381 <!-- sources patternset -->
382 <patternset id="sources">
383 <exclude name="**/*.aux"/>
384 <exclude name="**/*.dvi"/>
385 <exclude name="**/*.log"/>
386 <exclude name="doc/snapshots/"/>
387 <exclude name="build-eclipse/"/>
388 <exclude name="${javadoc}/"/>
389 <exclude name="${build}/"/>
390 <exclude name="${dist}/"/>
391 <exclude name="${dist-win}/"/>
392 <exclude name="**/.*"/>
393 <exclude name="**/*.class"/>
394 <exclude name="**/*.o"/>
395 <exclude name="**/*.d"/>
396 <exclude name="**/*.so"/>
397 <exclude name="**/*.dll"/>
398 <exclude name="**/*.jar"/>
399 <exclude name="**/*.tar*"/>
400 <exclude name="**/*.zip"/>
401 <exclude name="**/*.exe"/>
408 <target name="tar-src"
409 description="create the source tar archive">
411 <property name="prefix" value="${name}-${version}"/>
413 <tar destfile="${name}-${version}-src.tar.bz2"
416 <tarfileset dir="${basedir}" prefix="${prefix}">
417 <patternset refid="sources"/>
428 <target name="tar-dist"
430 description="create the distribution tar archive">
432 <property name="prefix" value="${name}-${version}"/>
434 <tar destfile="${name}-${version}-bin.tar.bz2"
437 <tarfileset dir="${dist}" prefix="${prefix}"/>
447 <target name="zip-src"
448 description="create the source zip archive">
450 <zip destfile="${name}-${version}-src.zip">
452 <zipfileset dir="${basedir}"
453 prefix="${name}-${version}">
454 <patternset refid="sources"/>
463 <!-- zip-dist-linux -->
465 <target name="zip-dist-linux"
466 description="create the linux distribution zip archive"
467 depends="dist-linux">
469 <zip destfile="${name}-${version}-linux.zip">
470 <zipfileset dir="${dist}"
471 prefix="${name}-${version}"
479 <!-- zip-dist-win -->
481 <target name="zip-dist-win"
482 description="create the windows distribution zip archive"
485 <zip destfile="${name}-${version}-win.zip">
486 <zipfileset dir="${dist-win}"
487 prefix="${name}-${version}"
495 <!-- cross-win-installer -->
497 <target name="cross-win-installer"
498 description="create the windows installer package from linux with wine"
501 <copy failonerror="true"
502 file="${basedir}/misc/dmcDue.nsi"
510 <arg value="/opt/NSIS-2.0/makensis.exe"/>
511 <arg value="dmcDue.nsi"/>
514 <move failonerror="true"
518 <fileset dir="${dist-win}">
519 <include name="**/*.exe"/>