Merge branch 'Release_2_8_Branch' into WIP_fix_JAL-1423
[jalview.git] / build.xml
index fdefa36..e7f05bc 100755 (executable)
--- a/build.xml
+++ b/build.xml
@@ -1,20 +1,20 @@
 <?xml version="1.0"?>
 <!--
-   * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
-   * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
-   * 
-   * This file is part of Jalview.
-   * 
-   * Jalview is free software: you can redistribute it and/or
-   * modify it under the terms of the GNU General Public License 
-   * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-   * 
-   * Jalview is distributed in the hope that it will be useful, but 
-   * WITHOUT ANY WARRANTY; without even the implied warranty 
-   * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
-   * PURPOSE.  See the GNU General Public License for more details.
-   * 
-   * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * 
+ * This file is part of Jalview.
+ * 
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ * 
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
 -->
 <project name="jalviewX" default="usage" basedir=".">
        <!-- we use jalopy to format our sources -->
                <!-- Key Password -->
                <property name="jalview.key.pass" value="alignmentisfun" />
 
+                   
+                   
                <!-- Don't change anything below here unless you know what you are doing! -->
                <!-- Url path for WebStart in JNLP file -->
                <property name="WebStartLocation" value="http://www.jalview.org/webstart" />
+               <!-- Webstart Image - looked for in resources/images -->
+               <property name="WebStartImage" value="JalviewLogo_big.png"/>
+               <!-- J2SE version needed for webstart launch -->
+               <property name="j2sev" value="1.6+"/>
+
+    <!-- Permissions for running Java applets and applications. Defaults are those suitable for deploying jalview webstart/jalviewLite at www.jalview.org -->
+    <property name="application.codebase" value="*.jalview.org"/>
+    <property name="applet.codebase" value="*"/>
+    <property name="applet.caller-codebase" value="${applet.codebase}"/>
+
                <!-- build directory configuration -->
                <property name="libDir" value="lib" />
                <property name="resourceDir" value="resources" />
                <property name="packageDir" value="dist" />
                <property name="outputJar" value="jalview.jar" />
                <!-- Jalview Applet JMol Jar Dependency -->
-               <property name="jmolJar" value="JmolApplet-12.1.13.jar" />
+               <property name="jmolJar" value="JmolApplet-12.2.4.jar" />
                <property name="jalviewLiteJar" value="jalviewApplet.jar" />
                <!-- switch to indicate if we should obfuscate jalviewLite -->
                <!--<property name="donotobfuscate" value="true"/> -->
                                <include name="*.jar" />
                                <include name="**/*.jar" />
                        </fileset>
+                       <fileset dir="${java.home}/lib">
+                               <include name="plugin.jar"/>
+                       </fileset>
                        <fileset dir="appletlib">
                                <!-- the JmolApplet includes the JmolApplet console and the application javac seems to always try and build all packages 
                                -->
                </path>
                <property name="source.dist.name" value="${basedir}/jalview-src.tar.gz" />
                <!-- The Location of the java 1.1.8 jdk -->
-               <property name="java118.home" value="C:\Sun\jdk1.1.8" />
-               <property name="applet.jre.tools" value="${java118.home}/lib/classes.zip" />
-               <!-- jre for 1.4 version
-               <property name="applet.jre.tools" value="${java.home}/lib/rt.jar"/>
+               <!--<property name="java118.home" value="C:\Sun\jdk1.1.8" />
                -->
+               <property name="java118.home" value="${java.home}" />
+                   <!--<property name="applet.jre.tools" value="${java118.home}/lib/classes.zip" />
+               --><!-- jre for 1.4 version -->
+               <property name="applet.jre.tools" value="${java.home}/lib/rt.jar"/>
+               
                <!-- the classpath for building the 1.1 applet -->
                <path id="jalviewlite.deps">
                        <fileset dir="${java118.home}">
                                <include name="lib/classes.zip" />
                        </fileset>
+                       <fileset dir="${java.home}/lib">
+                               <include name="plugin.jar"/>
+                       </fileset>
                        <pathelement location="appletlib/${jmolJar}" />
                </path>
+    <!-- default location for outputting javadoc -->
+    <property name="javadocDir" value="${packageDir}/javadoc"/>
        </target>
 
 
 
        <target name="clean" depends="init">
                <!-- not efficient yet. -->
-               <delete dir="${outputDir}" />
+               <delete dir="${outputDir}" includes="*,**/*"/>
        </target>
 
        <target name="distclean" depends="init, clean">
 
        <target name="makefulldist" depends="makedist">
                <!-- the default keystore details might need to be edited here -->
-               <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false">
+               <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false" sigalg="SHA1withRSA">
 
                        <fileset dir="${packageDir}">
                                <include name="*.jar" />
                        </fileset>
                </signjar>
+               <copy todir="${packageDir}">
+                       <fileset dir="${resourceDir}/images">
+                               <include name="${WebStartImage}"/>
+                       </fileset>
+                                       </copy>
+               
                <taskdef classpathref="build.classpath" resource="com/roxes/tools/ant/taskdefs.properties" />
 
                <!--    codebase="http://www.jalview.org/jalview/webstart" -->
                                <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"/>
-        <association mime-type="application-x/ext-file" extensions="amsa"/>
-       -->
+                               <icon href="${WebStartImage}" />
+                               <offline_allowed/>
                        </information>
                        <resources>
-                               <j2se version="1.5+" initial_heap_size="10M" />
+                               <j2se version="${j2sev}" initial_heap_size="10M"  />
                                <fileset dir="${packageDir}">
                                        <include name="jalview.jar" />
                                </fileset>
                        <security>
                                <all_permissions />
                        </security>
-               </jnlp>
-               <!-- the rest of these jnlp tasks are copy and pastes of the above but with different Vm args -->
+               </jnlp>         
                <jnlp toFile="${packageDir}/jalview_1G.jnlp" codebase="${WebStartLocation}">
                        <information>
                                <title>Jalview</title>
                                <homepage href="http://www.jalview.org" />
                                <description>Jalview Multiple Alignment Editor</description>
                                <description kind="short">Jalview</description>
-                               <icon href="logo_big.gif" />
+                               <icon href="${WebStartImage}" />
                                <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"/>
-               <association mime-type="application-x/ext-file" extensions="amsa"/>
-               -->
                        </information>
                        <resources>
-                               <j2se version="1.5+" initial_heap_size="64M" max_heap_size="512M" />
+                               <j2se version="${j2sev}" initial_heap_size="128M" max_heap_size="512M" />
                                <fileset dir="${packageDir}">
                                        <include name="jalview.jar" />
                                </fileset>
                                <homepage href="http://www.jalview.org" />
                                <description>Jalview Multiple Alignment Editor</description>
                                <description kind="short">Jalview</description>
-                               <icon href="logo_big.gif" />
+                               <icon href="${WebStartImage}" />
                                <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"/>
-                       <association mime-type="application-x/ext-file" extensions="amsa"/>
-                       -->
                        </information>
                        <resources>
-                               <j2se version="1.5+" initial_heap_size="256M" max_heap_size="1024M" />
+                               <j2se version="${j2sev}" initial_heap_size="256M" max_heap_size="1024M" />
                                <fileset dir="${packageDir}">
                                        <include name="jalview.jar" />
                                </fileset>
                                <all_permissions />
                        </security>
                </jnlp>
-
+                       <!-- finally, need to postprocess to add in associations at end of 'information' element 
+                       
+                       <xslt in="${packageDir}/jalview_noa_1G.jnlp" out="${packageDir}/jalview_1G.jnlp">
+               
+               </xslt>
+                       
+                       
+                       -->
+                                       <!--
+                               <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"/>
+        <association mime-type="application-x/ext-file" extensions="amsa"/>
+        <association mime-type="application-x/ext-file" extensions="stk"/>
+        <association mime-type="application-x/ext-file" extensions="jar"/>-->
+       
        </target>
 
        <target name="runenv" depends="init">
                                <include name="*.jar"/>
                        </fileset>
                </delete>
-               <jar destfile="${packageDir}/${outputJar}">
+               <jar destfile="${packageDir}/${outputJar}" index="true">
                        <manifest>
                                <attribute name="Main-Class" value="jalview.bin.Jalview" />
+        <attribute name="Permissions" value="all-permissions" />
+        <attribute name="Application-Name" value="Jalview Desktop"/>
+        <attribute name="Codebase" value="${application.codebase}"/>
                        </manifest>
                        <fileset dir="${outputDir}/">
                                <exclude name="cache*/**" />
 
 
        <!-- Compile, package and obfuscate Jalview Applet -->
-       <target name="makeApplet" depends="obfuscate" />
+       <target name="makeApplet" depends="obfuscate" description="assemble the final jalviewLite applet jar with or without obfuscation"/>
 
        <target name="compileApplet" depends="init,clean">
                <mkdir dir="${outputDir}" />
-               <javac source="1.5" target="1.5" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}" classpath="appletlib/${jmolJar}" includes="jalview/appletgui/**" excludes="ext/**,MCview/**,org/**,vamsas/**" />
+               <javac source="1.5" target="1.5" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}" 
+                       classpathref="jalviewlite.deps" includes="jalview/appletgui/**"
+                       excludes="ext/**,MCview/**,org/**,vamsas/**" />
        </target>
 
        <target name="packageApplet" depends="compileApplet, buildPropertiesFile">
                <copy file="${resourceDir}/images/idwidth.gif" toFile="${outputDir}/images/idwidth.gif" />
                <copy file="${resourceDir}/images/link.gif" toFile="${outputDir}/images/link.gif" />
-               <jar destfile="in.jar">
+               <jar destfile="in.jar" index="true">
                        <manifest>
                                <attribute name="Main-Class" value="jalview.bin.JalviewLite" />
+                               <attribute name="Application-Name" value="JalviewLite"/>
+                               <attribute name="Permissions" value="all-permissions" />
+                               <attribute name="Codebase" value="${applet.codebase}"/>
                        </manifest>
                        <fileset dir="${outputDir}">
                                <include name="com/**" />
                        </fileset>
                </jar>
        </target>
-       <target name="obfuscate" depends="-obfuscatefake,-obfuscatereally" description="construct the final jalviewLite applet jar with or without obfuscation">
+       <target name="obfuscate" depends="-obfuscatefake,-obfuscatereally">
        </target>
        <target name="-obfuscatefake" depends="packageApplet" if="donotobfuscate">
                <copy file="in.jar" tofile="${jalviewLiteJar}" overwrite="true" />
                        <injar file="in.jar" />
                        <outjar file="${jalviewLiteJar}" />
                        <libraryjar refid="obfuscateDeps.path" />
+                       <dontwarn/>
                        <keep access="public" type="class" name="jalview.bin.JalviewLite">
                                <field access="public" />
                                <method access="public" />
                                <constructor access="public" />
                        </keep>
+                       <keep access="public" type="class" name="jalview.appletgui.AlignFrame">
+                               <field access="public" />
+                               <method access="public" />
+                               <constructor access="public" />
+                       </keep>
                        <!--      -libraryjars "${obfuscateDeps}"
       -injars      in.jar
       -outjars     jalviewApplet.jar
                                <include name="jalview-jalopy.xml" />
                                <include name="JalviewApplet.jpx" />
                                <include name="JalviewX.jpx" />
+                               <include name="nbbuild.xml"/>
+                               <include name="nbproject/genfiles.properties"/>
+        <include name="nbproject/project.properties"/>
+        <include name="nbproject/project.xml"/>
                                <include name="${sourceDir}/*.java" />
                                <include name="${sourceDir}/**/*.java" />
                                <include name="${sourceDir}/**/*.cdr" />
                                <include name="${schemaDir}/**/*" />
                                <include name="utils/**/*" />
                                <include name="${docDir}/**/*" />
+                               <include name="examples/**/*" />
                        </tarfileset>
                </tar>
        </target>
+       <target name="pubapplet" description="installs the jalviewLite applet and dependent jars into an applet examples directory built under ${outputDir}" depends="makeApplet">
+         <copy todir="${packageDir}/examples">
+         <fileset dir="examples">
+               <include name="**/*"/>
+               <include name="javascript/*"/>
+      <include name="jmol/*"/>
+         </fileset>
+               <fileset dir=".">
+               <include name="${jalviewLiteJar}"/>
+                       </fileset>
+               <fileset dir="appletlib">
+                     <include name="**/*"/>
+                       </fileset>
+         </copy>
+         <presetdef name="applet.jar">
+           <jar update="true" index="true">
+               <manifest>
+               <attribute name="Application-Name" value="JalviewLite"/>
+               <attribute name="Permissions" value="all-permissions"/>
+               <attribute name="Codebase" value="${applet.codebase}"/>
+               <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}"/>
+               <attribute name="Application-Library-Allowable-Codebase" value="${applet.codebase}"/>
+               <!--
+               <attribute name="Application-Library-Allowable-Codebase" value="${applet.codebase}"/>
+               -->
+<!--           <attribute name="Trusted-Only" value="true"/>
+-->
+<!--           <attribute name="Trusted-Library" value="true"/>
+-->
+               </manifest>
+         </jar>
+         </presetdef>
+         <presetdef name="applet_tl.jar">
+           <jar update="true" index="true" jarfile="@{jarfile}">
+               <manifest>
+               <attribute name="Application-Name" value="JalviewLite"/>
+               <attribute name="Permissions" value="all-permissions" />
+               <attribute name="Codebase" value="${applet.codebase}"/>
+               <attribute name="Trusted-Only" value="true"/>
+               <attribute name="Trusted-Library" value="true"/>
+               </manifest>
+         </jar>
+
+         </presetdef>
+         <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/tl_${jalviewLiteJar}"/>
+         <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/tl_${jmolJar}"/>
+         <applet.jar jarfile="${packageDir}/examples/${jalviewLiteJar}"/>
+         <applet_tl.jar jarfile="${packageDir}/examples/tl_${jalviewLiteJar}"/>
+         <applet.jar jarfile="${packageDir}/examples/${jmolJar}"/>
+         <applet_tl.jar jarfile="${packageDir}/examples/tl_${jmolJar}"/>
+    <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false">
+
+      <fileset dir="${packageDir}/examples">
+        <include name="*.jar" />
+      </fileset>
+    </signjar>
+       </target>
+       <target name="sourcedoc" description="Create jalview source documentation pages" depends="init">
+        <javadoc destdir="${javadocDir}">
+               <packageset dir="${sourceDir}" includes="jalview/*,MCView/*">
+               </packageset>
+               </javadoc>
+       </target>
+       
 </project>