Uniprot retrieves features from XML
[jalview.git] / build.xml
index be92845..fff571b 100755 (executable)
--- a/build.xml
+++ b/build.xml
 <?xml version="1.0"?>
-<project name="jalviewX" default="build" basedir=".">
-  <!-- utils is a class path to additional utilities needed for
-  building docs, jars and webstart stuff -->
-
-  <target name="init">
-
-    <property name="libDir" value="lib"/>
-    <property name="resourceDir" value="resources"/>
-    <property name="helpDir" value="help"/>
-    <property name="docDir" value="doc"/>
-    <property name="sourceDir" value="src" />
-    <property name="outputDir" value="classes" />
-    <property name="outputJar" value="jalview.jar" />
-
-    <path id="build.classpath">
-      <fileset dir="utils">
-        <include name="*.jar"/>
-        <include name="**/*.jar"/>
-      </fileset>
-      <fileset dir="${libDir}">
-        <include name="*.jar"/>      
-        <include name="**/*.jar"/>
-      </fileset>
-    </path>
+  <project name="jalviewX" default="build" basedir=".">
+<!-- we use jalopy to format our sources -->
+<taskdef name="jalopy"
+         classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
+  <classpath>
+    <fileset dir="utils/jalopy/lib">
+      <include name="*.jar" />
+    </fileset>
+  </classpath>
+</taskdef>
 
-  </target>
 
-  <target name="clean" depends="init">
-        <!-- not efficient yet. -->
-    <delete dir="${outputDir}"/>
-  </target>
+    <!-- utils is a class path to additional utilities needed for
+    building docs, jars and webstart stuff -->
+
+<!--
+        Userdefined build property defaults
+
+        wsdl.server list (plus namespace mapping info ???)  - also want
+                ... to make this a dynamically generatable property
+        WebStart Location
+        Build location - provide a temporary root for speed
+        jarsigner keystore and info
+        Jakarta and axis classpath ?
+        Default argument for starting Jalview (if it exists).
+
+-->
+
+    <target name="init">
+      <path id="axis.classpath">
+<!-->        <fileset dir="/usr/local/axis/lib">
+          <include name="**/*.jar" />
+        </fileset>
+        <fileset dir="/usr/local/jakarta-tomcat-5/webapps/axis/WEB-INF/lib">
+          <include name="**/*.jar"/>
+          <include name="*.jar"/>
+        </fileset> -->
+      </path>
+
+      <property name="JALVIEW_VERSION" value="2.06"/>
+      <property name="" value=""/>
+      <property name="libDir" value="lib"/>
+      <property name="resourceDir" value="resources"/>
+      <property name="helpDir" value="help"/>
+      <property name="docDir" value="doc"/>
+      <property name="sourceDir" value="src" />
+      <property name="outputDir" value="classes" />
+      <property name="packageDir" value="dist" />
+      <property name="outputJar" value="jalview.jar" />
+      <property name="wsdl.File" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred?wsdl" />
+      <property name="wsdl.Files" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/vamsas?wsdlFiles" />
+      <property name="wsdl.MsaWS" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/MuscleWS?wsdl" />
+      <property name="wsdl.MsaWS2" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/ClustalWS?wsdl" />
+      <property name="wsdl.MsaWS2" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/ClustalWS?wsdl" />
+        <property name="WSInterf" value="MsaWS" />
+      <property name="WebStartLocation" value="http://www.jalview.org/webstart"/>
+      <property name="wsdl.Namespace" value="vamsas" />
+      <property name="wsdl.ClientNS" value="ext.vamsas" />
+
+      <path id="build.classpath">
+        <fileset dir="utils">
+          <include name="*.jar"/>
+          <include name="**/*.jar"/>
+        </fileset>
+        <fileset dir="${libDir}">
+          <include name="*.jar"/>
+          <include name="**/*.jar"/>
+        </fileset>
+<!--        <fileset dir="old_lib_signed">
+<include name="lib_axis.jar"/>
+
+        </fileset>-->
+      </path>
+      <!-->    <uptodate property="help.uptodate"
+      targetfile="${helpDir}/helpIndex.xml">
+      <srcfiles
+                 dir="${helpDir}"
+                 includes="**/*.html" />
+               </uptodate>
+      -->
+    </target>
+
 
-  <target name="distclean" depends="init, clean">
-    
-    <echo message="REMOVING ALL BACKUP/AUTOSAVES!"/>
-    <delete>
-      <fileset dir=".">
-        <include name="${outputJar}"/>
-        <include name="#*#"/>
-        <include name="#*.*#"/>
-        <include name="**/#*#"/>
-        <include name="**/#*.*#"/>
-        <include name="*~"/>
-        <include name="*.*~"/>
-        <include name="**/*~"/>
-        <include name="**/*.*~"/>
+    <taskdef classpath="utils/roxes-ant-tasks-1.2-2004-01-30.jar" resource="com/roxes/tools/ant/taskdefs.properties"/>
+    <target name="buildPropertiesFile" depends="init">
+      <tstamp prefix="build">
+        <format property="date" pattern="dd MMMM yyyy"/>
+      </tstamp>
+      <properties file="${outputDir}/.build_properties">
+        <header>
+          ---Jalview Build Details---
+        </header>
+        <property name="VERSION" value="${JALVIEW_VERSION}"/>
+        <property name="BUILD_DATE" value="${build.date}"/>
+      </properties>
+    </target>
+
+
+    <target name="clean" depends="init">
+      <!-- not efficient yet. -->
+      <delete dir="${outputDir}"/>
+    </target>
+
+    <target name="distclean" depends="init, clean">
+
+      <echo message="REMOVING ALL BACKUP/AUTOSAVES!"/>
+      <delete>
+        <fileset dir=".">
+          <include name="${outputJar}"/>
+          <include name="#*#"/>
+          <include name="#*.*#"/>
+          <include name="**/#*#"/>
+          <include name="**/#*.*#"/>
+          <include name="*~"/>
+          <include name="*.*~"/>
+          <include name="**/*~"/>
+          <include name="**/*.*~"/>
+        </fileset>
+      </delete>
+    </target>
+
+    <target name="prepare" depends="init">
+      <mkdir dir="${outputDir}"/>
+      <copy todir="${outputDir}">
+        <fileset dir=".">
+          <include name="${docDir}/**/*.*"/>
+          <include name="${helpDir}/**/*.*"/>
+          <include name="${libDir}/*.jar"/>
+        </fileset>
+        <fileset dir="${resourceDir}">
+          <include name="**/*.*"/>
+        </fileset>
+      </copy>
+    </target>
+
+    <target name="build" depends="prepare">
+      <!-- not efficient yet. -->
+      <javac source="1.4" target="1.4"
+        srcdir ="${sourceDir}"
+        destdir="${outputDir}"
+      classpathref="build.classpath">
+      <exclude name="jalview/*applet*"/>
+       <exclude name="com/stevesoft/**"/>
+      </javac>
+    </target>
+    <target name="buildindices" depends="init, prepare"
+    unless="help.uptodate">
+    <java
+      classname="com.sun.java.help.search.Indexer"
+      classpathref="build.classpath"
+      fork="true"
+      dir="${outputDir}/${helpDir}"
+      >
+      <arg line="html"/>
+    </java>
+    </target>
+
+    <target name="makejars" depends="build, buildPropertiesFile, buildindices">
+      <!-- make the package jar -->
+      <mkdir dir="${packageDir}"/>
+
+      <jar destfile="${packageDir}/${outputJar}">
+        <manifest>
+             <attribute name="Main-Class" value="jalview.bin.Jalview"/>
+        </manifest>
+        <fileset dir="${outputDir}/">
+          <exclude name="cache*/**"/>
+          <exclude name="*.jar" />
+          <exclude name="*.jar.*" />
+          <exclude name="**/*.jar" />
+          <exclude name="**/*.jar.*" />
+        </fileset>
+      </jar>
+
+      <copy toDir="${packageDir}" flatten="true">
+        <fileset dir="${outputDir}">
+          <include name="*.jar"/>
+          <include name="**/*.jar"/>
+        </fileset>
+      </copy>
+<!-- the default keystore details might need to be edited here -->
+      <signjar
+      storepass="password"
+      keypass="password"
+      keystore="C:/JalviewX/myKeys"
+      alias="jalview"
+      lazy="false"
+      verbose="false"
+      >
+
+      <fileset dir="${packageDir}">
+        <include name="jalview.jar"/>
       </fileset>
-    </delete>
+       </signjar>
+      <taskdef classpathref="build.classpath" resource="com/roxes/tools/ant/taskdefs.properties"/>
+
+      <!--    codebase="http://www.jalview.org/jalview/webstart" -->
+      <jnlp toFile="${packageDir}/jalview.jnlp" href="jalview.jnlp"
+      codebase="${WebStartLocation}">
+      <information>
+        <title>Jalview</title>
+        <vendor>The Barton Group</vendor>
+        <homepage href="http://www.jalview.org"/>
+        <description>Jalview Multiple Alignment Editor</description>
+        <description kind="short">Jalview</description>
+        <icon href="logo_big.gif"/>
+        <offline_allowed/>
+       <!--
+       <association mime-type="application-x/ext-file" extensions="fa"/>
+        <association mime-type="application-x/ext-file" extensions="fasta"/>
+        <association mime-type="application-x/ext-file" extensions="fastq"/>
+        <association mime-type="application-x/ext-file" extensions="blc"/>
+        <association mime-type="application-x/ext-file" extensions="msf"/>
+        <association mime-type="application-x/ext-file" extensions="pfam"/>
+        <association mime-type="application-x/ext-file" extensions="aln"/>
+        <association mime-type="application-x/ext-file" extensions="pir"/>
+       -->
+       </information>
+        <resources>
+          <j2se version="1.4+"/>
+          <fileset dir="${packageDir}">
+            <include name="jalview.jar"/>
+          </fileset>
+          <fileset dir="${packageDir}">
+            <include name="*.jar"/>
+            <exclude name="jalview.jar"/>
+          </fileset>
+          <property name="jalview.version" value="${JALVIEW_VERSION}"/>
+        </resources>
+        <application_desc main_class="jalview.bin.Jalview">
+          </application_desc>
+        <security>
+          <all_permissions/>
+        </security>
+      </jnlp>
+    </target>
+    <target name="runenv" depends="init">
+      <path id="run.classpath">
+        <pathelement location="${outputDir}"/>
+        <fileset dir="${outputDir}">
+          <include name="${libDir}/*.jar"/>
+        </fileset>
+      </path>
+      <pathconvert targetos="unix" refid="run.classpath" property="run.classpath"/>
+
+      <echo>java -classpath ${run.classpath} jalview.bin.Jalview
+      </echo>
+    </target>
+
+    <target name="buildextclients" depends="init">
+<!-- Currently, this doesn't happen automatically.
+     1. Run WSDL2Java as below, which generates an ext.vamsas +
+     vamsas.<datapackages> fileset.
+     2. refactor ext.vamsas.SpecificserviceWS* to
+     ext.vamsas.ServiceclassWS* that implements the ServiceclassWSI interface.
+     3. Update the jalview.ws.*WServices classes to reflect the
+     interface type, and all locations of this wsdl type that Jalview
+     might be using.
+
+-->
+      <path id="axisbuild">
+        <!--        <path refid="axis.classpath"/> -->
+        <path refid="build.classpath"/>
+      </path>
+      <taskdef resource="axis-tasks.properties" classpathref="axisbuild"/>
+      <move todir="./bak">
+        <fileset dir="${sourceDir}" id="client">
+          <include name="${wsdl.ClientNS}/*.*"/>
+        </fileset>
+      </move>
+
+      <axis-wsdl2java
+      output="${sourceDir}"
+      verbose="true"
+      url="${wsdl.MsaWS2}"
+      serverside="false"
+      deployscope="Request"
+      debug="false"
+      helpergen="true"
+      all="true"
+      >
+      <mappingSet>
+        <mapping
+        namespace="${wsdl.Namespace}"
+        package="${wsdl.ClientNS}"
+        />
+        <mapping namespace="http://dataTypes.vamsas"
+        package="${wsdl.ClientNS}"/>
+        </mappingSet>
+    </axis-wsdl2java>
+
   </target>
-  
-  <target name="prepare" depends="init">
-    <mkdir dir="${outputDir}"/>
-    <copy todir="${outputDir}">
-      <fileset dir=".">
+  <target name="package" depends="init, build">
 
-        <include name="${docDir}/**/*.*"/>
-        <include name="${helpDir}/**/*.*"/>
-        <include name="${libDir}/*.*"/>
-      </fileset>
-      <fileset dir="${resourceDir}">
-        <include name="**/*.*"/>
+  </target>
+  <!-- jalopy code reformatter -->
+  <target name="sourcescrub" depends="init,build">
+    <jalopy destdir="jsrc" classpathref="run.classpath"
+      convention="jalview-jalopy.xml">
+      <fileset dir="${sourceDir}">
+        <include name="*.java"/>
+        <include name="**/*.java"/>
+        <include name="**/**/*.java"/>
       </fileset>
-    </copy>
+      </jalopy>
   </target>
 
-  <target name="build" depends="prepare">
-            <!-- not efficient yet. -->
-     <javac srcdir="${sourceDir}" destdir="${outputDir}"
-        classpathref="build.classpath" />
+
+
+  <!-- Compile, package and obfuscate Jalview Applet -->
+  <target name="makeApplet" depends="obfuscate"/>
+
+  <target name="compileApplet" depends="init,clean">
+    <mkdir dir="${outputDir}"/>
+    <javac source="1.2" target="1.1" srcdir="${sourceDir}" destdir="${outputDir}"
+       includes="jalview/analysis/**,jalview/appletgui/**,jalview/datamodel/**jalview/jbappletgui/**,jalview/math/**,jalview/schemes/**"
+       excludes="ext/**,org/**,vamsas/**"/>
   </target>
-  <target name="runenv" depends="init">
-      <path id="run.classpath">
-        <pathelement location="${outputDir}"/>
+
+  <target name="packageApplet" depends="compileApplet, buildPropertiesFile">
+  <copy file="${resourceDir}/images/idwidth.gif" toFile="${outputDir}/images/idwidth.gif"/>
+       <jar destfile="in.jar">
+        <manifest>
+            <attribute name="Main-Class" value="jalview.bin.JalviewLite"/>
+        </manifest>
         <fileset dir="${outputDir}">
-        <include name="${libDir}/*.jar"/>
-      </fileset>
-    </path>
-    <pathconvert targetos="unix" refid="run.classpath" property="run.classpath"/>
-    
-    <echo>java -classpath ${run.classpath} jalview.bin.Jalview
-    </echo>
-</target>
-  
+          <include name="com/**"/>
+          <include name="jalview/**"/>
+          <include name="MCview/**"/>
+          <include name=".build_properties"/>
+          <include name="images/idwidth.gif"/>
+        </fileset>
+      </jar>
+  </target>
 
-  <target name="package" depends="init, build">
-    
+  <target name="obfuscate" depends="packageApplet">
+    <taskdef resource="proguard/ant/task.properties" classpath="utils/proguard.jar" />
+    <proguard>
+      -libraryjars "${java.home}/lib/rt.jar"
+      -injars      in.jar
+      -outjars     jalviewApplet.jar
+      -keep public class jalview.bin.JalviewLite
+               { public * ; }
+               
+               
+    </proguard>
+    <delete file="in.jar"/>
   </target>
+
+
 </project>