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.0"/>
17 <property name="libVersion" value="${version}"/>
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/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"/>
48 <target name="init" depends="version">
50 <mkdir dir="${build}"/>
58 description="compiles and creates all the archives (source and binary)"
59 depends="all-linux, all-win"/>
64 <target name="all-linux"
65 description="compiles and creates all the bonary archives"
66 depends="tar-dist, zip-dist-linux, tar-src, zip-src"/>
72 <target name="all-win"
73 description="compiles and creates all the bonary archives"
74 depends="zip-dist-win, zip-src"/>
79 <target name="run-linux" description="run the application" depends="jar">
80 <java jar="${jar_file}" fork="true" dir="${dist}" classpath="${dist}" spawn="true"/>
82 <target name="run-windows" description="run the application" depends="dist-win">
83 <java jar="${jar_file}" fork="true" dir="${dist-win}" spawn="true"/>
89 <target name="compile"
91 description="compile the java sources in the 'build' directory">
93 <!-- they say fork resolves some problems on Windows -->
104 <exclude name="**/junit/*"/>
105 <exclude name="**/*Test*"/>
108 <dirset dir="${idmclib.src}"/>
109 <dirset dir="${jcommon.src}"/>
110 <dirset dir="${jfreechart.src}"/>
111 <dirset dir="${forms.src}"/>
112 <dirset dir="${log4j.src}"/>
116 <!-- files used by reflection -->
118 srcdir="${jcommon.src}"
126 <include name="org/jfree/resources/JCommonResources.java"/>
127 <include name="org/jfree/ui/about/resources/AboutResources.java"/>
131 srcdir="${jfreechart.src}"
139 <include name="org/jfree/chart/resources/JFreeChartResources.java"/>
140 <include name="org/jfree/resources/JCommonResources.java"/>
143 <!-- copy the localization bundles -->
144 <copy todir="${build}">
145 <fileset dir="${jcommon.src}">
146 <include name="**/LocalizationBundle.properties"/>
149 <fileset dir="${jfreechart.src}">
150 <include name="**/LocalizationBundle.properties"/>
156 <target name="version">
157 <copy file="${basedir}/Version.template"
158 tofile="${basedir}/${src.java}/org/tsho/dmc2/Version.java">
160 <replacetokens begintoken=" " endtoken=" ">
161 <token key="versionAnchor" value=""${version}"" />
173 description="create the jarfile in the base directory">
174 <jar jarfile="${jar_file}"
177 manifest="${src.java}/org/tsho/dmc2/dmc2.manifest">
185 <target name="dist-linux"
187 description="populate the linux distribuition directory">
189 <copy failonerror="true"
190 file="${idmclib.lib.unix}/"
194 <copy failonerror="true"
199 <copy failonerror="true"
200 file="${basedir}/README"
204 <copy failonerror="true"
205 file="${basedir}/COPYING"
209 <copy failonerror="true"
210 file="${basedir}/logo_new.jpg"
214 <mkdir dir="${dist}/doc"/>
215 <fixcrlf srcdir="${doc}"
216 destdir="${dist}/doc"
222 <mkdir dir="${dist}/models"/>
224 <fixcrlf srcdir="${models}"
225 destdir="${dist}/models"
230 <fixcrlf srcdir="${dist}"
236 <fixcrlf srcdir="${dist}"
244 <target name="dist-win"
246 description="populate the windows distribuition directory">
248 <copy failonerror="true"
249 file="${idmclib.lib.win}"
253 <copy failonerror="true"
258 <copy failonerror="true"
259 file="${basedir}/README"
263 <copy failonerror="true"
264 file="${basedir}/COPYING"
268 <copy failonerror="true"
269 file="${basedir}/logo_new.jpg"
273 <mkdir dir="${dist-win}/doc"/>
274 <fixcrlf srcdir="${doc}"
275 destdir="${dist-win}/doc"
280 <mkdir dir="${dist-win}/models"/>
282 <fixcrlf srcdir="${models}"
283 destdir="${dist-win}/models"
288 <fixcrlf srcdir="${dist-win}"
292 <fixcrlf srcdir="${dist-win}"
304 <target name="javadoc">
305 <delete dir="${javadoc}" />
306 <mkdir dir="${javadoc}" />
308 <javadoc sourcepath="."
311 doctitle="Dynamical Model Cruncher 2 (version ${version})">
313 <packageset dir="${src.java}" defaultexcludes="no"/>
322 <!-- clean targets -->
329 <target name="clean-all"
330 depends="clean-build, clean-dist, clean-archives"
331 description="clean-build, clean-dist, clean-javadoc, clean-archives"/>
337 <target name="clean-build"
338 description="remove the build directory">
339 <delete dir="${build}"/>
346 <target name="clean-dist"
347 description="remove the distribution directory">
348 <delete dir="${dist}"/>
349 <delete dir="${dist-win}"/>
354 <!-- clean-javadoc -->
357 <target name="clean-javadoc"
358 description="remove the javadoc directory" >
359 <delete dir="${javadoc}"/>
364 <!-- clean-archives -->
366 <target name="clean-archives"
367 description="remove the archives (*.bz2, *.zip)" >
369 <fileset dir="${basedir}" includes="*.bz2"/>
370 <fileset dir="${basedir}" includes="*.zip"/>
371 <fileset dir="${basedir}" includes="*.jar"/>
372 <fileset dir="${basedir}" includes="*.exe"/>
380 <target name="clean-stale"
381 description="clean up stale .class files in src" >
383 <fileset dir="${src.java}" includes="**/*.class"/>
389 <!-- archive targets -->
392 <!-- sources patternset -->
393 <patternset id="sources">
394 <exclude name="**/*.aux"/>
395 <exclude name="**/*.dvi"/>
396 <exclude name="**/*.log"/>
397 <exclude name="doc/snapshots/"/>
398 <exclude name="build-eclipse/"/>
399 <exclude name="${javadoc}/"/>
400 <exclude name="${build}/"/>
401 <exclude name="${dist}/"/>
402 <exclude name="${dist-win}/"/>
403 <exclude name="**/.*"/>
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"/>
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"
427 <tarfileset dir="${basedir}" prefix="${prefix}">
428 <patternset refid="sources"/>
439 <target name="tar-dist"
441 description="create the distribution tar archive">
443 <property name="prefix" value="${name}-${version}"/>
445 <tar destfile="${name}-${version}-bin.tar.bz2"
448 <tarfileset dir="${dist}" prefix="${prefix}"/>
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"/>
474 <!-- zip-dist-linux -->
476 <target name="zip-dist-linux"
477 description="create the linux distribution zip archive"
478 depends="dist-linux">
480 <zip destfile="${name}-${version}-linux.zip">
481 <zipfileset dir="${dist}"
482 prefix="${name}-${version}"
490 <!-- zip-dist-win -->
492 <target name="zip-dist-win"
493 description="create the windows distribution zip archive"
496 <zip destfile="${name}-${version}-win.zip">
497 <zipfileset dir="${dist-win}"
498 prefix="${name}-${version}"
506 <!-- cross-win-installer -->
508 <target name="cross-win-installer"
509 description="create the windows installer package from linux with wine"
512 <copy failonerror="true"
513 file="${basedir}/misc/dmcDue.nsi"
521 <arg value="/opt/NSIS-2.0/makensis.exe"/>
522 <arg value="dmcDue.nsi"/>
525 <move failonerror="true"
529 <fileset dir="${dist-win}">
530 <include name="**/*.exe"/>