08430dd38f76ca7f35c9e8e7be848ee24a1072e7
[jalview.git] / build.xml
1 <?xml version="1.0"?>
2 <!--
3  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
4  * Copyright (C) $$Year-Rel$$ The Jalview Authors
5  * 
6  * This file is part of Jalview.
7  * 
8  * Jalview is free software: you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License 
10  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11  *  
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
18  * The Jalview Authors are detailed in the 'AUTHORS' file.
19 -->
20 <project name="jalviewX" default="usage" basedir="."
21  xmlns:if="ant:if"
22     xmlns:unless="ant:unless">
23   <taskdef classpath="${clover.jar}" resource="cloverlib.xml" if:set="clover.jar"/>
24   <clover-env if:set="clover.jar"/>
25
26   <target name="help" depends="usage" />
27   <target name="usage" depends="init">
28     <echo message="~~~Jalview Ant build.xml Usage~~~~" />
29     <echo message="Targets include:" />
30     <echo message="usage - default target, displays this message" />
31     <echo message="buildindices - generates JavaHelpSearch from the help files" />
32     <echo message="build - compiles all necessary files for Application" />
33     <echo message="makedist - compiles and places all necessary jar files into directory dist" />
34     <echo message="makefulldist - signs all jar files and builds jnlp file for full distribution" />
35     <echo message="              this needs a keystore and key."/>
36     <echo message="              Add -Dtimestamp to timestamp signed jars"/>
37     <echo message="              -Djalview.keyalg and -Djalview.keydig are SHA1/SHA1withRSA"/>
38     <echo message="              See docs/building.html for more information." />
39     <echo message="compileApplet - compiles all necessary files for Applet" />
40     <echo message="makeApplet - compiles, then packages and obfuscates the Applet" />
41     <echo message="testng - run jalview's tests via testNG. Default group is '${testng-groups}'" />
42     <echo message="      you can specify particular test groups as a list via -Dtestng-groups=" />
43     <echo message="See docs/building.html and the comments in build file for other targets." />
44     <echo message="note: compile and makeApplet optionally compile/obfuscate applet against a different Java version by specifying -Djava118.home=PathtoJDK/lib which is the lib directory in the JDK install that contains rt.jar " />
45     <echo message="Useful -D flags: -Ddonotobfuscate will prevent applet obfuscation" />
46     <echo message="Useful -D flags: -Dclover.jar to specify path to openclover for testng coverage report" />
47   </target>
48
49
50   <!-- utils is a class path to additional utilities needed for
51     building docs, jars and webstart stuff -->
52   <!--
53         Userdefined build property defaults
54
55         wsdl.server list (plus namespace mapping info ???)  - also want
56                 ... to make this a dynamically generatable property
57         WebStart Location
58         Build location - provide a temporary root for speed
59         jarsigner keystore and info
60         Jakarta and axis classpath ?
61         Default argument for starting Jalview (if it exists).
62
63 -->
64
65   <target name="init">
66     <path id="axis.classpath">
67       <!-->
68       <fileset dir="/usr/local/axis/lib">
69         <include name="**/*.jar" />
70       </fileset>
71       <fileset dir="/usr/local/jakarta-tomcat-5/webapps/axis/WEB-INF/lib">
72         <include name="**/*.jar"/>
73         <include name="*.jar"/>
74       </fileset> -->
75       </path>
76
77     <!-- Jalview Version String displayed by application on startup and used to check for updates -->
78     <property name="JALVIEW_VERSION" value="DEVELOPMENT" />
79
80     <property name="INSTALLATION" value="Source" />
81
82     <!-- 2.4 (VAMSAS)" -->
83     <!-- Include debugging information in javac true or false -->
84     <property name="javac.debug" value="true" />
85
86     <!-- JarSigner Key Store for Webstart Distribution -->
87     <property name="jalview.keystore" value="./keys/.keystore" />
88     <!-- Keystore Password -->
89     <property name="jalview.keystore.pass" value="alignmentisfun" />
90     <!-- Key Name -->
91     <property name="jalview.key" value="jalview" />
92     <!-- Key Password -->
93     <property name="jalview.key.pass" value="alignmentisfun" />
94     <!-- time stamp server URL -->
95     <property name="jalview.tsaurl" value="" />
96     <!-- locally valid proxy for signing with external time server -->
97     <property name="proxyPort" value="80"/>
98     <property name="proxyHost" value="sqid"/>
99     <!-- key sign/digest algorithms -->
100     <property name="jalview.keyalg" value="SHA1withRSA" description="key algorithm for signing"/>
101     <property name="jalview.keydig" value="SHA1" description="algorithm for jar digest"/>
102
103     <!-- default TestNG groups to run -->
104     <property name="testng-groups" value="Functional" />
105     <!-- Java 9 JVM args -->
106     <condition property="java9">
107       <equals arg1="${ant.java.version}" arg2="9"/>
108     </condition>
109
110     <!-- Don't change anything below here unless you know what you are doing! -->
111     <!-- Url path for WebStart in JNLP file -->
112     <property name="WebStartLocation" value="http://www.jalview.org/webstart" />
113     <!-- Webstart Image - looked for in resources/images -->
114     <property name="WebStartImage" value="JalviewLogo_big.png" />
115     <!-- J2SE version needed for webstart launch -->
116     <!-- Anne's version needs 1.7 - should rebuild VARNA to java 1.6 for release -->
117     <property name="j2sev" value="1.7+" />
118     <!-- Java Compilation settings - source and target javac version -->
119     <property name="javac.source" value="1.8" />
120     <property name="javac.target" value="1.8" />
121
122     <!-- Permissions for running Java applets and applications. -->
123     <!-- Defaults are those suitable for deploying jalview webstart www.jalview.org -->
124     <property name="application.codebase" value="*.jalview.org" />
125     <!-- and allowing the applet to be deployed from any URL -->
126     <!-- note - if you want to make sure LiveConnect works without any warnings, please rebuild and sign your applet jar with your own domain included in the codebase/allowable-codebase properties -->
127     <property name="applet.codebase" value="*.jalview.org *.dundee.ac.uk *" />
128     <property name="applet.caller-codebase" value="${applet.codebase}" />
129
130     <!-- build directory configuration -->
131     <property name="libDir" value="lib" />
132     <property name="resourceDir" value="resources" />
133     <property name="helpDir" value="help" />
134     <property name="docDir" value="doc" />
135     <property name="sourceDir" value="src" />
136     <property name="schemaDir" value="schemas" />
137     <property name="outputDir" value="classes" />
138     <property name="packageDir" value="dist" />
139     <property name="outputJar" value="jalview.jar" />
140     <!-- Jalview Applet JMol Jar Dependency -->
141     <property name="jmolJar" value="JmolApplet-14.6.4_2016.10.26.jar" />
142     <property name="varnaJar" value="VARNAv3-93.jar" />
143     <property name="jsoup" value="jsoup-1.8.1.jar" />
144     <property name="jsonSimple" value="json_simple-1.1.jar" />
145     <property name="javaJson" value="java-json.jar" />
146     <property name="jalviewLiteJar" value="jalviewApplet.jar" />
147     <property name="reportDir" value="test-reports" />
148     <property name="testDir" value="test" />
149     <property name="testOutputDir" value="tests" />
150     <!-- switch to indicate if we should obfuscate jalviewLite -->
151     <!-- <property name="donotobfuscate" value="true"/> -->
152     <!-- switch to exclude associations from generated jnlp files -->
153     <!-- <property name="nojnlpfileassocs" value="true"/> -->
154
155     <!-- Jalview Web Service Clients - see the comments in 'buildextclients' for details -->
156     <property name="wsdl.File" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred?wsdl" />
157     <property name="wsdl.Files" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/vamsas?wsdlFiles" />
158     <property name="wsdl.MsaWS" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/MuscleWS?wsdl" />
159     <property name="wsdl.MsaWS2" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/ClustalWS?wsdl" />
160     <property name="WSInterf" value="MsaWS" />
161     <property name="wsdl.Namespace" value="vamsas" />
162     <property name="wsdl.ClientNS" value="ext.vamsas" />
163     <!-- the class path for building the application -->
164     <path id="build.classpath">
165       <fileset dir="utils">
166         <include name="*.jar" />
167         <include name="**/*.jar" />
168       </fileset>
169       <fileset dir="${libDir}">
170         <include name="*.jar" />
171         <include name="**/*.jar" />
172       </fileset>
173       <fileset dir="${java.home}/lib">
174         <include name="plugin.jar" />
175       </fileset>
176       <fileset dir="appletlib">
177         <!-- the JmolApplet includes the JmolApplet console and the application javac seems to always try and build all packages 
178                                 -->
179         <include name="${jmolJar}" />
180         <include name="${varnaJar}" />
181       </fileset>
182     </path>
183     <path id="test.classpath">
184       <pathelement path="${outputDir}" />
185       <path refid="build.classpath" />
186     </path>
187     <property name="source.dist.name" value="${basedir}/jalview-src.tar.gz" />
188     <!-- The Location of the java 1.1.8 jdk -->
189     <property name="java118.home" value="${java.home}" />
190     <!-- jre for 1.4 version -->
191     <property name="applet.jre.tools" value="${java118.home}/lib/rt.jar" />
192
193     <!-- the classpath for building the 1.1 applet -->
194     <path id="jalviewlite.deps">
195       <fileset dir="${java118.home}">
196         <include name="lib/rt.jar" />
197       </fileset>
198       <fileset dir="${java.home}/lib">
199         <include name="plugin.jar" />
200       </fileset>
201       <pathelement location="appletlib/${jmolJar}" />
202       <pathelement location="lib/${varnaJar}" />
203       <pathelement location="appletlib/${jsoup}" />
204       <pathelement location="appletlib/${jsonSimple}" />
205       <pathelement location="appletlib/${javaJson}" />
206
207     </path>
208     <!-- default location for outputting javadoc -->
209     <property name="javadocDir" value="${packageDir}/javadoc" />
210   </target>
211
212
213   <taskdef classpath="utils/roxes-ant-tasks-1.2-2004-01-30.jar" resource="com/roxes/tools/ant/taskdefs.properties" />
214   <target name="buildPropertiesFile" depends="init">
215     <tstamp prefix="build">
216       <format property="date" pattern="dd MMMM yyyy" />
217     </tstamp>
218     <exec executable="/usr/bin/git" outputproperty="git.commit" failifexecutionfails="false">
219       <arg value="rev-parse" />
220       <arg value="--short" />
221       <arg value="HEAD" />
222     </exec>
223     <exec executable="/usr/bin/git" outputproperty="git.branch" failifexecutionfails="false">
224       <arg value="rev-parse" />
225       <arg value="--abbrev-ref" />
226       <arg value="HEAD" />
227     </exec>
228     <properties file="${outputDir}/.build_properties">
229       <header>
230           ---Jalview Build Details---
231         </header>
232       <property name="VERSION" value="${JALVIEW_VERSION}" />
233       <property name="INSTALLATION" value="${INSTALLATION} git-commit:${git.commit} [${git.branch}]" />
234       <property name="BUILD_DATE" value="${build.date}" />
235     </properties>
236   </target>
237
238
239   <target name="clean" depends="init">
240     <!-- not efficient yet. -->
241     <delete dir="${outputDir}" includes="*,**/*" />
242   </target>
243
244   <target name="distclean" depends="init, clean">
245
246     <echo message="REMOVING ALL BACKUP/AUTOSAVES!" />
247     <delete>
248       <fileset dir=".">
249         <include name="${outputJar}" />
250         <include name="#*#" />
251         <include name="#*.*#" />
252         <include name="**/#*#" />
253         <include name="**/#*.*#" />
254         <include name="*~" />
255         <include name="*.*~" />
256         <include name="**/*~" />
257         <include name="**/*.*~" />
258       </fileset>
259     </delete>
260   </target>
261
262   <target name="prepare" depends="init">
263     <mkdir dir="${outputDir}" />
264     <copy todir="${outputDir}">
265       <fileset dir=".">
266         <include name="${docDir}/**/*.*" />
267         <include name="${helpDir}/**/*.*" />
268         <include name="${libDir}/*.jar" />
269       </fileset>
270       <fileset dir="${resourceDir}">
271         <include name="**/*.*" />
272       </fileset>
273     </copy>
274   </target>
275
276   <target name="build" depends="prepare">
277     <!-- not efficient yet. -->
278     <javac source="${javac.source}" target="${javac.target}" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}" classpathref="build.classpath">
279       <exclude name="jalview/*applet*" />
280       <exclude name="jalview/appletgui/**" />
281       <exclude name="com/stevesoft/**" />
282     </javac>
283   </target>
284
285
286   <target name="testclean" depends="init">
287     <delete dir="${testOutputDir}" includes="*,**/*" />
288   </target>
289
290   <target name="prepareTests" depends="init,testclean">
291     <mkdir dir="${testOutputDir}" />
292   </target>
293
294   <target name="buildTests" depends="build,buildindices,prepareTests">
295     <javac source="${javac.source}" target="${javac.target}" srcdir="${testDir}" destdir="${testOutputDir}" debug="${javac.debug}" classpathref="test.classpath" includeantruntime="false">
296     </javac>
297   </target>
298
299   <taskdef resource="testngtasks" classpath="utils/testnglibs/testng.jar" />
300
301   <target name="testng" depends="buildTests">
302     <testng outputDir="${reportDir}" haltOnFailure="false" groups="${testng-groups}" mode="testng"
303       verbose="2">
304       <classpath>
305         <pathelement location="${testOutputDir}" />
306         <pathelement location="${clover.jar}" if:set="clover.jar"/>
307         <path refid="test.classpath" />
308       </classpath>
309       <jvmarg value="--add-modules=java.se.ee" if:set="java9"/>
310       <jvmarg value="--illegal-access=warn" if:set="java9"/>
311       <classfileset dir="${testOutputDir}" includes="**/*.class" />
312     </testng>
313   </target>
314
315   <target name="buildindices" depends="init, prepare" unless="help.uptodate">
316     <replace value="${JALVIEW_VERSION}">
317       <replacetoken><![CDATA[$$Version-Rel$$]]></replacetoken>
318       <fileset dir="${outputDir}/${helpDir}">
319         <include name="help.jhm" />
320       </fileset>
321     </replace>
322
323     <java classname="com.sun.java.help.search.Indexer" classpathref="build.classpath" fork="true" dir="${outputDir}/${helpDir}">
324       <arg line="html" />
325     </java>
326   </target>
327
328   <target name="preparejnlp" depends="makedist">
329     <copy todir="${packageDir}">
330       <fileset dir="${resourceDir}/images">
331         <include name="${WebStartImage}" />
332       </fileset>
333     </copy>
334
335     <taskdef classpathref="build.classpath" resource="com/roxes/tools/ant/taskdefs.properties" />
336
337     <!-- create a dummy jar which will eventually contain the jnlp template -->
338     <jar destfile="${packageDir}/jalview_jnlp_vm.jar" index="true">
339       <fileset dir="${packageDir}">
340         <include name="jalview.jar" />
341       </fileset>
342     </jar>
343
344     <mkdir dir="${packageDir}/JNLP-INF" />
345     <antcall target="writejnlpf">
346       <param name="jnlpFile" value="${packageDir}/JNLP-INF/APPLICATION-TEMPLATE.JNLP" />
347       <param name="inih" value="*" />
348       <param name="maxh" value="*" />
349     </antcall>
350
351     <jar destfile="${packageDir}/jalview_jnlp_vm.jar" index="true">
352       <fileset dir="${packageDir}">
353         <include name="JNLP-INF/APPLICATION-TEMPLATE.JNLP" />
354       </fileset>
355     </jar>
356
357     <antcall target="writejnlpf">
358       <param name="jnlpFile" value="${packageDir}/jalview.jnlp" />
359       <param name="inih" value="10M" />
360       <param name="maxh" value="256M" />
361     </antcall>
362
363     <antcall target="writejnlpf">
364       <param name="jnlpFile" value="${packageDir}/jalview_1G.jnlp" />
365       <param name="inih" value="128M" />
366       <param name="maxh" value="512M" />
367     </antcall>
368
369     <antcall target="writejnlpf">
370       <param name="jnlpFile" value="${packageDir}/jalview_2G.jnlp" />
371       <param name="inih" value="256M" />
372       <param name="maxh" value="1024M" />
373     </antcall>
374
375     <!-- finally, need to postprocess to add in associations at end of 'information' element 
376                         
377                         <xslt in="${packageDir}/jalview_noa_1G.jnlp" out="${packageDir}/jalview_1G.jnlp">
378                 
379                 </xslt>
380                         
381                         
382                         -->
383     <!--
384                                 <association mime-type="application-x/ext-file" extensions="fa"/>
385         <association mime-type="application-x/ext-file" extensions="fasta"/>
386         <association mime-type="application-x/ext-file" extensions="mfa"/>
387         <association mime-type="application-x/ext-file" extensions="fastq"/>
388         <association mime-type="application-x/ext-file" extensions="blc"/>
389         <association mime-type="application-x/ext-file" extensions="msf"/>
390         <association mime-type="application-x/ext-file" extensions="pfam"/>
391         <association mime-type="application-x/ext-file" extensions="aln"/>
392         <association mime-type="application-x/ext-file" extensions="pir"/>
393         <association mime-type="application-x/ext-file" extensions="amsa"/>
394         <association mime-type="application-x/ext-file" extensions="stk"/>
395         <association mime-type="application-x/ext-file" extensions="jar"/>-->
396   </target>
397
398   <target name="-jarsignwithtsa" depends="makedist,preparejnlp" if="timestamp">
399     <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false" sigalg="${jalview.keyalg}" digestalg="${jalview.keydig}"
400       tsaproxyhost="${proxyHost}" tsaproxyport="${proxyPort}" tsaurl="${jalview.tsaurl}">
401       <fileset dir="${packageDir}">
402         <include name="*.jar" />
403       </fileset>
404     </signjar>
405   </target>
406   <target name="-jarsignnotsa" depends="makedist,preparejnlp" unless="timestamp">
407     <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false" sigalg="${jalview.keyalg}" digestalg="${jalview.keydig}">
408       <fileset dir="${packageDir}">
409         <include name="*.jar" />
410       </fileset>
411     </signjar>
412   </target>
413
414   <target name="makefulldist" depends="makedist,preparejnlp,-jarsignwithtsa,-jarsignnotsa">
415     <!-- and sign the jars -->
416     <!-- the default keystore details might need to be edited here -->
417   </target>
418
419   <target name="runenv" depends="init">
420     <path id="run.classpath">
421       <pathelement location="${outputDir}" />
422       <fileset dir="${outputDir}">
423         <include name="${libDir}/*.jar" />
424       </fileset>
425     </path>
426     <pathconvert targetos="unix" refid="run.classpath" property="run.classpath" />
427
428     <echo>java -classpath ${run.classpath} jalview.bin.Jalview
429       </echo>
430   </target>
431
432   <target name="-generatejnlpf">
433     <presetdef name="jnlpf">
434       <jnlp codebase="${WebStartLocation}">
435         <information>
436           <title>Jalview</title>
437           <vendor>The Barton Group</vendor>
438           <homepage href="http://www.jalview.org" />
439           <description>Jalview Multiple Alignment Editor</description>
440           <description kind="short">Jalview</description>
441           <icon href="${WebStartImage}" />
442           <offline_allowed />
443         </information>
444         <resources>
445           <j2se version="1.8+" />
446           <jar main="true" href="jalview.jar"/>
447           <fileset dir="${packageDir}">
448             <exclude name="jalview.jar" />
449             <include name="*.jar" />
450             <include name="*_*.jar" />
451             <exclude name="*quaqua*.jar" />
452           </fileset>
453           <property name="jalview.version" value="${JALVIEW_VERSION}" />
454         </resources>
455         <resources os="Mac OS X">
456           <fileset dir="${packageDir}">
457                  <include name="quaqua-filechooser-only-8.0.jar"/>
458             <include name="*quaqua64*.jnilib.jar" />
459           </fileset>
460         </resources>
461
462         <application_desc main_class="jalview.bin.Jalview">
463         </application_desc>
464         <security>
465           <all_permissions />
466         </security>
467       </jnlp>
468     </presetdef>
469
470     <jnlpf toFile="${jnlpFile}" />
471     <!-- add the add-modules j2se attribute for java 9 -->
472     <replace file="${jnlpFile}" value="j2se version=&quot;1.8+&quot; initial-heap-size=&quot;${inih}&quot; max-heap-size=&quot;${maxh}&quot; java-vm-args=&quot;--add-modules=java.se.ee --illegal-access=warn&quot;">
473           <replacetoken>j2se version="1.8+"</replacetoken>
474     </replace>
475   </target>
476
477   <target name="-dofakejnlpfileassoc" depends="-generatejnlpf" if="nojnlpfileassocs">
478     <echo message="Not adding JNLP File Associations" />
479   </target>
480
481   <target name="-dojnlpfileassoc" depends="-generatejnlpf" unless="nojnlpfileassocs">
482     <replace file="${jnlpFile}">
483       <replacetoken>
484         <![CDATA[</information>]]></replacetoken>
485       <replacevalue>
486         <![CDATA[
487           <association mime-type="application-x/ext-file" extensions="fa" />
488         <association mime-type="application-x/ext-file" extensions="fasta" />
489         <association mime-type="application-x/ext-file" extensions="mfa" />
490         <association mime-type="application-x/ext-file" extensions="fastq" />
491         <association mime-type="application-x/ext-file" extensions="blc" />
492         <association mime-type="application-x/ext-file" extensions="msf" />
493         <association mime-type="application-x/ext-file" extensions="pfam" />
494         <association mime-type="application-x/ext-file" extensions="aln"/>
495         <association mime-type="application-x/ext-file" extensions="pir"/>
496         <association mime-type="application-x/ext-file" extensions="amsa"/>
497         <association mime-type="application-x/ext-file" extensions="stk"/>
498         <association mime-type="application-x/ext-file" extensions="jvp"/>
499       </information>]]></replacevalue>
500   </replace>
501   <echo message="Added file associations to JNLP file" />
502 </target>
503 <target name="writejnlpf" depends="-dojnlpfileassoc,-dofakejnlpfileassoc">
504 </target>
505
506 <target name="buildextclients" depends="init">
507   <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" />
508   <condition property="dontextbuild">
509     <equals arg1="n" arg2="${doextbuild.response}" />
510   </condition>
511   <condition property="dontextbuild">
512     <equals arg1="N" arg2="${doextbuild.response}" />
513   </condition>
514   <fail if="dontextbuild">
515         Build External Client Code process aborted by user. Jalview source is unchanged.
516       </fail>
517   <!-- Currently, this doesn't happen automatically.
518      1. Run WSDL2Java as below, which generates an ext.vamsas +
519      vamsas.<datapackages> fileset.
520      2. refactor ext.vamsas.SpecificserviceWS* to
521      ext.vamsas.ServiceclassWS* that implements the ServiceclassWSI interface.
522      3. Update the jalview.ws.*WServices classes to reflect the
523      interface type, and all locations of this wsdl type that Jalview
524      might be using.
525
526 -->
527   <path id="axisbuild">
528     <path refid="build.classpath" />
529   </path>
530   <taskdef resource="axis-tasks.properties" classpathref="axisbuild" />
531   <move todir="./bak">
532     <fileset dir="${sourceDir}" id="client">
533       <include name="${wsdl.ClientNS}/*.*" />
534     </fileset>
535   </move>
536
537   <axis-wsdl2java output="${sourceDir}" verbose="true" url="${wsdl.MsaWS2}" serverside="false" deployscope="Request" debug="false" helpergen="true" all="true">
538     <mappingSet>
539       <mapping namespace="${wsdl.Namespace}" package="${wsdl.ClientNS}" />
540       <mapping namespace="http://dataTypes.vamsas" package="${wsdl.ClientNS}" />
541     </mappingSet>
542   </axis-wsdl2java>
543 </target>
544
545 <target name="makedist" depends="build, buildPropertiesFile, linkcheck, buildindices">
546   <!-- make the package jar if not already existing -->
547   <mkdir dir="${packageDir}" />
548   <!-- clean dir if it already existed -->
549   <delete>
550     <fileset dir="${packageDir}">
551       <include name="*.jar" />
552     </fileset>
553   </delete>
554   <jar destfile="${packageDir}/${outputJar}" index="true">
555     <manifest>
556       <attribute name="Main-Class" value="jalview.bin.Jalview" />
557       <attribute name="Permissions" value="all-permissions" />
558       <attribute name="Application-Name" value="Jalview Desktop" />
559       <attribute name="Codebase" value="${application.codebase}" />
560     </manifest>
561     <fileset dir="${outputDir}/">
562       <exclude name="cache*/**" />
563       <exclude name="*.jar" />
564       <exclude name="*.jar.*" />
565       <exclude name="**/*.jar" />
566       <exclude name="**/*.jar.*" />
567     </fileset>
568   </jar>
569
570   <copy toDir="${packageDir}" flatten="true">
571     <fileset dir="${outputDir}">
572       <include name="*.jar" />
573       <include name="**/*.jar" />
574     </fileset>
575   </copy>
576 </target>
577
578
579 <!-- jalopy code reformatter -->
580 <target name="sourcescrub" depends="init,build">
581   <jalopy destdir="jsrc" classpathref="run.classpath" convention="jalview-jalopy.xml">
582     <fileset dir="${sourceDir}">
583       <include name="*.java" />
584       <include name="**/*.java" />
585       <include name="**/**/*.java" />
586     </fileset>
587   </jalopy>
588 </target>
589
590
591
592 <!-- Compile, package and obfuscate Jalview Applet -->
593 <target name="makeApplet" depends="obfuscate" description="assemble the final jalviewLite applet jar with or without obfuscation" />
594
595 <target name="compileApplet" depends="init,clean">
596   <mkdir dir="${outputDir}" />
597   <javac source="${javac.source}" target="${javac.target}" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}" classpathref="jalviewlite.deps" includes="jalview/appletgui/**" excludes="ext/**,gui/**,jbgui/**,MCview/**,org/**,vamsas/**,jalview/ext/rbvi/**,jalview/ext/paradise/**,jalview/ext/ensembl/**,jalview/ext/so/**" />
598 </target>
599
600 <target name="packageApplet" depends="compileApplet, buildPropertiesFile">
601   <copy file="${resourceDir}/images/link.gif" toFile="${outputDir}/images/link.gif" />
602   <copy todir="${outputDir}/lang">
603     <fileset dir="${resourceDir}/lang">
604       <include name="**.*" />
605     </fileset>
606   </copy>
607   <jar destfile="in.jar" index="true">
608     <manifest>
609       <attribute name="Main-Class" value="jalview.bin.JalviewLite" />
610       <attribute name="Application-Name" value="JalviewLite" />
611       <attribute name="Codebase" value="${applet.codebase}" />
612     </manifest>
613     <fileset dir="${outputDir}">
614       <include name="com/**" />
615       <include name="MCview/**" />
616       <include name="jalview/**" />
617       <include name=".build_properties" />
618       <include name="images/link.gif" />
619       <include name="lang/**" />
620     </fileset>
621   </jar>
622 </target>
623 <target name="obfuscate" depends="-obfuscatefake,-obfuscatereally">
624 </target>
625 <target name="-obfuscatefake" depends="packageApplet" if="donotobfuscate">
626   <copy file="in.jar" tofile="${jalviewLiteJar}" overwrite="true" />
627   <delete file="in.jar" />
628 </target>
629 <target name="-obfuscatereally" unless="donotobfuscate">
630
631   <path id="obfuscateDeps.path">
632     <pathelement location="${applet.jre.tools}" />
633     <pathelement location="appletlib/${jmolJar}" />
634     <pathelement location="lib/${varnaJar}" />
635     <pathelement location="appletlib/${jsoup}" />
636     <pathelement location="appletlib/${jsonSimple}" />
637     <pathelement location="appletlib/${javaJson}" />
638     <fileset dir="${java.home}/lib">
639       <include name="plugin.jar" />
640     </fileset>
641   </path>
642   <taskdef resource="proguard/ant/task.properties" classpath="utils/proguard_5.3.3.jar" />
643
644   <proguard verbose="true" >
645     <injar file="in.jar" />
646     <outjar file="${jalviewLiteJar}" />
647     <libraryjar refid="obfuscateDeps.path" />
648     <dontwarn />
649     <keep access="public" type="class" name="jalview.bin.JalviewLite">
650       <field access="public" />
651       <method access="public" />
652       <constructor access="public" />
653     </keep>
654     <keep access="public" type="class" name="jalview.appletgui.AlignFrame">
655       <field access="public" />
656       <method access="public" />
657       <constructor access="public" />
658     </keep>
659
660     <keep name="jalview.json.binding**">
661       <constructor/>
662       <method name="*"/>
663     </keep>
664
665     <keep access="public" type="class" name="MCview.PDBfile">
666       <field access="public" />
667       <method access="public" />
668       <constructor access="public" />
669     </keep>
670
671     <keep access="public" type="class" name="jalview.ws.jws1.Annotate3D">
672       <field access="public" />
673       <method access="public" />
674       <constructor access="public" />
675     </keep>
676
677     <keep access="public" type="class" name="jalview.ext.jmol.JmolParser">
678       <field access="public" />
679       <method access="public" />
680       <constructor access="public" />
681     </keep>
682
683
684     <!--      -libraryjars "${obfuscateDeps}"
685       -injars      in.jar
686       -outjars     jalviewApplet.jar
687       -keep public class jalview.bin.JalviewLite
688        { public * ; } -->
689   </proguard>
690   <delete file="in.jar" />
691 </target>
692
693 <target name="castorbinding" depends="init" description="Generate Java bindings to supported Jalview XML models.">
694   <taskdef name="castor-srcgen" classname="org.castor.anttask.CastorCodeGenTask" classpathref="build.classpath" />
695   <delete>
696     <fileset dir="${sourceDir}/jalview/schemabinding/version2">
697       <include name="*.java" />
698       <include name="descriptors/*.java" />
699     </fileset>
700   </delete>
701   <castor-srcgen file="${schemaDir}/vamsas.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
702   <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
703   <castor-srcgen file="${schemaDir}/JalviewWsParamSet.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
704   <castor-srcgen file="${schemaDir}/jalview.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
705   <!-- 
706                 now build the jalview.binding package with the old schema set
707                 -->
708   <delete>
709     <fileset dir="${sourceDir}/jalview/binding/">
710       <include name="**" />
711     </fileset>
712   </delete>
713   <castor-srcgen file="${schemaDir}/vamsasJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
714   <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
715   <castor-srcgen file="${schemaDir}/jalviewJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
716 </target>
717 <target name="sourcedist" description="create jalview source distribution" depends="init">
718   <delete file="${source.dist.name}" />
719   <!-- temporary copy of source to update timestamps -->
720   <copy todir="_sourcedist">
721     <fileset dir=".">
722       <exclude name=".*" />
723       <exclude name="**/.*" />
724       <exclude name="*.class" />
725       <exclude name="**/*.class" />
726       <include name="LICENSE" />
727       <include name="README" />
728       <include name="build.xml" />
729       <include name="jalview-jalopy.xml" />
730       <include name="JalviewApplet.jpx" />
731       <include name="JalviewX.jpx" />
732       <include name="nbbuild.xml" />
733       <include name="nbproject/genfiles.properties" />
734       <include name="nbproject/project.properties" />
735       <include name="nbproject/project.xml" />
736       <include name="${sourceDir}/*.java" />
737       <include name="${sourceDir}/**/*.java" />
738       <include name="${sourceDir}/**/*.cdr" />
739       <include name="${libDir}/**/*" />
740       <include name="${resourceDir}/**/*" />
741       <include name="${helpDir}/**/*" />
742       <include name="appletlib/${jmolJar}" />
743       <include name="appletlib/${jsonSimple}" />
744       <include name="appletlib/${javaJson}" />
745       <exclude name="**/*locales" />
746       <exclude name="*locales/**" />
747       <exclude name="utils/InstallAnywhere/**Build.iap_xml" />
748       <exclude name="utils/InstallAnywhere/**Build*/**" />
749       <exclude name="utils/InstallAnywhere/**Build*/**" />
750       <exclude name="utils/InstallAnywhere/.build*.*/**" />
751       <exclude name="utils/InstallAnywhere/**locale*" />
752       <exclude name="utils/InstallAnywhere/**locale*/**" />
753       <exclude name="utils/InstallAnywhere/**locale*/**" />
754       <include name="${schemaDir}/**/*" />
755       <include name="utils/**/*" />
756       <include name="${docDir}/**/*" />
757       <include name="examples/**/*" />
758     </fileset>
759   </copy>
760
761   <tstamp prefix="build">
762     <format property="year" pattern="yyyy" />
763   </tstamp>
764   <!-- each replacetoken CDATA body must be on one line - 
765        otherwise the pattern doesn't match -->
766   <replace value="${JALVIEW_VERSION}">
767     <replacetoken><![CDATA[$$Version-Rel$$]]></replacetoken>
768     <fileset dir="_sourcedist">
769       <include name="**/*" />
770     </fileset>
771   </replace>
772   <replace dir="_sourcedist" value="${build.year}">
773     <replacetoken><![CDATA[$$Year-Rel$$]]></replacetoken>
774     <fileset dir="_sourcedist">
775       <include name="**/*" />
776     </fileset>
777   </replace>
778
779   <tar destfile="${source.dist.name}" compression="gzip">
780     <tarfileset dir="_sourcedist/" prefix="jalview" preserveLeadingSlashes="true">
781     </tarfileset>
782   </tar>
783
784   <delete dir="_sourcedist" />
785 </target>
786 <target name="prepubapplet_1" depends="makeApplet">
787   <copy todir="${packageDir}/examples">
788     <fileset dir="examples">
789       <include name="**/*" />
790       <include name="javascript/*" />
791       <include name="jmol/*" />
792     </fileset>
793     <fileset dir=".">
794       <include name="${jalviewLiteJar}" />
795     </fileset>
796     <fileset dir="appletlib">
797       <include name="**/*" />
798     </fileset>
799   </copy>
800   <jar update="true" index="true" jarfile="${packageDir}/examples/${jalviewLiteJar}" />
801   <jar update="true" index="true" jarfile="${packageDir}/examples/${javaJson}" />
802   <jar update="true" index="true" jarfile="${packageDir}/examples/${jsonSimple}" />
803   <jar update="true" index="true" jarfile="${packageDir}/examples/${jmolJar}">
804     <manifest>
805       <attribute name="Application-Name" value="Jmol (bundled with JalviewLite)" />
806       <!--          <attribute name="Permissions" value="sandbox" /> -->
807       <!--<attribute name="Trusted-Lib" value="true" /> -->
808       <attribute name="Codebase" value="${applet.codebase}" />
809       <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}" />
810     </manifest>
811   </jar>
812
813   <presetdef name="ap_applet.jar">
814     <!-- build a signed applet with 'all-permissions' - 
815                           Needs 'param name="permissions' value="all-permissions"' in applet tag
816                           JalviewLite+JmolApplet linked sequence/structure fails
817                           Mixed code warnings are raised
818                           -->
819     <jar update="true" index="true">
820       <manifest>
821         <attribute name="Application-Name" value="JalviewLite" />
822         <attribute name="Permissions" value="all-permissions" />
823         <attribute name="Codebase" value="${applet.codebase}" />
824         <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}" />
825         <attribute name="Application-Library-Allowable-Codebase" value="${applet.codebase}" />
826       </manifest>
827     </jar>
828   </presetdef>
829   <presetdef name="applet.jar">
830     <!-- build signed applet with sandbox permissions -
831                           Needs 'param name="permissions' value="sandbox"' in applet tag
832                          Preserves Pre-Java 1.7_u45 behavior once 'permissions' parameter added to applet tag 
833                         -->
834
835     <jar update="true" index="true">
836       <manifest>
837         <attribute name="Application-Name" value="JalviewLite" />
838         <attribute name="Permissions" value="sandbox" />
839         <attribute name="Codebase" value="${applet.codebase}" />
840         <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}" />
841         <attribute name="Application-Library-Allowable-Codebase" value="${applet.codebase}" />
842       </manifest>
843     </jar>
844   </presetdef>
845   <presetdef name="tl_applet.jar">
846     <!-- build signed applet with trusted library/trusted permissions -
847                                 Needs 'param name="permissions' value="all-permissions"' in applet tag
848                                j1.7_45:
849                                No mixed code warnings raised 
850                                Jmol/JalviewLite sequence/structure example doesn't link structures
851                                Raises dialog asking user to allow page to control applet via LiveConnect javascript
852                                
853                               -->
854
855     <jar update="true" index="true">
856       <manifest>
857         <attribute name="Application-Name" value="JalviewLite" />
858         <attribute name="Permissions" value="all-permissions" />
859         <attribute name="Codebase" value="${applet.codebase}" />
860         <attribute name="Trusted-Only" value="true" />
861         <attribute name="Trusted-Library" value="true" />
862       </manifest>
863     </jar>
864   </presetdef>
865   <presetdef name="to_applet.jar">
866     <!-- not fully test variant (yet) -->
867     <jar update="true" index="true">
868       <manifest>
869         <attribute name="Application-Name" value="JalviewLite" />
870         <attribute name="Permissions" value="all-permissions" />
871         <attribute name="Codebase" value="${applet.codebase}" />
872         <attribute name="Trusted-Only" value="true" />
873       </manifest>
874     </jar>
875   </presetdef>
876   <!-- create differently privileged artefacts -->
877   <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/u_${jalviewLiteJar}" />
878   <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/u_${jmolJar}" overwrite="true" />
879   <copy file="${packageDir}/examples/${javaJson}" tofile="${packageDir}/examples/u_${javaJson}" overwrite="true" />
880   <copy file="${packageDir}/examples/${jsonSimple}" tofile="${packageDir}/examples/u_${jsonSimple}" overwrite="true" />
881   <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/ap_${jalviewLiteJar}" />
882   <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/ap_${jmolJar}" />
883   <copy file="${packageDir}/examples/${javaJson}" tofile="${packageDir}/examples/ap_${javaJson}" />
884   <copy file="${packageDir}/examples/${jsonSimple}" tofile="${packageDir}/examples/ap_${jsonSimple}" />
885   <ap_applet.jar jarfile="${packageDir}/examples/ap_${jalviewLiteJar}" />
886   <ap_applet.jar jarfile="${packageDir}/examples/ap_${jmolJar}" />
887   <ap_applet.jar jarfile="${packageDir}/examples/ap_${javaJson}" />
888   <ap_applet.jar jarfile="${packageDir}/examples/ap_${jsonSimple}" />
889   <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/tl_${jalviewLiteJar}" />
890   <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/tl_${jmolJar}" />
891   <copy file="${packageDir}/examples/${javaJson}" tofile="${packageDir}/examples/tl_${javaJson}" />
892   <copy file="${packageDir}/examples/${jsonSimple}" tofile="${packageDir}/examples/tl_${jsonSimple}" />
893   <tl_applet.jar jarfile="${packageDir}/examples/tl_${jalviewLiteJar}" />
894   <tl_applet.jar jarfile="${packageDir}/examples/tl_${jmolJar}" />
895   <tl_applet.jar jarfile="${packageDir}/examples/tl_${javaJson}" />
896   <tl_applet.jar jarfile="${packageDir}/examples/tl_${jsonSimple}" />
897   <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/to_${jalviewLiteJar}" />
898   <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/to_${jmolJar}" />
899   <copy file="${packageDir}/examples/${javaJson}" tofile="${packageDir}/examples/to_${javaJson}" />
900   <copy file="${packageDir}/examples/${jsonSimple}" tofile="${packageDir}/examples/to_${jsonSimple}" />
901   <to_applet.jar jarfile="${packageDir}/examples/to_${jalviewLiteJar}" />
902   <to_applet.jar jarfile="${packageDir}/examples/to_${jmolJar}" />
903   <to_applet.jar jarfile="${packageDir}/examples/to_${javaJson}" />
904   <to_applet.jar jarfile="${packageDir}/examples/to_${jsonSimple}" />
905   <!-- finally, create manifest for original jars -->
906   <applet.jar jarfile="${packageDir}/examples/${jalviewLiteJar}" />
907   <applet.jar jarfile="${packageDir}/examples/${jmolJar}" />
908   <applet.jar jarfile="${packageDir}/examples/${javaJson}" />
909   <applet.jar jarfile="${packageDir}/examples/${jsonSimple}" />
910
911   <!-- todo - write examples/downloads for alternate versions of the applet 
912     probably don't need to do this now since we don't have alternate versions anymore !-->
913 </target>
914 <target name="-signapplet" depends="prepubapplet_1">
915   <fileset id="signappletjarset" dir="${packageDir}/examples">
916     <exclude name="u_*.jar" />
917     <include name="${jalviewLiteJar}" />
918     <include name="${jmolJar}" />
919     <include name="${javaJson}" />
920     <include name="${jsonSimple}" />
921     <include name="to_${jalviewLiteJar}" />
922     <include name="to_${jmolJar}" />
923     <include name="to_${javaJson}" />
924     <include name="to_${jsonSimple}" />
925     <include name="tl_${jalviewLiteJar}" />
926     <include name="tl_${jmolJar}" />
927     <include name="tl_${javaJson}" />
928     <include name="tl_${jsonSimple}" />
929     <include name="ap_${jalviewLiteJar}" />
930     <include name="ap_${jmolJar}" />
931     <include name="ap_${javaJson}" />
932     <include name="ap_${jsonSimple}" />
933   </fileset>
934 </target>
935 <target name="-signappletnotsa" unless="timestamp" depends="-signapplet">
936   <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false">
937     <fileset refid="signappletjarset" />
938   </signjar>
939 </target>
940
941 <target name="-signapplettsa" if="timestamp" depends="-signapplet">
942   <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}">
943     <fileset refid="signappletjarset" />
944   </signjar>
945 </target>
946
947 <target name="signApplet" description="internal target to sign applet" depends="-signappletnotsa,-signapplettsa" />
948
949 <target name="pubapplet" description="installs the jalviewLite applet and dependent jars into an applet examples directory built under ${outputDir}" depends="makeApplet, signApplet">
950
951   <!-- bizarre bug causes JmolApplet to always get signed, even if excluded from above. so copy explicitly -->
952   <copy file="appletlib/${jmolJar}" tofile="${packageDir}/examples/u_${jmolJar}" overwrite="true" />
953   <copy file="appletlib/${jsonSimple}" tofile="${packageDir}/examples/u_${jsonSimple}" overwrite="true" />
954   <copy file="appletlib/${javaJson}" tofile="${packageDir}/examples/u_${javaJson}" overwrite="true" />
955   <!-- finally, replace any launchApp servlet tags with a version specification -->
956   <replace value="http://www.jalview.org/services/launchApp?version=${JALVIEW_VERSION}&quot;">
957     <replacetoken>
958       <![CDATA[http://www.jalview.org/services/launchApp"]]>
959     </replacetoken>
960     <fileset dir="${packageDir}/examples">
961       <include name="**/*.html" />
962     </fileset>
963   </replace>
964   <replace value="http://www.jalview.org/services/launchApp?version=${JALVIEW_VERSION}'">
965     <replacetoken>
966       <![CDATA[http://www.jalview.org/services/launchApp']]>
967     </replacetoken>
968     <fileset dir="${packageDir}/examples">
969       <include name="**/*.html" />
970     </fileset>
971   </replace>
972
973 </target>
974 <target name="sourcedoc" description="Create jalview source documentation pages" depends="init">
975   <javadoc destdir="${javadocDir}">
976     <packageset dir="${sourceDir}" includes="jalview/*,MCView/*">
977     </packageset>
978   </javadoc>
979 </target>
980 <target name="linkcheck" depends="init,prepare">
981   <javac srcdir="utils" destdir="utils" includes="HelpLinksChecker.java"/>
982   <java fork="true" dir="${helpDir}" classpath="utils" classname="HelpLinksChecker" failonerror="true">
983     <arg file="${helpDir}"/>
984     <arg value="-nointernet"/>
985   </java>
986 </target>
987 </project>