depend on default-jre (at least Java 6)
[debian/jabref.git] / build.xml
index 17d52f190e25d122729507aa1e7c50b3f3d7d74c..d13a9f3826800bdcd25120e4b9a942d47019912e 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -1,42 +1,30 @@
 <?xml version="1.0"?>
 <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-   Filename: $RCSfile$
+   Filename: build.xml
    Purpose:  Ant build file for Jabref.
 
              Ant-Download: http://jakarta.apache.org/ant
              Ant-Manual:   http://jakarta.apache.org/ant/manual/index.html
 
-             Jabref-Homepage:    http://jabref.sourceforge.net
-             Jabref@SourceForge: http://sourceforge.net/projects/jabref
-             Jabref@FreshMeat:   http://freshmeat.net
-             Jabref-CVSRoot:     :pserver:anonymous@cvs.jabref.sourceforge.net:/cvsroot/jabref
+             Jabref homepage:       http://jabref.sourceforge.net
+             Jabref@SourceForge:    http://sourceforge.net/projects/jabref
+             Jabref@FreeCode:       http://apps.freecode.com/projects/jabref
+             Jabref@Ohloh:          https://www.ohloh.net/p/jabref
+             Jabref git repository: git://jabref.git.sourceforge.net/gitroot/jabref/jabref
 
              Further questions:
-               help mailing list:      must be inserted
+               help mailing list:   https://lists.sourceforge.net/lists/listinfo/jabref-users
 
    Precondition: 1. Ant should be installed.
-                 2. JAVA_HOME environment variable contains the path to JDK1.5 or higher
+                 2. JAVA_HOME environment variable contains the path to JDK1.6 or higher
                  3. ANT_HOME environment variable contains the path to ant's home directory
 
    Language: XML
    Compiler: Ant
    Authors:  Joerg K. Wegner, wegnerj@informatik.uni-tuebingen.de
              Morten O. Alver
-   Version:  $Revision: 3254 $
-             $Date: 2010-04-10 13:24:44 +0200 (Sat, 10 Apr 2010) $
-             $Author: mortenalver $
-
-   modified:
-             23.11.2006 c.oezbek
-             - tried to fix classpath issues
-             28.07.2005 r.nagel
-             - insert dynamic build info generation (resource/build.properties)
-             - copy fonts directory, used by the new about dialog
-             - change static "version" into mainfest file into ${jabref.version}
-             09.06.2005 r.nagel
-             - bugfix, first it should be made a rebuild of the build directory
-             and then a jar should be generated from this directory
-             - take all files for the jar archive !!! FROM BUILD directory !!!
+
+   modified: see at git checkout and "gitk build.xml"
 
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
 
      +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
 
        <!-- some version information -->
-       <property name="jabref.version" value="2.6" />
+       <property name="jabref.version" value="2.10" />
+       <property name="jabref.version.full" value="2.10.0.5" /> <!-- a version number with 4 places. Required by launch4j -->
+       <property name="jabref.year" value="2014" />
        <property name="jabref.placeholder.version" value="@version@" />
+       <property name="jabref.placeholder.year" value="@year@" />
        <!-- used by replace task -->
 
        <!-- Set the properties for intermediate directory -->
        <property name="extensions.dir" value="${src.dir}/extensions" />
        <property name="layout.dir" value="${src.dir}/resource/layout" />
        <property name="lib.dir" value="lib" />
+       <property name="buildlib.dir" value="buildlib" />
        <property name="tests.dir" value="${src.dir}/tests" />
 
-       <property name="nsis.executable" value="makensis.exe"/>
-       <property name="nsis.executable.linux" value="makensis"/>
+       <property name="osxbin.dir" value="osx" />
 
-       <!-- Load user dependent properties -->
-       <!-- For instance to redefine the NSIS-compiler write 
-               nsis.executable="d:\prog\dev\NSIS\makensis.exe"
+       <!-- Load user dependent properties. Has to happen before setting the properties here -->
+       <!-- For instance to redefine the NSIS-compiler write
+               nsis.executable="d:\\prog\\dev\\NSIS\\makensis.exe"
          -->
        <property file="user.properties" />
 
+       <property name="nsis.executable" value="C:\Program files\NSIS\makensis.exe"/>
+       <property name="nsis.executable.linux" value="makensis"/>
+       <property name="launch4j.dir" location="/opt/launch4j" />
+
        <!-- win.installer can only be build under Windows if the nsis.executable is found -->
        <condition property="is.windows">
          <and>
 
        <fileset id="jarsFileset" dir="${lib.dir}">
                <include name="antlr.jar" />
-               <include name="antlr-3.0b5.jar" />
-               <include name="looks-2.3.1.jar" />
-               <include name="forms-1.1.0.jar" />
+               <include name="antlr-3.4-complete.jar" />
+        <include name="jgoodies-common-1.4.0.jar" />
+               <include name="jgoodies-looks-2.5.2.jar" />
+               <include name="jgoodies-forms-1.6.0.jar" />
+               <include name="jayatana-1.2.4.jar" />
                <include name="spin.jar" />
-               <include name="glazedlists-1.7.0_java15.jar" />
+               <include name="glazedlists-1.8.0_java15.jar" />
                <include name="microba.jar" />
-               <include name="PDFBox-0.7.3-dev-reduced.jar" />
-               <include name="JempBox-0.2.0.jar" />
+               <include name="pdfbox-1.7.1.jar" />
+               <include name="jempbox-1.7.1.jar" />
+               <include name="fontbox-1.7.1.jar" />
                <include name="zoom-java.jar" />
        <include name="mysql-connector-java-5.0.7-bin.jar" />
-        <!--<include name="substance-4.1.jar" />-->
+               <include name="postgresql-9.2-1002.jdbc4.jar" />
         <!-- Plugin runtime dependencies -->
                <include name="plugin/JPFCodeGenerator-rt.jar" />
                <include name="plugin/jpf.jar" />
                <include name="plugin/commons-logging.jar" />
        </fileset>
 
+    <!-- Openoffice connection dependencies. Compile-time only -->
+    <fileset id="ooFileset" dir="${lib.dir}">
+        <include name="oo/unoil.jar" />
+        <include name="oo/ridl.jar" />
+        <include name="oo/juh.jar" />
+        <include name="oo/jurt.jar" />
+    </fileset>
+
+    <!-- Done by MrDlib -->
+    <fileset id="splJars" dir="${lib.dir}">
+        <include name="spl/**/*.jar" />
+        <include name="spl/*.jar" />
+    </fileset>
+       <fileset id="deletableMeta-InfFiles" dir="${build.tmp}/META-INF">
+               <exclude name="services/**/*" />
+       </fileset>
+    <!-- Done by MrDlib -->
+
        <!-- Build classpath -->
        <path id="classpath">
                <pathelement path="${build.classes}" />
                <pathelement path="${build.dir}" />
+        <!-- Done by MrDlib -->
+        <pathelement path="${lib.dir}/spl" />
+        <fileset refid="splJars" />
+        <!-- Done by MrDlib -->
                <fileset refid="jarsFileset" />
+        <fileset refid="ooFileset" />
        </path>
 
        <!-- Classpath for running the code generator -->
        <!-- Classpath for tests -->
        <path id="classpathTest">
                <path refid="classpath" />
-               <pathelement location="${lib.dir}/junit.jar" />
+               <pathelement location="${buildlib.dir}/junit.jar" />
        </path>
 
        <target name="run" depends="build">
        <!-- Compiles project excluding tests -->
        <target name="compile" depends="generate">
                <mkdir dir="${build.classes}" />
-               <javac debug="on" deprecation="on" destdir="${build.classes}" source="1.5" target="1.5">
+               <javac debug="on" deprecation="on" destdir="${build.classes}" encoding="UTF8" source="1.6" target="1.6">
                        <src path="${java.dir}" />
                        <exclude name="tests/**" />
                        <exclude name="**/JabRefMain.java" />
                        <classpath refid="classpath" />
                </javac>
-               <javac debug="off" deprecation="on" destdir="${build.classes}" source="1.4" target="1.4">
+               <javac debug="off" deprecation="on" destdir="${build.classes}" encoding="UTF8" source="1.6" target="1.6">
                        <src path="${java.dir}" />
                        <include name="**/JabRefMain.java" />
                </javac>
        <!-- Compiles project including tests -->
        <target name="compiletest">
                <mkdir dir="${build.classes}" />
-               <javac debug="on" destdir="${build.classes}" source="1.5" target="1.5">
+               <javac debug="on" destdir="${build.classes}" encoding="UTF8" source="1.6" target="1.6">
                        <src path="${java.dir}" />
                        <include name="tests/**" />
                        <classpath refid="classpathTest" />
        <target name="osx">
                <mkdir dir="${build.classes}" />
 
-               <javac srcdir="${osx.dir}" debug="off" destdir="${build.classes}" target="1.5">
+               <javac srcdir="${osx.dir}" debug="off" destdir="${build.classes}" target="1.6">
                </javac>
        </target>
 
        <!-- Copies in the OSXAdapter class, which is compilable only on Mac  -->
        <target name="non_osx">
                <mkdir dir="${build.osx}" />
-               <copy file="${lib.dir}/OSXAdapter.class" todir="${build.osx}" />
+               <copy file="${osxbin.dir}/OSXAdapter.class" todir="${build.osx}" />
        </target>
 
        <!-- Jars up project -->
        <target name="jars" depends="build, unjarlib">
                <mkdir dir="${build.lib}" />
+
                <mkdir dir="${build.tmp}" />
-               <jar destfile="${build.lib}/${build.jar}">
+               <jar destfile="${build.lib}/${build.jar}" >
+        <!--<jar destfile="${build.lib}/JabRef-${revision}.jar" manifest="${src.dir}/MANIFEST.MF">-->
 
                        <fileset dir="${build.classes}" />
                        <fileset dir="${build.tmp}" />
                        <fileset dir="${build.dir}">
                                <include name="images/**" />
                                <include name="help/**" />
-                               <include name="help/de/**" />
-                               <include name="help/no/**" />
                                <include name="resource/**" />
                        </fileset>
 
                        <fileset dir="${src.dir}">
                                <include name="plugins/**" />
                        </fileset>
-
+             <!-- Done by MrDlib -->
+            <fileset dir ="${java.dir}">
+                <include name="spl/localization/spljabref.properties"/>
+                <include name="spl/gui/ajax-loader.gif"/>
+                <include name="spl/gui/mrdlib header.png"/>
+            </fileset>
+            <!-- Done by MrDlib -->
                        <fileset dir="${lib.dir}">
                                <include name="EndNote.zip" />
                        </fileset>
                        <fileset dir="${txt.dir}">
-                               <include name="gpl.txt" />
+                               <include name="gpl2.txt" />
+                               <include name="gpl3.txt" />
                                <include name="lesser.txt" />
                                <include name="jgoodies.txt" />
                                <include name="README" />
 
        </target>
 
+       <!-- updates version information with git information.
+            should be used in development builds only
+
+            Use "ant addgitinfo jars" to generate a jar with version information in the filename
+       -->
+       <target name="addgitinfo" description="Adds git version information in ${jabref.version} and ${build.jar}">
+               <exec executable="git" searchpath="true" outputproperty="git.version" failifexecutionfails="true" errorproperty="">
+                       <arg value="log" />
+                       <arg value="-1" />
+                       <arg value="--pretty=format:%cd - %H" />
+                       <arg value="--date=iso" />
+               </exec>
+               <script language="javascript"><![CDATA[
+                       var gitVersion = project.getProperty("git.version");
+                       if ((gitVersion != undefined) && (gitVersion.length() > 0)) {
+                               // convert "2012-12-16 15:44:07 +0100 - a249a226" to "2012-12-16 15.44.07 - a249a226"
+                               gitVersion = gitVersion.substr(0,13) + "." + gitVersion.substr(14,2) + "." + gitVersion.substr(17, 2) + gitVersion.substr(25);
+
+                               // we have to update the properties using JavaScript as properties are normally immutable
+                               // Properties can be updated using JavaScript and not with the <property>-Task
+                               var jabrefVersion = project.getProperty("jabref.version");
+                               jabrefVersion = jabrefVersion + " - " + gitVersion;
+                               project.setProperty("jabref.version", jabrefVersion);
+                               project.setProperty("build.jar", "JabRef-" + jabrefVersion + ".jar");
+                       }
+               ]]></script>
+       </target>
+
        <!-- copy all necessary files and insert version informations -->
        <target name="build" depends="compile, buildinfos" description="Build project">
 
                </copy>
 
                <!-- Insert version informations -->
-               <replace dir="${build.help}" token="${jabref.placeholder.version}" value="${jabref.version}">
+               <replace dir="${build.help}">
+                   <replacefilter
+                           token="${jabref.placeholder.version}"
+                               value="${jabref.version}" />
+                   <replacefilter
+                           token="${jabref.placeholder.year}"
+                               value="${jabref.year}" />
                        <include name="**/About.html" />
                </replace>
                <replace dir="${build.openoffice.meta}" token="${jabref.placeholder.version}" value="${jabref.version}">
@@ -321,7 +383,7 @@ version=${jabref.version}</echo>
        <!-- Creates javadocs -->
        <target name="javadocs" depends="compile" description="Generates the javadocs">
                <mkdir dir="${build.javadocs}" />
-               <javadoc sourcepath="${java.dir}" destdir="${build.javadocs}" author="true" version="true" windowtitle="JabRef API" link="http://java.sun.com/j2se/1.4.1/docs/api/">
+               <javadoc sourcepath="${java.dir}" destdir="${build.javadocs}" author="true" version="true" windowtitle="JabRef API" link="http://docs.oracle.com/javase/6/docs/api/">
 
                        <fileset dir="${java.dir}" defaultexcludes="yes">
                                <include name="**/*.java" />
@@ -341,9 +403,9 @@ version=${jabref.version}</echo>
                        </fileset>
                </copy>
 
-               <javadoc sourcepath="${java.dir}" destdir="${build.extension-javadocs}" author="true" version="true" windowtitle="JabRef-Extensions API" link="http://java.sun.com/j2se/1.4.1/docs/api/" Overview="${extensions.dir}/API/overview.html" access="protected">
-                       <!-- 
-                 create javadoc only selectively for classes that 
+               <javadoc sourcepath="${java.dir}" destdir="${build.extension-javadocs}" author="true" version="true" windowtitle="JabRef-Extensions API" link="http://docs.oracle.com/javase/6/docs/api/" Overview="${extensions.dir}/API/overview.html" access="protected">
+                       <!--
+                 create javadoc only selectively for classes that
                  users extending JabRef are likely to use
               -->
                        <fileset dir="${java.dir}" defaultexcludes="yes">
@@ -396,22 +458,51 @@ version=${jabref.version}</echo>
                <mkdir dir="${build.tmp}" />
                <unjar dest="${build.tmp}">
                        <fileset refid="jarsFileset" />
+                       <fileset refid="splJars" />
                </unjar>
-               <delete dir="${build.tmp}/META-INF" />
+               <!-- done by MrDlib -->
+               <delete includeEmptyDirs="true">
+                       <fileset refid="deletableMeta-InfFiles" />
+               </delete>
+               <!-- done by MrDlib -->
                <!-- rename the microba license file -->
                <move file="${build.tmp}/license.txt" tofile="${build.tmp}/microba-license.txt" />
        </target>
 
 
-       <target name="osxjar">
-               <jarbundler dir="${build.lib}" name="JabRef" mainclass="net.sf.jabref.JabRef" jars="${build.lib}/${build.jar}" icon="${images.dir}/JabRef-Logo.icns" version="${jabref.version}" jvmversion="1.4+" stubfile="${lib.dir}/JavaApplicationStub" />
+       <target name="osxjar" depends="jars">
+               <jarbundler dir="${build.lib}"
+                    name="JabRef"
+                    mainclass="net.sf.jabref.JabRef"
+                    jar="${build.lib}/${build.jar}"
+                    icon="${images.dir}/JabRef-Logo.icns"
+                    version="${jabref.version}"
+                    jvmversion="1.6+"
+                   vmoptions="-Xms128m -Xmx512m"
+                    stubfile="${osxbin.dir}/JavaApplicationStub"
+                    signature="JABr">
+            <documenttype name="BibTeX file" extensions="bib" role="Editor"
+                          iconFile="${images.dir}/JabRef-Logo.icns"/>
+        </jarbundler>
+        <!-- After running jarbundler we need to hack the Info.plist file: -->
+        <replace file="${build.lib}/JabRef.app/Contents/Info.plist" token="&lt;key&gt;CFBundleDocumentTypes&lt;/key&gt;"
+            value="&lt;key&gt;NSPrincipalClass&lt;/key&gt;${line.separator}
+   &lt;string&gt;NSApplication&lt;/string&gt;${line.separator}
+   &lt;key&gt;CFBundleDocumentTypes&lt;/key&gt;"/>
+               <zip basedir="${build.lib}"
+                       destfile="${build.lib}/JabRef-${jabref.version}-OSX.zip"
+                       excludes="JabRef.app/Contents/MacOS/JavaApplicationStub"
+                       includes="JabRef.app/"
+                       level="9">
+                       <zipfileset dir="${build.lib}" includes="JabRef.app/Contents/MacOS/JavaApplicationStub" filemode="755" />
+               </zip>
        </target>
 
 
        <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
        <!-- Build Windows Installer                                                    -->
        <!--                                                                            -->
-       <!-- Don't forget to set nsis.executable property                               -->
+       <!-- Don't forget to set nsis.executable and launch4j.dir properties            -->
        <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
 
        <target name="win.installer.clean" description="Delete Installer and Exe-Wrapper + Temp-files">
@@ -419,10 +510,11 @@ version=${jabref.version}</echo>
                <delete file="${win.installer.dir}/JabRefSetup.exe" />
        </target>
 
-       <target name="win.installer" description="Copy files in place to be used by the installer" depends="jars">
-
+       <target name="win.installer.win.pre" description="Precondition for win.installer on Windows">
                <fail unless="is.windows" message="Not running on windows or NSIS not found. Please make sure that user.properties exists" />
+       </target>
 
+       <target name="win.installer.step1">
                <!-- Gather everything that will go into the installer in dist -->
                <mkdir dir="${win.installer.dir}/dist" />
 
@@ -434,55 +526,71 @@ version=${jabref.version}</echo>
 
                <copy todir="${win.installer.dir}/dist">
                        <fileset dir="${txt.dir}">
-                               <include name="gpl.txt" />
+                               <include name="gpl2.txt" />
+                               <include name="gpl3.txt" />
                                <include name="lesser.txt" />
                                <include name="README" />
                        </fileset>
                </copy>
 
                <!-- "Create Exe-Wrapper" -->
-               <exec dir="." executable="${nsis.executable}" failonerror="true">
-                 <arg line="'/DJARFILE=${build.jar}' '/DVERSION=${jabref.version}' '/DAPPICON=../../../${images.dir}/JabRef.ico' ${win.installer.dir}/launcher.nsi" />
-               </exec>
 
-               <!-- Finally create Windows-Installer -->
-               <exec dir="." executable="${nsis.executable}" failonerror="true">
-                       <arg line="'/DVERSION=${jabref.version}' ${win.installer.dir}/setup.nsi" />
-               </exec>
-
-               <delete dir="${win.installer.dir}/dist" />
+               <!-- first of all, update version information -->
+               <script language="javascript"><![CDATA[
+                       // create new property with a maximum length of 50 characters
+                       var txtFileVersion = project.getProperty("jabref.version");
+                       if (txtFileVersion.length()>50) {
+                               txtFileVersion = txtFileVersion.substring(0,50);
+                       }
+                       project.setProperty("txtFileVersion", txtFileVersion);
+               ]]></script>
+               <delete file="jabref-launch4j.tmp" />
+               <copy file="jabref-launch4j.xml" tofile="jabref-launch4j.tmp" />
+               <replace file="jabref-launch4j.tmp">
+                       <replacefilter token="1.1.1" value="${jabref.version}" />
+                       <replacefilter token="3.3.3" value="${txtFileVersion}" />
+                       <replacefilter token="2.2.2.2" value="${jabref.version.full}" />
+                       <replacefilter token="./" value="${basedir}/" />
+               </replace>
 
        </target>
 
-       <target name="win.installer.linux" description="Copy files in place to be used by the installer" depends="jars">
-
-               <!-- Gather everything that will go into the installer in dist -->
-               <mkdir dir="${win.installer.dir}/dist" />
-
-               <copy file="${build.lib}/${build.jar}" todir="${win.installer.dir}/dist" />
-
-               <available property="win.installer.jar.available" file="${win.installer.dir}/dist/${build.jar}" />
-
-               <fail unless="win.installer.jar.available" message="Did not find jar: ${build.jar}" />
-
-               <copy todir="${win.installer.dir}/dist">
-                       <fileset dir="${txt.dir}">
-                               <include name="gpl.txt" />
-                               <include name="lesser.txt" />
-                               <include name="README" />
-                       </fileset>
-               </copy>
-
-               <!-- "Create Exe-Wrapper" -->
-               <exec dir="." executable="${nsis.executable.linux}" failonerror="true">
-                 <arg line="'-DJARFILE=${build.jar}' '-DVERSION=${jabref.version}' '-DAPPICON=../../../${images.dir}/JabRef.ico' ${win.installer.dir}/launcher.nsi" />
+       <target name="win.installer.step2.linux" description="Create Windows launcher and Windows installer on Linux">
+               <!-- launch4j ant task does not work as ld.exe gets the wrong path passed - see https://sourceforge.net/tracker/?func=detail&aid=3598164&group_id=95944&atid=613100 -->
+               <exec
+                       executable="${launch4j.dir}/launch4j"
+                       dir="${launch4j.dir}">
+                       <arg value="${basedir}/jabref-launch4j.tmp"/>
                </exec>
 
                <!-- Finally create Windows-Installer -->
                <exec dir="." executable="${nsis.executable.linux}" failonerror="true">
                        <arg line="'-DVERSION=${jabref.version}' ${win.installer.dir}/setup.nsi" />
                </exec>
+       </target>
+
+       <target name="win.installer.step2.win" description="Create Windows launcher and Windows installer on Windows">
+               <!-- launch4j ant task does not work as ld.exe gets the wrong path passed - see https://sourceforge.net/tracker/?func=detail&aid=3598164&group_id=95944&atid=613100 -->
+               <exec
+                       executable="${launch4j.dir}/launch4jc.exe"
+                       dir="${launch4j.dir}">
+                       <arg value="${basedir}/jabref-launch4j.tmp"/>
+               </exec>
 
+               <exec dir="." executable="${nsis.executable}" failonerror="true">
+                       <arg line="'/DVERSION=${jabref.version}' ${win.installer.dir}/setup.nsi" />
+               </exec>
+       </target>
+
+       <target name="win.installer.step3">
+               <move file="${win.installer.dir}/JabRefSetup.exe" tofile="${build.lib}/JabRef-${jabref.version}-setup.exe" />
+               <delete dir="${win.installer.dir}/dist" />
+       </target>
+
+       <target name="win.installer" description="Copy files in place to be used by the installer" depends="win.installer.win.pre, jars, win.installer.step1, win.installer.step2.win, win.installer.step3">
+       </target>
+
+       <target name="win.installer.linux" description="Copy files in place to be used by the installer" depends="jars, win.installer.step1, win.installer.step2.linux, win.installer.step3">
                <delete dir="${win.installer.dir}/dist" />
 
        </target>
@@ -494,7 +602,6 @@ version=${jabref.version}</echo>
                </java>
        </target>
 
-
        <!--+++++++++++++++++++++++++++++++++++++++++++++++++
           Auxiliary targets
          +++++++++++++++++++++++++++++++++++++++++++++++++-->
@@ -519,99 +626,80 @@ version=${jabref.version}</echo>
         What's about the software design ?!;-)
     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
 
-       <target name="pmd" description="SOFTWAREDESIGN: Project Mess Detector !;-)">
-               <echo>Checking Project Mess Detection (PMD) rulesets.</echo>
-               <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask">
+       <target name="jalopy" description="SOFTWAREDESIGN: source code formatter using the JOELib convention.">
+               <taskdef name="jalopy" classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
                        <classpath>
                                <pathelement path="${classpath}" />
                                <fileset dir="${lib.dir}">
                                        <include name="*.jar" />
                                </fileset>
-                       </classpath>
-               </taskdef>
-               <!-- allowed Pretty Much Done rulsets -->
-               <!-- rulesets/basic.xml -->
-               <!-- rulesets/braces.xml -->
-               <!-- rulesets/codesize.xml-->
-               <!-- rulesets/controversial.xml-->
-               <!-- rulesets/coupling.xml-->
-               <!-- rulesets/design.xml -->
-               <!-- rulesets/experimental.xml -->
-               <!-- rulesets/favorites.xml -->
-               <!-- rulesets/imports.xml -->
-               <!-- rulesets/naming.xml -->
-               <!-- rulesets/javabean.xml -->
-               <!-- rulesets/junit.xml -->
-               <!-- rulesets/scratchpad.xml -->
-               <!-- rulesets/strictexception.xml -->
-               <!-- rulesets/strings.xml -->
-               <!-- rulesets/unusedcode.xml -->
-
-               <pmd rulesetfiles="rulesets/unusedcode.xml,rulesets/basic.xml" failonerror="no">
-                       <formatter type="html" toFile="${build.dir}/pmd_report.html" />
-                       <fileset dir="${src.dir}">
-                               <include name="**/*.java" />
-                       </fileset>
-               </pmd>
-
-               <!-- check for duplicated code -->
-               <echo>WARNING: use environment variable: ANT_OPTS=-Xmx512m or this task will fail.</echo>
-               <echo>Checking for duplicated code using the Copy/Paste Detector (CPD).</echo>
-               <taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask">
-                       <classpath>
-                               <pathelement path="${classpath}" />
-                               <fileset dir="${lib.dir}">
+                               <fileset dir="${buildlib.dir}">
                                        <include name="*.jar" />
                                </fileset>
                        </classpath>
                </taskdef>
-               <cpd format="text" minimumTokenCount="100" outputFile="${build.dir}/duplicated_code_report.txt">
+               <jalopy fileformat="unix" convention="${src.dir}/java/jalopy.format.convention.xml" history="file" historymethod="adler32" loglevel="error" threads="2" classpathref="classpath" backup="bak">
                        <fileset dir="${src.dir}">
-                               <include name="**/*.java" />
+                               <include name="java/net/sf/jabref/**/*.java" />
                        </fileset>
-               </cpd>
+               </jalopy>
        </target>
 
+       <taskdef name="jarbundler" classpath="${buildlib.dir}/jarbundler-2.2.0.jar" classname="net.sourceforge.jarbundler.JarBundler" />
 
-       <target name="javancss" description="SOFTWAREDESIGN: Determining the NCSS and CCN code metrics for JOELib.">
-               <taskdef name="javancss" classname="javancss.JavancssAntTask">
-                       <classpath>
-                               <pathelement path="${classpath}" />
-                               <fileset dir="${lib.dir}">
-                                       <include name="*.jar" />
-                               </fileset>
-                       </classpath>
-               </taskdef>
-               <echo>Cyclomatic
-Complexity             Ease of       Risk
-Number (CCN)           maintenance
-(McCabe metric)
----------------------------------------------
-1-10, simple           easy          minimum
-11-20, complex         moderate      moderate
-21-50, more complex    hard          high
->50, unstable          very hard     very high
+       <target name="compresssrc">
+               <!-- clone current repo into tmp dir. Reason: we want to have a clean src.zip, but do not want to execute "git clean -xdf" to allow developers having some temporary files (and user.properties) -->
+               <mkdir dir="${temp.dir}"/>
+               <exec executable="git" searchpath="true" failifexecutionfails="true" outputproperty="devnull" errorproperty="devnull">
+                       <arg value="clone" />
+                       <arg value="${basedir}/.." />
+                       <arg value="${temp.dir}" />
+               </exec>
 
-</echo>
-               <javancss srcdir="${src.dir}" includes="**/*.java" excludes="jama/**/*.java, jmat/**/*.java, cformat/**/*.java" abortOnFail="false" ccnPerFuncMax="30" generateReport="true" outputfile="${build.dir}/javancss_report.plain" format="plain" packageMetrics="true" classMetrics="false" functionMetrics="false" />
+               <!-- ensure correct line endings -->
+               <exec executable="git" searchpath="true" failifexecutionfails="true" outputproperty="devnull" errorproperty="devnull" dir="${temp.dir}">
+                       <arg value="config" />
+                       <arg value="core.autocrlf" />
+                       <arg value="${git.core.autocrlf}" />
+               </exec>
+               <exec executable="git" searchpath="true" failifexecutionfails="true" outputproperty="devnull" errorproperty="devnull" dir="${temp.dir}">
+                       <arg value="rm" />
+                       <arg value="--cached" />
+                       <arg value="-r" />
+                       <arg value="." />
+               </exec>
+               <exec executable="git" searchpath="true" failifexecutionfails="true" outputproperty="devnull" errorproperty="devnull" dir="${temp.dir}">
+                       <arg value="reset" />
+                       <arg value="--hard" />
+               </exec>
+
+               <!-- we want to have jabref-${jabref.version} as main directory -->
+               <mkdir dir="${distsrc}" />
+               <move file="${temp.dir}/jabref" tofile="${distsrc}/jabref-${jabref.version}" />
        </target>
 
-       <target name="jalopy" description="SOFTWAREDESIGN: source code formatter using the JOELib convention.">
-               <taskdef name="jalopy" classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
-                       <classpath>
-                               <pathelement path="${classpath}" />
-                               <fileset dir="${lib.dir}">
-                                       <include name="*.jar" />
-                               </fileset>
-                       </classpath>
-               </taskdef>
-               <jalopy fileformat="unix" convention="${src.dir}/java/jalopy.format.convention.xml" history="file" historymethod="adler32" loglevel="error" threads="2" classpathref="classpath" backup="bak">
-                       <fileset dir="${src.dir}">
-                               <include name="java/net/sf/jabref/**/*.java" />
-                       </fileset>
-               </jalopy>
+       <target name="zipsrc">
+               <tempfile property="temp.dir" destDir="${java.io.tmpdir}" prefix="jabrefsrc"/>
+               <property name="distsrc" value="${temp.dir}/distsrc/" />
+               <antcall target="compresssrc">
+                       <param name="git.core.autocrlf" value="true" />
+               </antcall>
+               <zip destfile="${build.lib}/JabRef-${jabref.version}-src.zip" basedir="${distsrc}" level="9" />
+               <delete dir="${temp.dir}" failonerror="no"/>
+       </target>
+
+       <target name="bzip2src">
+               <tempfile property="temp.dir" destDir="${java.io.tmpdir}" prefix="jabrefsrc"/>
+               <property name="distsrc" value="${temp.dir}/distsrc/" />
+               <antcall target="compresssrc">
+                       <param name="git.core.autocrlf" value="false" />
+               </antcall>
+               <tar destfile="${build.lib}/JabRef-${jabref.version}-src.tar.bz2" basedir="${distsrc}" excludes=".git/" compression="bzip2" />
+               <delete dir="${temp.dir}" failonerror="no"/>
        </target>
 
-       <taskdef name="jarbundler" classpath="${lib.dir}/jarbundler-1.4.jar" classname="com.loomcom.ant.tasks.jarbundler.JarBundler" />
+       <target name="devsnapshot" depends="clean, addgitinfo, non_osx, win.installer, osxjar" description="creates development snapshot binaries" />
 
+       <target name="release" depends="clean, win.installer, non_osx, osxjar, bzip2src, zipsrc" description="Do a release on Windows. Creates all distribution files in ${build.lib}"/>
+       <target name="release.linux" depends="clean, win.installer.linux, non_osx, osxjar, bzip2src, zipsrc" description="Do a release on Linux. Creates all distribution files in ${build.lib}" />
 </project>