[svn-upgrade] Integrating new upstream version, jabref (2.3)
[debian/jabref.git] / build.xml
index 0b8e3a2..4855062 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-   Filename: $RCSfile: build.xml,v $
+   Filename: $RCSfile$
    Purpose:  Ant build file for Jabref.
 
              Ant-Download: http://jakarta.apache.org/ant
                help mailing list:      must be inserted
 
    Precondition: 1. Ant should be installed.
-                 2. JAVA_HOME environment variable contains the path to JDK1.4 or higher
+                 2. JAVA_HOME environment variable contains the path to JDK1.5 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: 1.77 $
-             $Date: 2006/11/23 22:37:19 $
-             $Author: coezbek $
+   Version:  $Revision: 2460 $
+             $Date: 2007-11-04 16:58:28 +0100 (Sun, 04 Nov 2007) $
+             $Author: mortenalver $
 
    modified:
              23.11.2006 c.oezbek
      ========================================================================================== -->
 
        <!-- some version information -->
-       <property name="jabref.bin" value="JabRef-2.2" />
-       <property name="jabref.version" value="2.2b2" />
+       <property name="jabref.version" value="2.3" />
        <property name="jabref.placeholder.version" value="@version@" />
        <!-- used by replace task -->
 
 
        <!-- Set the properties for intermediate directory -->
+       <property name="build.jar" value="JabRef-${jabref.version}.jar" />
        <property name="build.dir" value="build" />
        <property name="build.classes" value="${build.dir}/classes" />
        <property name="build.tmp" value="${build.dir}/tmp" />
        <!-- Set the properties for library directories -->
        <property name="library.directory" value="lib" />
 
+<!--    <property name="nsis.executable" value="makensis.exe"/> -->
+
        <!-- Load user dependent properties -->
-       <property file="build.properties" />
-       <!-- 
-           * For instance define the NSIS-compiler:
-           *   nsis.executable="d:\prog\dev\NSIS\makensis.exe" 
-           *-->
+       <!-- For instance to redefine the NSIS-compiler write 
+               nsis.executable="d:\prog\dev\NSIS\makensis.exe"
+         -->
+       <property file="user.properties" />
 
-       <!-- win.installer can only be build under Windows -->
+       <!-- win.installer can only be build under Windows if the nsis.executable is found -->
        <condition property="is.windows">
                <and>
                        <os family="windows" />
                <pathelement location="${library.directory}/antlr.jar" />
                <pathelement location="${library.directory}/antlr-3.0b5.jar" />
                <pathelement location="${library.directory}/looks-2.0.4.jar" />
-               <pathelement location="${library.directory}/forms-1.0.4.jar" />
+               <pathelement location="${library.directory}/forms-1.1.0.jar" />
                <pathelement location="${library.directory}/spin.jar" />
-               <pathelement location="${library.directory}/glazedlists-1.7.0_java14.jar" />
+               <pathelement location="${library.directory}/glazedlists-1.7.0_java15.jar" />
                <pathelement location="${library.directory}/microba.jar" />
-        <pathelement location="${library.directory}/PDFBox-0.7.3-dev-reduced.jar" />
-        <pathelement location="${library.directory}/JempBox-0.1.0-dev.jar" />
+               <pathelement location="${library.directory}/PDFBox-0.7.3-dev-reduced.jar" />
+               <pathelement location="${library.directory}/JempBox-0.1.0-dev.jar" />
        </path>
-       
+
        <target name="run" depends="build">
-               <java classname="net.sf.jabref.JabRef" fork="true">
-                       <classpath refid="classpath"/>
+               <java classname="net.sf.jabref.JabRefMain" fork="true">
+                       <classpath refid="classpath" />
                </java>
        </target>
-       
+
        <!-- Runs project -->
        <target name="runFromJar" depends="jars">
-               <java classname="net.sf.jabref.JabRef" fork="true">
+               <java classname="net.sf.jabref.JabRefMain" fork="true">
                        <classpath>
-                               <pathelement location="${build.lib}/jabref.jar" />
+                               <pathelement location="${build.lib}/${build.jar}" />
                        </classpath>
                </java>
        </target>
                <fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
 
                <nbprofiledirect>
-                       <classpath refid="classpath"/>
+                       <classpath refid="classpath" />
                </nbprofiledirect>
 
                <property environment="env" />
                        <jvmarg value="${profiler.info.jvmargs.agent}" />
                        <jvmarg line="${profiler.info.jvmargs}" />
                        <env key="LD_LIBRARY_PATH" path="${profiler.info.agentpath}:${env.LD_LIBRARY_PATH}" />
-                       <classpath refid="classpath"/>
+                       <classpath refid="classpath" />
                </java>
        </target>
 
        <!-- Compiles project -->
        <target name="compile">
                <mkdir dir="${build.classes}" />
-               <javac debug="on" deprecation="on" destdir="${build.classes}" source="1.4" target="1.4">
+               <javac debug="off" deprecation="on" destdir="${build.classes}" source="1.5" target="1.5">
                        <src path="${java.dir}" />
                        <exclude name="tests/**" />
-                       <classpath refid="classpath"/>
+                       <exclude name="**/JabRefMain.java" />
+                       <classpath refid="classpath" />
                </javac>
+               <javac debug="off" deprecation="on" destdir="${build.classes}" source="1.4" target="1.4">
+                  <src path="${java.dir}" />
+                  <include name="**/JabRefMain.java" />
+                </javac>
+
        </target>
 
        <!-- Compiles only the tests -->
        <target name="compiletest">
                <mkdir dir="${build.classes}" />
                <!--deprecation="on"-->
-               <javac srcdir="${java.dir}/tests" debug="off" destdir="${build.classes}" source="1.4" target="1.4">
-                       <classpath refid="classpath"/>
+               <javac srcdir="${java.dir}/tests" debug="off" destdir="${build.classes}" source="1.5" target="1.5">
+                       <classpath refid="classpath" />
                </javac>
        </target>
 
        <target name="osx">
                <mkdir dir="${build.classes}" />
 
-               <javac srcdir="${osx.dir}" debug="on" destdir="${build.classes}" target="1.4">
+               <javac srcdir="${osx.dir}" debug="on" destdir="${build.classes}" target="1.5">
                </javac>
        </target>
 
        <target name="jars" depends="build, unjarlib">
                <mkdir dir="${build.lib}" />
                <mkdir dir="${build.tmp}" />
-               <jar destfile="${build.lib}/jabref.jar">
+               <jar destfile="${build.lib}/${build.jar}">
 
                        <fileset dir="${build.classes}" />
                        <fileset dir="${build.tmp}" />
                                <include name="README" />
                        </fileset>
                        <manifest>
-                               <attribute name="Main-Class" value="net.sf.jabref.JabRef" />
+                               <attribute name="Main-Class" value="net.sf.jabref.JabRefMain" />
                        </manifest>
                </jar>
 
@@ -358,20 +365,20 @@ version=${jabref.version}</echo>
                <unjar src="${library.directory}/antlr.jar" dest="${build.tmp}" />
                <unjar src="${library.directory}/antlr-3.0b5.jar" dest="${build.tmp}" />
                <unjar src="${library.directory}/looks-2.0.4.jar" dest="${build.tmp}" />
-               <unjar src="${library.directory}/forms-1.0.4.jar" dest="${build.tmp}" />
+               <unjar src="${library.directory}/forms-1.1.0.jar" dest="${build.tmp}" />
                <unjar src="${library.directory}/spin.jar" dest="${build.tmp}" />
-               <unjar src="${library.directory}/glazedlists-1.7.0_java14.jar" dest="${build.tmp}" />
+               <unjar src="${library.directory}/glazedlists-1.7.0_java15.jar" dest="${build.tmp}" />
                <unjar src="${library.directory}/microba.jar" dest="${build.tmp}" />
-        <unjar src="${library.directory}/PDFBox-0.7.3-dev-reduced.jar" dest="${build.tmp}" />
-        <unjar src="${library.directory}/JempBox-0.1.0-dev.jar" dest="${build.tmp}" />
-        <delete dir="${build.tmp}/META-INF" />
+               <unjar src="${library.directory}/PDFBox-0.7.3-dev-reduced.jar" dest="${build.tmp}" />
+               <unjar src="${library.directory}/JempBox-0.1.0-dev.jar" dest="${build.tmp}" />
+               <delete dir="${build.tmp}/META-INF" />
                <!-- 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}/jabref.jar" icon="${images.dir}/JabRef-Logo.icns" version="${jabref.version}" jvmversion="1.4+" stubfile="${library.directory}/JavaApplicationStub" />
+               <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="${library.directory}/JavaApplicationStub" />
        </target>
 
 
@@ -382,15 +389,24 @@ version=${jabref.version}</echo>
        <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
 
        <target name="win.installer.clean" description="Delete Installer and Exe-Wrapper + Temp-files">
-               <delete dir="${win.installer.dir}/dist" />
+               <delete failonerror="false" dir="${win.installer.dir}/dist" />
                <delete file="${win.installer.dir}/JabRefSetup.exe" />
        </target>
 
-       <target name="win.installer.prepare" depends="jars" if="is.windows" description="Copy files in place to be used by the installer">
+       <target name="win.installer" description="Copy files in place to be used by the installer" depends="jars">
+
+               <fail unless="is.windows" message="Not running on windows or NSIS not found. Please make sure that user.properties exists"/>
+               
                <!-- Gather everything that will go into the installer in dist -->
                <mkdir dir="${win.installer.dir}/dist" />
-               <!--            <copy file="${build.lib}/${jabref.bin}.jar" 
-               todir="${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" />
@@ -398,18 +414,19 @@ version=${jabref.version}</echo>
                                <include name="README" />
                        </fileset>
                </copy>
-       </target>
 
-       <target name="win.installer.exewrapper" depends="win.installer.prepare" if="is.windows" description="Create Exe-Wrapper">
+               <!-- "Create Exe-Wrapper" -->
                <exec dir="." executable="${nsis.executable}" failonerror="true">
-                       <arg line="'/DJARFILE=${jabref.bin}.jar' '/DVERSION=${jabref.version}' '/DAPPICON=../../../${images.dir}/JabRef.ico' ${win.installer.dir}/launcher.nsi" />
+                       <arg line="'/DJARFILE=${build.jar}' '/DVERSION=${jabref.version}' '/DAPPICON=../../../${images.dir}/JabRef.ico' ${win.installer.dir}/launcher.nsi" />
                </exec>
-       </target>
 
-       <target name="win.installer.build" depends="win.installer.exewrapper" if="is.windows" description="Create Windows-Installer.">
+               <!-- 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" />
+               
        </target>
 
        <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -517,8 +534,8 @@ Number (CCN)           maintenance
                                        <include name="**/*Test.class" />
                                </fileset>
                        </batchtest>
-                       <classpath refid="classpath"/>
+                       <classpath refid="classpath" />
                </junit>
        </target>
+
 </project>