| 1 | <!-- |
|---|
| 2 | Copyright (c) 2006 Harri Kaimio |
|---|
| 3 | |
|---|
| 4 | This file is part of Photovault. |
|---|
| 5 | |
|---|
| 6 | Photovault is free software; you can redistribute it and/or modify it |
|---|
| 7 | under the terms of the GNU General Public License as published by |
|---|
| 8 | the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | (at your option) any later version. |
|---|
| 10 | |
|---|
| 11 | Photovault is distributed in the hope that it will be useful, but |
|---|
| 12 | WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 14 | General Public License for more details. |
|---|
| 15 | |
|---|
| 16 | You should have received a copy of the GNU General Public License |
|---|
| 17 | along with Photovault; if not, write to the Free Software Foundation, |
|---|
| 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|---|
| 19 | --> |
|---|
| 20 | <project name="Photovault" default="dist" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant"> |
|---|
| 21 | <description> |
|---|
| 22 | Photovault image organization system |
|---|
| 23 | </description> |
|---|
| 24 | <!-- set global properties for this build --> |
|---|
| 25 | <property name="src" location="src/main/java"/> |
|---|
| 26 | <property name="nsis-src" value="src/main/win32/installer"/> |
|---|
| 27 | <property name="dist" location="dist"/> |
|---|
| 28 | <property name="lib" location="lib"/> |
|---|
| 29 | <property name="basedir" location="."/> |
|---|
| 30 | <property name="junittest.properties" value="junittest.properties"/> |
|---|
| 31 | <property name="junittest.configfile" value="conf/junittest_config.xml"/> |
|---|
| 32 | <property file="build.properties"/> |
|---|
| 33 | <property name="ivy.jar.dir" location="ivy"/> |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | <!-- Coberture class definition --> |
|---|
| 37 | <path id="cobertura-path"> |
|---|
| 38 | <path location="${lib}/cobertura/cobertura.jar" /> |
|---|
| 39 | <path location="${lib}/log4j.jar"/> |
|---|
| 40 | <path location="${lib}/cobertura/asm-2.2.1.jar"/> |
|---|
| 41 | <path location="${lib}/cobertura/asm-tree-2.2.1.jar"/> |
|---|
| 42 | <path location="${lib}/cobertura/jakarta-oro-2.0.8.jar"/> |
|---|
| 43 | </path> |
|---|
| 44 | <taskdef classpathref="cobertura-path" resource="tasks.properties"/> |
|---|
| 45 | |
|---|
| 46 | <path id="runtime.path"> |
|---|
| 47 | <fileset id="runtime.fileset" dir="${build.lib.dir}"> |
|---|
| 48 | <include name="*"/> |
|---|
| 49 | </fileset> |
|---|
| 50 | </path> |
|---|
| 51 | <path id="project.class.path"> |
|---|
| 52 | <fileset dir="${build.lib.dir}"> |
|---|
| 53 | <include name="**/*.jar"/> |
|---|
| 54 | <exclude name="**/checkstyle*.jar"/> |
|---|
| 55 | </fileset> |
|---|
| 56 | <pathelement path="${java.class.path}/"/> |
|---|
| 57 | <pathelement path="${build.classes.dir}"/> |
|---|
| 58 | <pathelement path="${build.resource.dir}"/> |
|---|
| 59 | <pathelement path="conf"/> |
|---|
| 60 | <pathelement path="src/main/resources"/> |
|---|
| 61 | </path> |
|---|
| 62 | <path id="debug.sourcepath" > |
|---|
| 63 | <pathelement path="src/main/java"/> |
|---|
| 64 | <pathelement path="src/test/java"/> |
|---|
| 65 | </path> |
|---|
| 66 | <property environment="env"/> |
|---|
| 67 | |
|---|
| 68 | <!-- Hibernate tools task definitions --> |
|---|
| 69 | <target name="-hibernate-tool-task"> |
|---|
| 70 | <path id="toolslib"> |
|---|
| 71 | <path location="lib/hibernate-tools.jar" /> |
|---|
| 72 | <path location="lib/hibernate3.jar" /> |
|---|
| 73 | <path location="lib/freemarker.jar" /> |
|---|
| 74 | <path location="lib/derby.jar" /> |
|---|
| 75 | <path location="lib/log4j.jar" /> |
|---|
| 76 | <path location="lib/commons-logging.jar" /> |
|---|
| 77 | <path refid="project.class.path" /> |
|---|
| 78 | </path> |
|---|
| 79 | <taskdef name="hibernatetool" |
|---|
| 80 | classname="org.hibernate.tool.ant.HibernateToolTask" |
|---|
| 81 | classpathref="toolslib" /> |
|---|
| 82 | </target> |
|---|
| 83 | <target name="check-svn" description="Check whether Subversion is installed"> |
|---|
| 84 | <available property="svn.installed" file="svn" filepath="${env.PATH}"/> |
|---|
| 85 | <echo message="Subversion installed: ${svn.installed}"/> |
|---|
| 86 | </target> |
|---|
| 87 | <target name="init-svn" if="svn.installed" depends="check-svn" |
|---|
| 88 | description="Initialize Subversion state related variables"> |
|---|
| 89 | <!-- Get SCM information & store it into buildinfo.properties --> |
|---|
| 90 | <exec executable="svnversion" outputproperty="svnrevision" failifexecutionfails="false"> |
|---|
| 91 | <arg line="."/> |
|---|
| 92 | </exec> |
|---|
| 93 | <echo message="SVN revision: ${svnrevision}"/> |
|---|
| 94 | <echo message="SVN URL: ${svn.info.url}"/> |
|---|
| 95 | </target> |
|---|
| 96 | |
|---|
| 97 | |
|---|
| 98 | <target name="init-ivy"> |
|---|
| 99 | <path id="ivy.lib.path"> |
|---|
| 100 | <fileset dir="${ivy.jar.dir}" includes="*.jar"/> |
|---|
| 101 | |
|---|
| 102 | </path> |
|---|
| 103 | <taskdef resource="org/apache/ivy/ant/antlib.xml" |
|---|
| 104 | uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/> |
|---|
| 105 | </target> |
|---|
| 106 | |
|---|
| 107 | |
|---|
| 108 | <target name="/noresolve" description="Do not try to resolve library dependencies (if e.g. Internet connection is not available)"> |
|---|
| 109 | <property name="no.resolve" value="1"/> |
|---|
| 110 | </target> |
|---|
| 111 | |
|---|
| 112 | <target name="resolve" depends="init-ivy" |
|---|
| 113 | description="retrieve dependencies wth Ivy" unless="no.resolve"> |
|---|
| 114 | <ivy:settings file="ivy/ivysettings.xml" /> |
|---|
| 115 | <ivy:retrieve type="jar" pattern="${ivy.lib.dir}/[artifact].[ext]"/> |
|---|
| 116 | <ivy:report todir="reports/ivy" /> |
|---|
| 117 | </target> |
|---|
| 118 | |
|---|
| 119 | |
|---|
| 120 | <target name="init" depends="resolve"> |
|---|
| 121 | <!-- Create the time stamp --> |
|---|
| 122 | <tstamp/> |
|---|
| 123 | <!-- Create the build directory structure used by compile --> |
|---|
| 124 | <mkdir dir="${build.dir}"/> |
|---|
| 125 | <mkdir dir="${build.classes.dir}"/> |
|---|
| 126 | <mkdir dir="${build.resource.dir}"/> |
|---|
| 127 | <copy file="conf/buildinfo.template.properties" |
|---|
| 128 | tofile="conf/buildinfo.properties" |
|---|
| 129 | overwrite="true"> |
|---|
| 130 | <filterset> |
|---|
| 131 | <filter token="svnrevision" value="${svnrevision}"/> |
|---|
| 132 | <filter token="svn.info.url" value="${svn.info.url}"/> |
|---|
| 133 | <filter token="build.time" value="${DSTAMP}_${TSTAMP}"/> |
|---|
| 134 | <filter token="build.user" value="${user.name}"/> |
|---|
| 135 | </filterset> |
|---|
| 136 | </copy> |
|---|
| 137 | <property file="conf/buildinfo.properties"/> |
|---|
| 138 | </target> |
|---|
| 139 | <target name="compile" depends="init" |
|---|
| 140 | description="Compile the source" > |
|---|
| 141 | |
|---|
| 142 | |
|---|
| 143 | <!-- Compile the java code from ${src} into ${build} --> |
|---|
| 144 | <javac srcdir="${src}" destdir="${build.classes.dir}" debug="on" classpathref="project.class.path"/> |
|---|
| 145 | <copy todir="${build.resource.dir}"> |
|---|
| 146 | <fileset dir="${src}"> |
|---|
| 147 | <include name="**/*.betwixt"/> |
|---|
| 148 | </fileset> |
|---|
| 149 | </copy> |
|---|
| 150 | </target> |
|---|
| 151 | <target name="dist" depends="compile" |
|---|
| 152 | description="Build Photovault JAR files" > |
|---|
| 153 | |
|---|
| 154 | <!-- Create the distribution directory --> |
|---|
| 155 | <mkdir dir="${dist}/photovault-latest"/> |
|---|
| 156 | <delete> |
|---|
| 157 | <fileset dir="${dist}/photovault-latest" includes="**/*"/> |
|---|
| 158 | </delete> |
|---|
| 159 | |
|---|
| 160 | |
|---|
| 161 | <!-- Convert the CLASSPATH from Ant path structure to a form that can be |
|---|
| 162 | passed to MANIFEST Class-Path property --> |
|---|
| 163 | <pathconvert property="runtime-path" pathsep=" "> |
|---|
| 164 | <path refid="runtime.path"> |
|---|
| 165 | </path> |
|---|
| 166 | <mapper type="flatten"/> |
|---|
| 167 | </pathconvert> |
|---|
| 168 | |
|---|
| 169 | <!-- Create the jar file --> |
|---|
| 170 | <jar jarfile="${dist}/photovault-latest/photovault.jar"> |
|---|
| 171 | <manifest> |
|---|
| 172 | <attribute name="Main-Class" value="org.photovault.swingui.Photovault"/> |
|---|
| 173 | <attribute name="Built-By" value="${user.name}"/> |
|---|
| 174 | <attribute name="Implementation-Version" value="build_${DSTAMP}"/> |
|---|
| 175 | <attribute name="Class-Path" value="${runtime-path}"/> |
|---|
| 176 | <attribute name="SVN-revision" value="${svnrevision}"/> |
|---|
| 177 | <attribute name="Build-time" value="${DSTAMP}_${TSTAMP}"/> |
|---|
| 178 | </manifest> |
|---|
| 179 | <fileset dir="${build.classes.dir}"> |
|---|
| 180 | <exclude name="**/Test*.class"/> |
|---|
| 181 | </fileset> |
|---|
| 182 | <fileset dir="${build.resource.dir}"> |
|---|
| 183 | </fileset> |
|---|
| 184 | |
|---|
| 185 | <!-- Include resources into the JAR --> |
|---|
| 186 | <fileset dir="conf" includes="*"/> |
|---|
| 187 | <fileset dir="src/main/resources" includes="*"/> |
|---|
| 188 | </jar> |
|---|
| 189 | |
|---|
| 190 | <!-- Copy needed JAR files to distribution directory --> |
|---|
| 191 | <copy todir="${dist}/photovault-latest"> |
|---|
| 192 | <fileset refid="runtime.fileset"/> |
|---|
| 193 | </copy> |
|---|
| 194 | </target> |
|---|
| 195 | <target name="win32-installer" depends="dist" |
|---|
| 196 | description="Creates a WIN32 installer using NSIS"> |
|---|
| 197 | <fail message="The 'nsiscompiler' property must contain absolute path of NSIS compiler"> |
|---|
| 198 | <condition> |
|---|
| 199 | <not> |
|---|
| 200 | <isset property="nsiscompiler"/> |
|---|
| 201 | </not> |
|---|
| 202 | </condition> |
|---|
| 203 | </fail> |
|---|
| 204 | <!-- Laynch4j task definition for creating windows .exe --> |
|---|
| 205 | <taskdef name="launch4j" |
|---|
| 206 | classname="net.sf.launch4j.ant.Launch4jTask" |
|---|
| 207 | classpath="${launch4j.dir}/launch4j.jar |
|---|
| 208 | :${launch4j.dir}/lib/xstream.jar" /> |
|---|
| 209 | <mkdir dir="${dist}/win32/installer"/> |
|---|
| 210 | <copy file="${nsis-src}/photovault_installer.template.nsi" |
|---|
| 211 | tofile="${nsis-src}/photovault_installer.nsi" |
|---|
| 212 | overwrite="true"> |
|---|
| 213 | <filterset> |
|---|
| 214 | <filtersfile file="conf/buildinfo.properties"/> |
|---|
| 215 | <!-- TODO: This should not be hard coded |
|---|
| 216 | <filter token="version" value="0.5.0-dev"/> |
|---|
| 217 | <filter token="svnrevision" value="${svnrevision}"/> --> |
|---|
| 218 | <filter token="basedir" value="${basedir}"/> |
|---|
| 219 | </filterset> |
|---|
| 220 | </copy> |
|---|
| 221 | <copy file="src/main/win32/pv_launch4j.template.xml" |
|---|
| 222 | tofile="src/main/win32/pv_launch4j.xml" |
|---|
| 223 | overwrite="true"> |
|---|
| 224 | <filterset> |
|---|
| 225 | <filtersfile file="conf/buildinfo.properties"/> |
|---|
| 226 | <!--filter token="svnrev" value="${svn.info.rev}"/--> |
|---|
| 227 | </filterset> |
|---|
| 228 | </copy> |
|---|
| 229 | <launch4j configFile="src/main/win32/pv_launch4j.xml" |
|---|
| 230 | outfile="dist\win32\photovault.exe" |
|---|
| 231 | jar="dist\photovault-latest\photovault.jar" /> |
|---|
| 232 | <exec executable="${nsiscompiler}"> |
|---|
| 233 | <arg line="${nsis-src}/photovault_installer.nsi"/> |
|---|
| 234 | </exec> |
|---|
| 235 | </target> |
|---|
| 236 | <target name="testng" depends="dist" description="TestNG test"> |
|---|
| 237 | <taskdef resource="testngtasks" classpath="lib/testng-jdk15.jar"/> |
|---|
| 238 | <testng outputDir="${reports.test}/testresults" |
|---|
| 239 | workingdir="${basedir}" |
|---|
| 240 | haltOnFailure="false" verbose="5" |
|---|
| 241 | reporter="org.testng.reporters.JUnitXMLReporter"> |
|---|
| 242 | <jvmarg value="${run.jvmargs}"/> |
|---|
| 243 | <jvmarg value="-Xdebug"/> |
|---|
| 244 | <jvmarg value="-Xnoagent"/> |
|---|
| 245 | <jvmarg value="-Djava.compiler=none"/> |
|---|
| 246 | <jvmarg value="-Dbasedir=${basedir}"/> |
|---|
| 247 | |
|---|
| 248 | <!--jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/--> |
|---|
| 249 | <classpath> |
|---|
| 250 | <path refid="project.class.path"/> |
|---|
| 251 | <pathelement location="${build.classes.dir}"/> |
|---|
| 252 | <pathelement location="${conf.dir}"/> |
|---|
| 253 | </classpath> |
|---|
| 254 | <classfileset dir="${build.classes.dir}"> |
|---|
| 255 | <include name="**/Test**.class"/> |
|---|
| 256 | </classfileset> |
|---|
| 257 | </testng> |
|---|
| 258 | </target> |
|---|
| 259 | <target name="testng.debug.single" depends="dist" description="TestNG debug single file"> |
|---|
| 260 | <taskdef resource="testngtasks" classpath="lib/testng-jdk15.jar"/> |
|---|
| 261 | <nbjpdastart name="${classname}" addressproperty="jpda.address" transport="dt_socket"> |
|---|
| 262 | <classpath refid="project.class.path"/> |
|---|
| 263 | <sourcepath> |
|---|
| 264 | <path refid="debug.sourcepath"/> |
|---|
| 265 | </sourcepath> |
|---|
| 266 | </nbjpdastart> |
|---|
| 267 | <echo message="selected_file: ${selected_file}"/> |
|---|
| 268 | <testng outputDir="${reports.test}/testresults" |
|---|
| 269 | workingdir="${basedir}" |
|---|
| 270 | haltOnFailure="true" verbose="5"> |
|---|
| 271 | <jvmarg value="${run.jvmargs}"/> |
|---|
| 272 | <jvmarg value="-Xdebug"/> |
|---|
| 273 | <jvmarg value="-Xnoagent"/> |
|---|
| 274 | <jvmarg value="-Djava.compiler=none"/> |
|---|
| 275 | <jvmarg value="-Djna.library.path=/usr/local/lib:/usr/lib"/> |
|---|
| 276 | <jvmarg value="-Dbasedir=${basedir}"/> |
|---|
| 277 | <jvmarg value="-Dlog4j.configuration=photovault_log4j.properties"/> |
|---|
| 278 | <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/> |
|---|
| 279 | <classpath> |
|---|
| 280 | <path refid="project.class.path"/> |
|---|
| 281 | <pathelement location="${build.classes.dir}"/> |
|---|
| 282 | <pathelement location="${conf.dir}"/> |
|---|
| 283 | </classpath> |
|---|
| 284 | <classfileset dir="${build.classes.dir}"> |
|---|
| 285 | <include name="${selected_file}.class"/> |
|---|
| 286 | </classfileset> |
|---|
| 287 | </testng> |
|---|
| 288 | </target> |
|---|
| 289 | |
|---|
| 290 | <!-- Profile single test case in Netbeans--> |
|---|
| 291 | <target name="testng.profile.single" depends="dist" description="Profile in Netbeans profiler"> |
|---|
| 292 | <fail unless="netbeans.home">This target can only run inside the NetBeans IDE. |
|---|
| 293 | </fail> |
|---|
| 294 | <taskdef resource="testngtasks" classpath="lib/testng.jar"/> |
|---|
| 295 | <!-- Start the profiler & waint for Java VM --> |
|---|
| 296 | <nbprofiledirect> |
|---|
| 297 | <classpath refid="project.class.path"/> |
|---|
| 298 | </nbprofiledirect> |
|---|
| 299 | <!-- Start application. Use basically the same command as for running the application --> |
|---|
| 300 | <testng outputDir="${reports.test}/testresults" |
|---|
| 301 | workingdir="${basedir}" |
|---|
| 302 | haltOnFailure="true" verbose="2"> |
|---|
| 303 | <jvmarg value="${run.jvmargs}"/> |
|---|
| 304 | <jvmarg value="-Dbasedir=${basedir}"/> |
|---|
| 305 | <jvmarg value="${profiler.info.jvmargs.agent}"/> |
|---|
| 306 | <classpath> |
|---|
| 307 | <path refid="project.class.path"/> |
|---|
| 308 | <pathelement location="${build.classes.dir}"/> |
|---|
| 309 | <pathelement location="${conf.dir}"/> |
|---|
| 310 | </classpath> |
|---|
| 311 | <classfileset dir="${build.classes.dir}"> |
|---|
| 312 | <include name="${selected_file}.class"/> |
|---|
| 313 | </classfileset> |
|---|
| 314 | </testng> |
|---|
| 315 | </target> |
|---|
| 316 | <target name="test" depends="dist" description="Run JUnit tests"> |
|---|
| 317 | <delete dir="./${reports.test}/testresults"/> |
|---|
| 318 | <mkdir dir="./${reports.test}/testresults"/> |
|---|
| 319 | <mkdir dir="./build/test_volume"/> |
|---|
| 320 | <junit fork="yes" dir="${basedir}" showoutput="yes" printsummary="yes"> |
|---|
| 321 | <sysproperty key="photovault.propFname" value="${junittest.properties}"/> |
|---|
| 322 | <sysproperty key="photovault.configfile" value="${junittest.configfile}"/> |
|---|
| 323 | <sysproperty key="basedir" value="${basedir}"/> |
|---|
| 324 | <formatter type="xml"/> |
|---|
| 325 | <formatter usefile="false" type="brief"/> |
|---|
| 326 | <classpath> |
|---|
| 327 | <path refid="project.class.path"/> |
|---|
| 328 | <pathelement location="${build.dir}"/> |
|---|
| 329 | <pathelement location="${conf.dir}"/> |
|---|
| 330 | </classpath> |
|---|
| 331 | <!--<test name="imginfo.PhotoInfoTest" outfile="${reports.test}/imginfo"/>--> |
|---|
| 332 | <batchtest todir="${reports.test}/testresults"> |
|---|
| 333 | <fileset dir="build"> |
|---|
| 334 | <include name="**/Test_*.class"/> |
|---|
| 335 | <!-- Exlude inner classes since these do not contain any test cases --> |
|---|
| 336 | <exclude name="**/*$$*.class"/> |
|---|
| 337 | </fileset> |
|---|
| 338 | </batchtest> |
|---|
| 339 | </junit> |
|---|
| 340 | |
|---|
| 341 | <!-- Create a summary report --> |
|---|
| 342 | <junitreport todir="${reports.test}"> |
|---|
| 343 | <fileset dir="${reports.test}/testresults"> |
|---|
| 344 | <include name="TEST-*.xml"/> |
|---|
| 345 | </fileset> |
|---|
| 346 | <report format="frames" todir="./${reports.test}/html"/> |
|---|
| 347 | </junitreport> |
|---|
| 348 | </target> |
|---|
| 349 | |
|---|
| 350 | <!-- Instrument all with Cobertura --> |
|---|
| 351 | <target name="cobertura-prepare" depends="dist"> |
|---|
| 352 | <cobertura-instrument todir="${build.cobertura.dir}"> |
|---|
| 353 | <fileset dir="${build.classes.dir}/"> |
|---|
| 354 | <include name="**/*.class"/> |
|---|
| 355 | </fileset> |
|---|
| 356 | </cobertura-instrument> |
|---|
| 357 | </target> |
|---|
| 358 | <target name="test-coverage" depends="clean,dist,cobertura-prepare"> |
|---|
| 359 | <taskdef resource="testngtasks" classpath="lib/testng.jar"/> |
|---|
| 360 | <testng outputDir="${reports.test}/testresults" |
|---|
| 361 | workingdir="${basedir}" |
|---|
| 362 | haltOnFailure="false" verbose="2" |
|---|
| 363 | reporter="org.testng.reporters.JUnitXMLReporter"> |
|---|
| 364 | <jvmarg value="${run.jvmargs}"/> |
|---|
| 365 | <jvmarg value="-Xdebug"/> |
|---|
| 366 | <jvmarg value="-Xnoagent"/> |
|---|
| 367 | <jvmarg value="-Djava.compiler=none"/> |
|---|
| 368 | <jvmarg value="-Dbasedir=${basedir}"/> |
|---|
| 369 | |
|---|
| 370 | <!--jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/--> |
|---|
| 371 | <classpath> |
|---|
| 372 | <pathelement location="${build.cobertura.dir}"/> |
|---|
| 373 | <path refid="project.class.path"/> |
|---|
| 374 | <!--path refid="cobertura-path"/--> |
|---|
| 375 | <pathelement location="${build.classes.dir}"/> |
|---|
| 376 | <pathelement location="${conf.dir}"/> |
|---|
| 377 | </classpath> |
|---|
| 378 | <classfileset dir="build"> |
|---|
| 379 | <include name="**/Test**.class"/> |
|---|
| 380 | </classfileset> |
|---|
| 381 | </testng> |
|---|
| 382 | <cobertura-report srcdir="${src}" destdir="reports/cobertura"/> |
|---|
| 383 | <cobertura-report format="xml" srcdir="${src}" destdir="reports/cobertura"/> |
|---|
| 384 | </target> |
|---|
| 385 | |
|---|
| 386 | <!-- Run Findbugs on Photovault .jar --> |
|---|
| 387 | <target name="findbugs" depends="dist"> |
|---|
| 388 | <taskdef name="findbugs" |
|---|
| 389 | classname="edu.umd.cs.findbugs.anttask.FindBugsTask" |
|---|
| 390 | classpath="${findbugs.home}/lib/findbugs-ant.jar"/> |
|---|
| 391 | <findbugs home="${findbugs.home}" |
|---|
| 392 | output="xml" |
|---|
| 393 | outputFile="reports/photovault-fb.xml" > |
|---|
| 394 | <auxClasspath> |
|---|
| 395 | <path refid="project.class.path"/> |
|---|
| 396 | </auxClasspath> |
|---|
| 397 | <sourcePath path="${src}" /> |
|---|
| 398 | <class location="${dist}/photovault-latest/photovault.jar" /> |
|---|
| 399 | </findbugs> |
|---|
| 400 | </target> |
|---|
| 401 | |
|---|
| 402 | |
|---|
| 403 | <!-- Checkstyle target --> |
|---|
| 404 | <target name="checkstyle"> |
|---|
| 405 | <checkstyle config="conf/sun_checks.xml"> |
|---|
| 406 | <fileset dir="src" includes="**/*.java"/> |
|---|
| 407 | <formatter type="plain"/> |
|---|
| 408 | <formatter type="xml" toFile="build/checkstyle_errors.xml"/> |
|---|
| 409 | </checkstyle> |
|---|
| 410 | </target> |
|---|
| 411 | <path id="emma.lib" > |
|---|
| 412 | <pathelement location="lib/emma.jar" /> |
|---|
| 413 | <pathelement location="lib/emma_ant.jar" /> |
|---|
| 414 | </path> |
|---|
| 415 | <taskdef resource="emma_ant.properties" classpathref="emma.lib" /> |
|---|
| 416 | <target name="junit-coverage" depends="dist" |
|---|
| 417 | description="Measures unit test coverage using Emma"> |
|---|
| 418 | <path id="instrpath"> |
|---|
| 419 | <pathelement path="build"/> |
|---|
| 420 | </path> |
|---|
| 421 | <delete dir="${build.instr.dir}"/> |
|---|
| 422 | <mkdir dir="${build.instr.dir}"/> |
|---|
| 423 | <delete file="${coverage.dir}/metadata.emma"/> |
|---|
| 424 | <emma enabled="true" > |
|---|
| 425 | <instr instrpathref="instrpath" destdir="${build.instr.dir}" |
|---|
| 426 | metadatafile="${coverage.dir}/metadata.emma" |
|---|
| 427 | merge="true"> |
|---|
| 428 | <filter excludes="*.Test_*"/> |
|---|
| 429 | </instr> |
|---|
| 430 | </emma> |
|---|
| 431 | <delete dir="./${reports.test}/testresults"/> |
|---|
| 432 | <mkdir dir="./${reports.test}/testresults"/> |
|---|
| 433 | <junit fork="yes" dir="${basedir}" printsummary="yes"> |
|---|
| 434 | <jvmarg value="-Demma.coverage.out.file=${coverage.dir}/coverage.emma" /> |
|---|
| 435 | <jvmarg value="-Demma.coverage.out.merge=false" /> |
|---|
| 436 | <jvmarg value="-Xmx${heap.max_size}M"/> |
|---|
| 437 | <sysproperty key="photovault.propFname" value="${junittest.properties}"/> |
|---|
| 438 | <sysproperty key="basedir" value="${basedir}"/> |
|---|
| 439 | <formatter type="xml"/> |
|---|
| 440 | <classpath> |
|---|
| 441 | <pathelement location="${build.instr.dir}"/> |
|---|
| 442 | <path refid="project.class.path"/> |
|---|
| 443 | <pathelement location="${build.dir}"/> |
|---|
| 444 | <pathelement location="${conf.dir}"/> |
|---|
| 445 | </classpath> |
|---|
| 446 | <!--<test name="imginfo.PhotoInfoTest" outfile="${reports.test}/imginfo"/>--> |
|---|
| 447 | <batchtest todir="${reports.test}/testresults"> |
|---|
| 448 | <fileset dir="build"> |
|---|
| 449 | <include name="**/Test_*.class"/> |
|---|
| 450 | <!-- Exlude inner classes sinc ethese do not contain any test cases --> |
|---|
| 451 | <exclude name="**/*$$*.class"/> |
|---|
| 452 | </fileset> |
|---|
| 453 | </batchtest> |
|---|
| 454 | </junit> |
|---|
| 455 | <emma enabled="true"> |
|---|
| 456 | <report sourcepath="${src}"> |
|---|
| 457 | <fileset dir="${basedir}/${coverage.dir}" > |
|---|
| 458 | <include name="*.emma" /> |
|---|
| 459 | </fileset> |
|---|
| 460 | <txt outfile="${basedir}/${coverage.dir}/coverage.txt" /> |
|---|
| 461 | <html outfile="${basedir}/${coverage.dir}/coverage.html" /> |
|---|
| 462 | </report> |
|---|
| 463 | </emma> |
|---|
| 464 | <!-- Create a summary report --> |
|---|
| 465 | <junitreport todir="${reports.test}"> |
|---|
| 466 | <fileset dir="${reports.test}/testresults"> |
|---|
| 467 | <include name="TEST-*.xml"/> |
|---|
| 468 | </fileset> |
|---|
| 469 | <report format="frames" todir="./${reports.test}/html"/> |
|---|
| 470 | </junitreport> |
|---|
| 471 | </target> |
|---|
| 472 | <target name="run" depends="dist" description="Run Photovault"> |
|---|
| 473 | <java fork="true" classname="org.photovault.swingui.Photovault"> |
|---|
| 474 | <!-- Use large enough heap to fit also big images --> |
|---|
| 475 | <jvmarg value="-Xmx${heap.max_size}M"/> |
|---|
| 476 | <jvmarg value="${run.jvmargs}"/> |
|---|
| 477 | <classpath> |
|---|
| 478 | <path refid="project.class.path"/> |
|---|
| 479 | </classpath> |
|---|
| 480 | </java> |
|---|
| 481 | </target> |
|---|
| 482 | <target name="with.clover"> |
|---|
| 483 | <clover-setup/> |
|---|
| 484 | </target> |
|---|
| 485 | <target name="clover.html"> |
|---|
| 486 | <clover-html-report outdir="reports/clover_html" |
|---|
| 487 | testresultsdir="reports/testresults" |
|---|
| 488 | title="Photovault"/> |
|---|
| 489 | </target> |
|---|
| 490 | <target name="clover.clean"> |
|---|
| 491 | <clover-clean/> |
|---|
| 492 | </target> |
|---|
| 493 | <target name="run-coverage" depends="dist"> |
|---|
| 494 | <path id="instrpath"> |
|---|
| 495 | <pathelement path="${build.classes.dir}"/> |
|---|
| 496 | </path> |
|---|
| 497 | <delete dir="${build.instr.dir}"/> |
|---|
| 498 | <mkdir dir="${build.instr.dir}"/> |
|---|
| 499 | <delete file="${coverage.dir}/metadata.emma"/> |
|---|
| 500 | <emma enabled="true" > |
|---|
| 501 | <instr instrpathref="instrpath" destdir="${build.instr.dir}" |
|---|
| 502 | metadatafile="${coverage.dir}/metadata.emma" |
|---|
| 503 | merge="true"> |
|---|
| 504 | <filter excludes="*.Test_*"/> |
|---|
| 505 | </instr> |
|---|
| 506 | </emma> |
|---|
| 507 | <delete dir="./${reports.test}/testresults"/> |
|---|
| 508 | <mkdir dir="./${reports.test}/testresults"/> |
|---|
| 509 | <java fork="true" classname="org.photovault.swingui.Photovault"> |
|---|
| 510 | <!-- Use large enough heap to fit also big images --> |
|---|
| 511 | <jvmarg value="-Xmx${heap.max_size}M"/> |
|---|
| 512 | <jvmarg value="${run.jvmargs}"/> |
|---|
| 513 | <jvmarg value="-Demma.coverage.out.file=${coverage.dir}/coverage.emma" /> |
|---|
| 514 | <jvmarg value="-Demma.coverage.out.merge=true" /> |
|---|
| 515 | <classpath> |
|---|
| 516 | <pathelement location="${build.instr.dir}"/> |
|---|
| 517 | <path refid="project.class.path"/> |
|---|
| 518 | <pathelement location="${build.classes.dir}"/> |
|---|
| 519 | <pathelement location="${conf.dir}"/> |
|---|
| 520 | </classpath> |
|---|
| 521 | </java> |
|---|
| 522 | <emma enabled="true"> |
|---|
| 523 | <report sourcepath="${src}"> |
|---|
| 524 | <fileset dir="${basedir}/${coverage.dir}" > |
|---|
| 525 | <include name="*.emma" /> |
|---|
| 526 | </fileset> |
|---|
| 527 | <txt outfile="${basedir}/${coverage.dir}/coverage.txt" /> |
|---|
| 528 | <html outfile="${basedir}/${coverage.dir}/coverage.html" /> |
|---|
| 529 | </report> |
|---|
| 530 | </emma> |
|---|
| 531 | </target> |
|---|
| 532 | <target name="debug" depends="compile" if="netbeans.home" description="Debug in Netbeans"> |
|---|
| 533 | <nbjpdastart name="Photovault" addressproperty="jpda.address" transport="dt_socket"> |
|---|
| 534 | <classpath refid="project.class.path"/> |
|---|
| 535 | <sourcepath> |
|---|
| 536 | <path refid="debug.sourcepath"/> |
|---|
| 537 | </sourcepath> |
|---|
| 538 | </nbjpdastart> |
|---|
| 539 | <java fork="true" classname="org.photovault.swingui.Photovault"> |
|---|
| 540 | <jvmarg value="-Xmx${heap.max_size}M"/> |
|---|
| 541 | <!--<jvmarg value="-XX:+PrintGCDetails"/>--> |
|---|
| 542 | <jvmarg value="${run.jvmargs}"/> |
|---|
| 543 | <jvmarg value="-Xdebug"/> |
|---|
| 544 | <jvmarg value="-Xnoagent"/> |
|---|
| 545 | <jvmarg value="-Dswing.defaultlaf=com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"/> |
|---|
| 546 | <jvmarg value="-Djna.dump_memory=true"/> |
|---|
| 547 | <jvmarg value="-Djava.compiler=none"/> |
|---|
| 548 | <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/> |
|---|
| 549 | <classpath refid="project.class.path"/> |
|---|
| 550 | </java> |
|---|
| 551 | </target> |
|---|
| 552 | <target name="debug-selected-files" depends="compile" if="netbeans.home" description="Debug a single file in Netbeans"> |
|---|
| 553 | <fail unless="classname">Must set property 'classname' |
|---|
| 554 | </fail> |
|---|
| 555 | <nbjpdastart name="${classname}" addressproperty="jpda.address" transport="dt_socket"> |
|---|
| 556 | <classpath refid="project.class.path"/> |
|---|
| 557 | <sourcepath> |
|---|
| 558 | <path refid="debug.sourcepath"/> |
|---|
| 559 | </sourcepath> |
|---|
| 560 | </nbjpdastart> |
|---|
| 561 | <java classname="${classname}" fork="true"> |
|---|
| 562 | <jvmarg value="${run.jvmargs}"/> |
|---|
| 563 | <jvmarg value="-Xdebug"/> |
|---|
| 564 | <jvmarg value="-Xnoagent"/> |
|---|
| 565 | <jvmarg value="-Djava.compiler=none"/> |
|---|
| 566 | <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/> |
|---|
| 567 | <classpath refid="project.class.path"/> |
|---|
| 568 | </java> |
|---|
| 569 | </target> |
|---|
| 570 | |
|---|
| 571 | <!-- Profile Photovault in Netbeans 5 --> |
|---|
| 572 | <target name="profile" depends="dist" description="Profile in Netbeans profiler"> |
|---|
| 573 | <fail unless="netbeans.home">This target can only run inside the NetBeans IDE. |
|---|
| 574 | </fail> |
|---|
| 575 | <!-- Start the profiler & waint for Java VM --> |
|---|
| 576 | <nbprofiledirect> |
|---|
| 577 | <classpath refid="project.class.path"/> |
|---|
| 578 | </nbprofiledirect> |
|---|
| 579 | <!-- Start application. Use basically the same command as for running the application --> |
|---|
| 580 | <java fork="true" classname="org.photovault.swingui.Photovault" jvm="${profiler.info.jvm}"> |
|---|
| 581 | <!-- Use large enough heap to fit also big images --> |
|---|
| 582 | <jvmarg value="-Xmx${heap.max_size}M"/> |
|---|
| 583 | <jvmarg value="${run.jvmargs}"/> |
|---|
| 584 | <jvmarg value="${profiler.info.jvmargs.agent}"/> |
|---|
| 585 | <classpath> |
|---|
| 586 | <path refid="project.class.path"/> |
|---|
| 587 | </classpath> |
|---|
| 588 | </java> |
|---|
| 589 | </target> |
|---|
| 590 | <target name="doc" description="Create Javadoc documentation"> |
|---|
| 591 | <javadoc packagenames = "*" |
|---|
| 592 | destdir="docs/api" |
|---|
| 593 | sourcepath="${src}" |
|---|
| 594 | author="true" |
|---|
| 595 | version="true" |
|---|
| 596 | use="true" |
|---|
| 597 | windowtitle="Photovault API documentation"> |
|---|
| 598 | <classpath refid="project.class.path"/> |
|---|
| 599 | <doctitle><![CDATA[<h1>Photovault</h1>]]> |
|---|
| 600 | </doctitle> |
|---|
| 601 | <bottom><![CDATA[<i>Copyright © 2007 Harri Kaimio</i>]]> |
|---|
| 602 | </bottom> |
|---|
| 603 | <tag name="todo" scope="all" description="To do:" /> |
|---|
| 604 | <link href="http://java.sun.com/j2se/1.5.0/docs/api/"/> |
|---|
| 605 | </javadoc> |
|---|
| 606 | </target> |
|---|
| 607 | <target name="hibernate.hbm" depends="dist,-hibernate-tool-task" description="Create Hibernate HBM file based on current mapping"> |
|---|
| 608 | <hibernatetool destdir="build/hibernate"> |
|---|
| 609 | <classpath refid="runtime.path"/> |
|---|
| 610 | <annotationconfiguration |
|---|
| 611 | configurationfile="conf/hibernate.cfg.xml"/> |
|---|
| 612 | <hbm2hbmxml/> |
|---|
| 613 | <hbm2ddl export="false" outputfilename="sql.ddl"/> |
|---|
| 614 | </hibernatetool> |
|---|
| 615 | </target> |
|---|
| 616 | <target name="clean" |
|---|
| 617 | description="clean up" > |
|---|
| 618 | <!-- Delete the ${build} and ${dist} directory trees --> |
|---|
| 619 | <delete dir="${build.dir}"/> |
|---|
| 620 | <delete dir="${dist}"/> |
|---|
| 621 | </target> |
|---|
| 622 | <target name="dist-bin-tgz" depends="dist" |
|---|
| 623 | description="Creates the binary distribution"> |
|---|
| 624 | <property name="version" value="${build.major}.${build.minor}.${build.patch}${build.version_shorttag}"/> |
|---|
| 625 | <property name="tardir" value="photovault-${build.major}.${build.minor}.${build.patch}${build.version_shorttag}"/> |
|---|
| 626 | <tar destfile="${dist}/photovault-${version}.tar.gz" compression="gzip"> |
|---|
| 627 | <tarfileset dir="${dist}/photovault-latest" prefix="${tardir}/lib"> |
|---|
| 628 | <!-- Exclude JAI libraries since their license is not GPL compatible --> |
|---|
| 629 | <exclude name="**/jai_core.jar"/> |
|---|
| 630 | <exclude name="**/jai_codec.jar"/> |
|---|
| 631 | </tarfileset> |
|---|
| 632 | <tarfileset dir="." prefix="${tardir}"> |
|---|
| 633 | <include name="relnotes.txt"/> |
|---|
| 634 | <include name="LICENSE.txt"/> |
|---|
| 635 | </tarfileset> |
|---|
| 636 | <tarfileset dir="." fullpath="${tardir}/photovault" mode="755"> |
|---|
| 637 | <include name="photovault.sh"/> |
|---|
| 638 | </tarfileset> |
|---|
| 639 | <!-- Copy dcraw executables for all supported platforms to distribution |
|---|
| 640 | directory --> |
|---|
| 641 | <tarfileset dir="${build.lib.dir}/linux-i386" prefix="${tardir}/lib/linux-i386" mode="755"> |
|---|
| 642 | <include name="dcraw*"/> |
|---|
| 643 | </tarfileset> |
|---|
| 644 | <tarfileset dir="${build.lib.dir}/win32-x86" prefix="${tardir}/lib/win32-x86"> |
|---|
| 645 | <include name="dcraw*"/> |
|---|
| 646 | </tarfileset> |
|---|
| 647 | </tar> |
|---|
| 648 | </target> |
|---|
| 649 | <target name="dist-src-tgz" depends="dist" |
|---|
| 650 | description="Creates the source distribution tar file"> |
|---|
| 651 | <property name="version" value="${build.major}.${build.minor}.${build.patch}${build.version_shorttag}"/> |
|---|
| 652 | <property name="tardir" value="photovault-${build.major}.${build.minor}.${build.patch}"/> |
|---|
| 653 | <tar destfile="${dist}/photovault-src-${version}.tar.gz" compression="gzip"> |
|---|
| 654 | <tarfileset dir="src" prefix="${tardir}/src"> |
|---|
| 655 | <exclude name="**/.svn"/> |
|---|
| 656 | </tarfileset> |
|---|
| 657 | <tarfileset dir="lib" prefix="${tardir}/lib"> |
|---|
| 658 | <exclude name="**/.svn"/> |
|---|
| 659 | <exclude name="**/jai_core.jar"/> |
|---|
| 660 | <exclude name="**/jai_codec.jar"/> |
|---|
| 661 | </tarfileset> |
|---|
| 662 | <tarfileset dir="conf" prefix="${tardir}/conf"> |
|---|
| 663 | <exclude name="**/.svn"/> |
|---|
| 664 | </tarfileset> |
|---|
| 665 | <tarfileset dir="." prefix="${tardir}"> |
|---|
| 666 | <include name="relnotes.txt"/> |
|---|
| 667 | <include name="LICENSE.txt"/> |
|---|
| 668 | <include name="build.xml"/> |
|---|
| 669 | <include name="build.properties"/> |
|---|
| 670 | <include name="forrest.properties"/> |
|---|
| 671 | </tarfileset> |
|---|
| 672 | </tar> |
|---|
| 673 | </target> |
|---|
| 674 | <target name="dist-testfiles-tgz" depends="dist" |
|---|
| 675 | description="Crates the test file distribution tar file"> |
|---|
| 676 | <property name="version" value="${build.major}.${build.minor}.${build.patch}${build.version_shorttag}"/> |
|---|
| 677 | <property name="tardir" value="photovault-${build.major}.${build.minor}.${build.patch}"/> |
|---|
| 678 | <tar destfile="${dist}/photovault-testfiles-${version}.tar.gz" compression="gzip"> |
|---|
| 679 | <tarfileset dir="tests" prefix="${tardir}/tests"> |
|---|
| 680 | <exclude name="**/.svn"/> |
|---|
| 681 | </tarfileset> |
|---|
| 682 | <tarfileset dir="testfiles" prefix="${tardir}/testfiles"> |
|---|
| 683 | <exclude name="**/.svn"/> |
|---|
| 684 | </tarfileset> |
|---|
| 685 | <tarfileset dir="." prefix="${tardir}"> |
|---|
| 686 | <include name="relnotes.txt"/> |
|---|
| 687 | <include name="LICENSE.txt"/> |
|---|
| 688 | </tarfileset> |
|---|
| 689 | </tar> |
|---|
| 690 | </target> |
|---|
| 691 | <target name="osx-installer" depends="dist" |
|---|
| 692 | description="Creates a MacOS X .dmg package. Works only in Mac"> |
|---|
| 693 | <fail message=".DMG installer can be created only in Mac."> |
|---|
| 694 | <condition> |
|---|
| 695 | <not> |
|---|
| 696 | <os family="mac"/> |
|---|
| 697 | </not> |
|---|
| 698 | </condition> |
|---|
| 699 | </fail> |
|---|
| 700 | <mkdir dir="${dist}/osx"/> |
|---|
| 701 | <delete> |
|---|
| 702 | <fileset dir="${dist}/osx" includes="**/*"/> |
|---|
| 703 | </delete> |
|---|
| 704 | |
|---|
| 705 | <!-- Create the application bundle directory hiearchy --> |
|---|
| 706 | <mkdir dir="${dist}/osx/Photovault.app/Contents"/> |
|---|
| 707 | <mkdir dir="${dist}/osx/Photovault.app/Contents/MacOS"/> |
|---|
| 708 | <mkdir dir="${dist}/osx/Photovault.app/Contents/Resources"/> |
|---|
| 709 | <mkdir dir="${dist}/osx/Photovault.app/Contents/Resources/Java"/> |
|---|
| 710 | |
|---|
| 711 | <!-- Copy Photovault to bundle --> |
|---|
| 712 | <copy todir="${dist}/osx/Photovault.app/Contents/Resources/Java"> |
|---|
| 713 | <fileset dir="${dist}/photovault-latest"> |
|---|
| 714 | <exclude name="**/jai_core.jar"/> |
|---|
| 715 | <exclude name="**/jai_codec.jar"/> |
|---|
| 716 | </fileset> |
|---|
| 717 | </copy> |
|---|
| 718 | <!-- Copy dcraw --> |
|---|
| 719 | <copy file="${build.lib.dir}/macosx/dcrawU" |
|---|
| 720 | todir="${dist}/osx/Photovault.app/Contents/Resources/Java"/> |
|---|
| 721 | <chmod file="${dist}/osx/Photovault.app/Contents/Resources/Java/dcrawU" |
|---|
| 722 | perm="755"/> |
|---|
| 723 | <!-- Copy Java framework files --> |
|---|
| 724 | <copy file="/System/Library/Frameworks/JavaVM.framework/Versions/A/Resources/MacOS/JavaApplicationStub" |
|---|
| 725 | todir="${dist}/osx/Photovault.app/Contents/MacOS"/> |
|---|
| 726 | <chmod file="${dist}/osx/Photovault.app/Contents/MacOS/JavaApplicationStub" |
|---|
| 727 | perm="755"/> |
|---|
| 728 | <copy file="/Developer/Applications/Java Tools/Jar Bundler.app/Contents/Resources/GenericJavaApp.icns" |
|---|
| 729 | todir="${dist}/osx/Photovault.app/Contents/Resources"/> |
|---|
| 730 | <!-- Create Info.plist with correct version information --> |
|---|
| 731 | <copy file="conf/Info.plist.template" |
|---|
| 732 | tofile="${dist}/osx/Photovault.app/Contents/Info.plist" |
|---|
| 733 | overwrite="true"> |
|---|
| 734 | <filterset> |
|---|
| 735 | <filtersfile file="conf/buildinfo.properties"/> |
|---|
| 736 | </filterset> |
|---|
| 737 | </copy> |
|---|
| 738 | <echo file="${dist}/osx/Photovault.app/Contents/PkgInfo" |
|---|
| 739 | message="APPL/????"/> |
|---|
| 740 | |
|---|
| 741 | <!-- Create the disk image file --> |
|---|
| 742 | <exec executable="hdiutil"> |
|---|
| 743 | <arg value="create"/> |
|---|
| 744 | <arg value="-srcfolder"/> |
|---|
| 745 | <arg value="${dist}/osx/Photovault.app"/> |
|---|
| 746 | <arg value="${dist}/osx/Photovault.dmg"/> |
|---|
| 747 | </exec> |
|---|
| 748 | </target> |
|---|
| 749 | <target name="dist-files" depends="win32-installer,dist-bin-tgz,dist-src-tgz,dist-testfiles-tgz" |
|---|
| 750 | description="Creates the distribution packages"/> |
|---|
| 751 | <target name="create-ddl" depends="dist"> |
|---|
| 752 | <mkdir dir="${build.dir}/generated"/> |
|---|
| 753 | <hibernatetool destdir="${build.dir}/generated"> |
|---|
| 754 | <annotationconfiguration |
|---|
| 755 | configurationfile="conf/hibernate.cfg.xml"/> |
|---|
| 756 | <hbm2ddl export="false" outputfilename="sql.ddl"/> |
|---|
| 757 | </hibernatetool> |
|---|
| 758 | </target> |
|---|
| 759 | </project> |
|---|