JAL-1791 sign the applet with/out timestamps
authorJim Procter <jprocter@issues.jalview.org>
Thu, 15 Oct 2015 15:59:31 +0000 (16:59 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Thu, 15 Oct 2015 15:59:31 +0000 (16:59 +0100)
build.xml

index 6b5fead..4db3545 100755 (executable)
--- a/build.xml
+++ b/build.xml
     <property name="jalview.key" value="jalview" />
     <!-- Key Password -->
     <property name="jalview.key.pass" value="alignmentisfun" />
-       <!-- time stamp server URL -->
+    <!-- time stamp server URL -->
     <property name="jalview.tsaurl" value="" />
-         
+    <!-- locally valid proxy for signing with external time server -->
+    <property name="proxyPort" value="80"/>
+    <property name="proxyHost" value="sqid"/>
+
+    <!-- default TestNG groups to run -->
     <property name="testng-groups" value="Functional" />
 
     <!-- Don't change anything below here unless you know what you are doing! -->
     </java>
   </target>
 
-    <target name="preparejnlp" depends="makedist">
+  <target name="preparejnlp" depends="makedist">
     <copy todir="${packageDir}">
       <fileset dir="${resourceDir}/images">
         <include name="${WebStartImage}" />
         <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>
+
   <target name="-jarsignwithtsa" depends="makedist,preparejnlp" if="timestamp">
     <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false" sigalg="SHA1withRSA"
-      tsaproxyhost="squid" tsaproxyport="80" tsaurl="${jalview.tsaurl}">
+      tsaproxyhost="${proxyHost}" tsaproxyport="${proxyPort}" tsaurl="${jalview.tsaurl}">
       <fileset dir="${packageDir}">
         <include name="*.jar" />
-      </fileset>      
+      </fileset>
     </signjar>
   </target>
   <target name="-jarsignnotsa" depends="makedist,preparejnlp" unless="timestamp">
     <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>      
+      </fileset>
     </signjar>
   </target>
 
             <exclude name="jalview.jar" />
             <exclude name="*jnilib.jar" />
           </fileset>
+          <property name="jalview.version" value="${JALVIEW_VERSION}" />
         </resources>
         <resources os="Mac OS X">
-          <property name="jalview.version" value="${JALVIEW_VERSION}" />
           <fileset dir="${packageDir}">
             <include name="*quaqua*.jnilib.jar" />
           </fileset>
     </tarfileset>
   </tar>
 </target>
-<target name="pubapplet" description="installs the jalviewLite applet and dependent jars into an applet examples directory built under ${outputDir}" depends="makeApplet">
+<target name="prepubapplet_1" depends="makeApplet">
   <copy todir="${packageDir}/examples">
     <fileset dir="examples">
       <include name="**/*" />
       <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}" />
     </manifest>
   </jar>
+</target>
+<target name="-signexdirsnotsa" depends="prepubapplet_1" unless="timestamp">
   <signjar sigalg="SHA1WithRSA" 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="-signexdirstsa" depends="prepubapplet_1" if="timestamp">
+  <signjar sigalg="SHA1WithRSA" storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false" tsaproxyhost="${proxyHost}" tsaproxyport="${proxyPort}" tsaurl="${jalview.tsaurl}">
+    <fileset dir="${packageDir}/examples">
+      <include name="*.jar" />
+    </fileset>
+  </signjar>
+</target>
+
+<target name="prepubapplet_2" depends="-signexdirsnotsa,-signexdirstsa">
   <presetdef name="ap_applet.jar">
     <!-- build a signed applet with 'all-permissions' - 
                          Needs 'param name="permissions' value="all-permissions"' in applet tag
   <applet.jar jarfile="${packageDir}/examples/${javaJson}" />
   <applet.jar jarfile="${packageDir}/examples/${jsonSimple}" />
 
-  <!-- todo - write examples/downloads for alternate versions of the applet -->
+  <!-- todo - write examples/downloads for alternate versions of the applet 
+    probably don't need to do this now since we don't have alternate versions anymore !-->
+</target>
+<target name="-signapplet" depends="prepubapplet_2">
+  <fileset name="signappletjarset" dir="${packageDir}/examples">
+    <exclude name="u_*.jar" />
+    <include name="${jalviewLiteJar}" />
+    <include name="${jmolJar}" />
+    <include name="${javaJson}" />
+    <include name="${jsonSimple}" />
+    <include name="to_${jalviewLiteJar}" />
+    <include name="to_${jmolJar}" />
+    <include name="to_${javaJson}" />
+    <include name="to_${jsonSimple}" />
+    <include name="tl_${jalviewLiteJar}" />
+    <include name="tl_${jmolJar}" />
+    <include name="tl_${javaJson}" />
+    <include name="tl_${jsonSimple}" />
+    <include name="ap_${jalviewLiteJar}" />
+    <include name="ap_${jmolJar}" />
+    <include name="ap_${javaJson}" />
+    <include name="ap_${jsonSimple}" />
+  </fileset>
+</target>
+<target name="-signappletnotsa" unless="timestamp" depends="-signapplet">
   <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false">
+    <fileset refid="signappletjarset" />
+  </signjar>
+</target>
 
-    <fileset dir="${packageDir}/examples">
-      <exclude name="u_*.jar" />
-      <include name="${jalviewLiteJar}" />
-      <include name="${jmolJar}" />
-      <include name="${javaJson}" />
-      <include name="${jsonSimple}" />
-      <include name="to_${jalviewLiteJar}" />
-      <include name="to_${jmolJar}" />
-      <include name="to_${javaJson}" />
-      <include name="to_${jsonSimple}" />
-      <include name="tl_${jalviewLiteJar}" />
-      <include name="tl_${jmolJar}" />
-      <include name="tl_${javaJson}" />
-      <include name="tl_${jsonSimple}" />
-      <include name="ap_${jalviewLiteJar}" />
-      <include name="ap_${jmolJar}" />
-      <include name="ap_${javaJson}" />
-      <include name="ap_${jsonSimple}" />
-    </fileset>
+<target name="-signapplettsa" if="timestamp" depends="-signapplet">
+  <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false" tsaproxyhost="${proxyHost}" tsaproxyport="${proxyPort}" tsaurl="${jalview.tsaurl}">
+    <fileset refid="signappletjarset" />
   </signjar>
+</target>
+
+<target name="signApplet" description="internal target to sign applet" depends="-signappletnotsa,-signapplettsa" />
+
+<target name="pubapplet" description="installs the jalviewLite applet and dependent jars into an applet examples directory built under ${outputDir}" depends="makeApplet, signApplet">
+
   <!-- bizarre bug causes JmolApplet to always get signed, even if excluded from above. so copy explicitly -->
   <copy file="appletlib/${jmolJar}" tofile="${packageDir}/examples/u_${jmolJar}" overwrite="true" />
   <!-- finally, replace any launchApp servlet tags with a version specification -->