JAL-1400 sign the jnlp for arbitrary memory
authorJim Procter <jprocter@compbio.dundee.ac.uk>
Tue, 28 Jan 2014 16:00:09 +0000 (16:00 +0000)
committerJim Procter <jprocter@compbio.dundee.ac.uk>
Tue, 28 Jan 2014 16:00:09 +0000 (16:00 +0000)
build.xml

index 83425ce..990cbe6 100755 (executable)
--- a/build.xml
+++ b/build.xml
   </target>
 
   <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" sigalg="SHA1withRSA">
 
-      <fileset dir="${packageDir}">
-        <include name="*.jar" />
-      </fileset>
-    </signjar>
     <copy todir="${packageDir}">
       <fileset dir="${resourceDir}/images">
         <include name="${WebStartImage}" />
 
     <taskdef classpathref="build.classpath" resource="com/roxes/tools/ant/taskdefs.properties" />
 
-    <!--    codebase="http://www.jalview.org/jalview/webstart" -->
-    <!-- href="jalview.jnlp" prevent hard-wired pickup of jnlp in certain javaws versions -->
-    <jnlp toFile="${packageDir}/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="${WebStartImage}" />
-        <offline_allowed />
-      </information>
-      <resources>
-        <j2se version="${j2sev}" initial_heap_size="10M" />
-        <fileset dir="${packageDir}">
-          <include name="jalview.jar" />
-        </fileset>
-        <fileset dir="${packageDir}">
-          <include name="*.jar" />
-          <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>
-    <jnlp toFile="${packageDir}/jalview_1G.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="${WebStartImage}" />
-        <offline_allowed />
-      </information>
-      <resources>
-        <j2se version="${j2sev}" initial_heap_size="128M" max_heap_size="512M" />
-        <fileset dir="${packageDir}">
-          <include name="jalview.jar" />
-        </fileset>
-        <fileset dir="${packageDir}">
-          <include name="*.jar" />
-          <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>
-    <jnlp toFile="${packageDir}/jalview_2G.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="${WebStartImage}" />
-        <offline_allowed />
-      </information>
-      <resources>
-        <j2se version="${j2sev}" initial_heap_size="256M" max_heap_size="1024M" />
-        <fileset dir="${packageDir}">
-          <include name="jalview.jar" />
-        </fileset>
-        <fileset dir="${packageDir}">
-          <include name="*.jar" />
-          <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>
-    <!-- finally, need to postprocess to add in associations at end of 'information' element 
+    <!-- create a dummy jar which will eventually contain the jnlp template -->
+    <jar destfile="${packageDir}/jalview_jnlp_vm.jar" index="true">
+          <fileset dir="${packageDir}">
+            <include name="jalview.jar"/>
+          </fileset>
+    </jar>
+       
+       <mkdir dir="${packageDir}/JNLP-INF"/>
+    <antcall target="writejnlpf">
+       <param name="jnlpFile" value="${packageDir}/JNLP-INF/APPLICATION-TEMPLATE.JNLP"/>
+       <param name="inih" value="*" />
+       <param name="maxh" value="*"/>
+    </antcall>
+               
+       <jar destfile="${packageDir}/jalview_jnlp_vm.jar" index="true">
+             <fileset dir="${packageDir}">
+               <include name="JNLP-INF"/>
+             </fileset>
+       </jar>
+    
+       <antcall target="writejnlpf">
+               <param name="jnlpFile" value="${packageDir}/jalview.jnlp"/>
+               <param name="inih" value="10M" />
+         <param name="maxh" value="256M"/>
+       </antcall>
+       
+       <antcall target="writejnlpf">
+         <param name="jnlpFile" value="${packageDir}/jalview_1G.jnlp"/>
+         <param name="inih" value="128M" />
+               <param name="maxh" value="512M"/>
+       </antcall>
+           
+       <antcall target="writejnlpf">
+         <param name="jnlpFile" value="${packageDir}/jalview_2G.jnlp"/>
+         <param name="inih" value="256M" />
+         <param name="maxh" value="1024M"/>
+       </antcall>
+       
+       <!-- 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">
                
         <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"/>-->
-
+    <!-- and sign the jars -->
+    <!-- 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" sigalg="SHA1withRSA">
+        <fileset dir="${packageDir}">
+          <include name="*.jar" />
+        </fileset>
+    </signjar>
   </target>
 
   <target name="runenv" depends="init">
     <echo>java -classpath ${run.classpath} jalview.bin.Jalview
       </echo>
   </target>
-
+  <target name="writejnlpf">
+       <presetdef name="jnlpf">
+           <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="${WebStartImage}" />
+               <offline_allowed />
+             </information>
+             <resources>
+               <j2se version="${j2sev}" initial_heap_size="${inih}" max_heap_size="${maxh}" />
+               <fileset dir="${packageDir}">
+                 <include name="jalview.jar" />
+               </fileset>
+               <fileset dir="${packageDir}">
+                 <include name="*.jar" />
+                 <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>
+           </presetdef>
+
+           <jnlpf toFile="${jnlpFile}"/>
+  </target>
   <target name="buildextclients" depends="init">
     <input message="Building external client source from WSDLs - Do you really want to do this ? (Yy/Nn)" validargs="Y,y,n,N" defaultvalue="N" addproperty="doextbuild.response" />
     <condition property="dontextbuild">