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 -->
9 <project name="dmcDue" default="jar" basedir=".">
15 <property name="name" value="iDmc"/>
16 <property name="version" value="2.0.9"/>
17 <property name="libVersion" value="0.9.0"/>
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"/>
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"/>
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, 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="dist">
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"
89 depends="init, version"
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">
180 <!-- dist target for non-win32 platforms-->
184 description="populate the linux distribuition directory">
186 <copy failonerror="true"
187 file="${idmclib.lib.unix}/"
191 <copy failonerror="true"
193 tofile="${dist}/${name}-${version}.jar"
196 <copy failonerror="true"
197 file="${basedir}/README"
201 <copy failonerror="true"
202 file="${basedir}/NEWS"
206 <copy failonerror="true"
207 file="${basedir}/COPYING"
211 <copy failonerror="true"
212 file="${basedir}/logo_new.jpg"
216 <mkdir dir="${dist}/doc"/>
217 <fixcrlf srcdir="${doc}"
218 destdir="${dist}/doc"
224 <mkdir dir="${dist}/models"/>
226 <fixcrlf srcdir="${models}"
227 destdir="${dist}/models"
232 <fixcrlf srcdir="${dist}"
238 <fixcrlf srcdir="${dist}"
245 <target name="dist-win"
247 description="populate the windows distribuition directory">
249 <copy failonerror="true"
250 file="${idmclib.lib.win}"
254 <copy failonerror="true"
256 tofile="${dist-win}/${name}-${version}.jar"
259 <copy failonerror="true"
260 file="${basedir}/README"
264 <copy failonerror="true"
265 file="${basedir}/NEWS"
269 <copy failonerror="true"
270 file="${basedir}/COPYING"
274 <copy failonerror="true"
275 file="${basedir}/logo_new.jpg"
279 <mkdir dir="${dist-win}/doc"/>
280 <fixcrlf srcdir="${doc}"
281 destdir="${dist-win}/doc"
286 <mkdir dir="${dist-win}/models"/>
288 <fixcrlf srcdir="${models}"
289 destdir="${dist-win}/models"
294 <fixcrlf srcdir="${dist-win}"
298 <fixcrlf srcdir="${dist-win}"
308 <target name="javadoc">
309 <delete dir="${javadoc}" />
310 <mkdir dir="${javadoc}" />
312 <javadoc sourcepath="."
315 doctitle="Dynamical Model Cruncher 2 (version ${version})">
316 <packageset dir="${src.java}" defaultexcludes="no"/>
323 <!-- clean targets -->
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"/>
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"/>
347 <target name="clean-dist"
348 description="remove the distribution directory">
349 <delete dir="${dist}"/>
350 <delete dir="${dist-win}"/>
355 <!-- clean-javadoc -->
357 <target name="clean-javadoc"
358 description="remove the javadoc directory" >
359 <delete dir="${javadoc}"/>
363 <!-- clean-archives -->
365 <target name="clean-archives"
366 description="remove the archives (*.bz2, *.zip)" >
368 <fileset dir="${basedir}" includes="*.bz2"/>
369 <fileset dir="${basedir}" includes="*.zip"/>
370 <fileset dir="${basedir}" includes="*.jar"/>
371 <fileset dir="${basedir}" includes="*.exe"/>
379 <target name="clean-stale"
380 description="clean up stale .class files in src" >
382 <fileset dir="${src.java}" includes="**/*.class"/>
388 <!-- archive targets -->
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"/>
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"/>
476 <target name="zip-dist"
477 description="create the linux distribution zip archive"
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"/>