JAL-3130 Some re-reorganisation for build process
[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     <!-- Java 10 JVM args -->
110     <condition property="java10">
111       <equals arg1="${ant.java.version}" arg2="10"/>
112     </condition>
113     <!-- Java 11 JVM args -->
114     <condition property="java11">
115       <equals arg1="${ant.java.version}" arg2="11"/>
116     </condition>
117     <echo message="java version is ${ant.java.version}"/>
118
119     <!-- Don't change anything below here unless you know what you are doing! -->
120     <!-- Url path for WebStart in JNLP file -->
121     <property name="WebStartLocation" value="http://www.jalview.org/webstart" />
122     <!-- Webstart Image - looked for in resources/images -->
123     <property name="WebStartImage" value="JalviewLogo_big.png" />
124     <!-- J2SE version needed for webstart launch -->
125     <!-- Anne's version needs 1.7 - should rebuild VARNA to java 1.6 for release -->
126     <property name="j2sev" value="1.7+" />
127     <!-- Java Compilation settings - source and target javac version -->
128     <property name="javac.source" value="1.8" />
129     <property name="javac.target" value="1.8" />
130
131     <!-- Permissions for running Java applets and applications. -->
132     <!-- Defaults are those suitable for deploying jalview webstart www.jalview.org -->
133     <property name="application.codebase" value="*.jalview.org" />
134     <!-- and allowing the applet to be deployed from any URL -->
135     <!-- 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 -->
136     <property name="applet.codebase" value="*.jalview.org *.dundee.ac.uk *" />
137     <property name="applet.caller-codebase" value="${applet.codebase}" />
138
139     <!-- build directory configuration -->
140     <property name="libDir" value="lib" />
141     <property name="j11libDir" value="j11lib" />
142     <property name="resourceDir" value="resources" />
143     <property name="helpDir" value="help" />
144     <property name="docDir" value="doc" />
145     <property name="sourceDir" value="src" />
146     <property name="schemaDir" value="schemas" />
147     <property name="outputDir" value="classes" unless:set="clover.jar"/>
148     <property name="outputDir" value="cloverclasses" if:set="clover.jar"/>
149     <property name="packageDir" value="dist" />
150     <property name="outputJar" value="jalview.jar" />
151     <!-- Jalview Applet JMol Jar Dependency -->
152     <property name="jmolJar" value="JmolApplet-14.6.4_2016.10.26.jar" />
153     <property name="varnaJar" value="VARNAv3-93.jar" />
154     <property name="jsoup" value="jsoup-1.8.1.jar" />
155     <property name="jsonSimple" value="json_simple-1.1.jar" />
156     <property name="javaJson" value="java-json.jar" />
157     <property name="jalviewLiteJar" value="jalviewApplet.jar" />
158     <property name="reportDir" value="test-reports" />
159     <property name="testDir" value="test" />
160     <property name="testOutputDir" value="tests" />
161     <!-- switch to indicate if we should obfuscate jalviewLite -->
162     <!-- <property name="donotobfuscate" value="true"/> -->
163     <!-- switch to exclude associations from generated jnlp files -->
164     <!-- <property name="nojnlpfileassocs" value="true"/> -->
165
166     <!-- Jalview Web Service Clients - see the comments in 'buildextclients' for details -->
167     <property name="wsdl.File" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred?wsdl" />
168     <property name="wsdl.Files" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/vamsas?wsdlFiles" />
169     <property name="wsdl.MsaWS" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/MuscleWS?wsdl" />
170     <property name="wsdl.MsaWS2" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/ClustalWS?wsdl" />
171     <property name="WSInterf" value="MsaWS" />
172     <property name="wsdl.Namespace" value="vamsas" />
173     <property name="wsdl.ClientNS" value="ext.vamsas" />
174     <!-- the class path for building the application -->
175     <path id="build.classpath">
176       <fileset dir="utils">
177         <include name="*.jar" />
178         <include name="**/*.jar" />
179       </fileset>
180       <fileset dir="${j11libDir}">
181         <include name="*.jar" />
182         <include name="**/*.jar" />
183       </fileset>
184       <fileset dir="${libDir}">
185         <include name="*.jar" />
186         <include name="**/*.jar" />
187       </fileset>
188       <fileset dir="${java.home}/lib">
189         <include name="plugin.jar" />
190       </fileset>
191       <fileset dir="appletlib">
192         <!-- the JmolApplet includes the JmolApplet console and the application javac seems to always try and build all packages 
193                                 -->
194         <include name="${jmolJar}" />
195         <include name="${varnaJar}" />
196       </fileset>
197     </path>
198     <path id="test.classpath">
199       <pathelement path="${outputDir}" />
200       <path refid="build.classpath" />
201     </path>
202     <property name="source.dist.name" value="${basedir}/jalview-src.tar.gz" />
203     <!-- The Location of the java 1.1.8 jdk -->
204     <property name="java118.home" value="${java.home}" />
205     <!-- jre for 1.4 version -->
206     <property name="applet.jre.tools" value="${java118.home}/lib/rt.jar" />
207
208     <!-- the classpath for building the 1.1 applet -->
209     <path id="jalviewlite.deps">
210       <fileset dir="${java118.home}">
211         <include name="lib/rt.jar" />
212       </fileset>
213       <fileset dir="${java.home}/lib">
214         <include name="plugin.jar" />
215       </fileset>
216       <pathelement location="appletlib/${jmolJar}" />
217       <pathelement location="lib/${varnaJar}" />
218       <pathelement location="appletlib/${jsoup}" />
219       <pathelement location="appletlib/${jsonSimple}" />
220       <pathelement location="appletlib/${javaJson}" />
221
222     </path>
223     <!-- default location for outputting javadoc -->
224     <property name="javadocDir" value="${packageDir}/javadoc" />
225   </target>
226
227
228   <taskdef classpath="utils/roxes-ant-tasks-1.2-2004-01-30.jar" resource="com/roxes/tools/ant/taskdefs.properties" />
229   <target name="buildPropertiesFile" depends="init">
230     <tstamp prefix="build">
231       <format property="date" pattern="dd MMMM yyyy" />
232     </tstamp>
233     <exec executable="/usr/bin/git" outputproperty="git.commit" failifexecutionfails="false">
234       <arg value="rev-parse" />
235       <arg value="--short" />
236       <arg value="HEAD" />
237     </exec>
238     <exec executable="/usr/bin/git" outputproperty="git.branch" failifexecutionfails="false">
239       <arg value="rev-parse" />
240       <arg value="--abbrev-ref" />
241       <arg value="HEAD" />
242     </exec>
243     <properties file="${outputDir}/.build_properties">
244       <header>
245           ---Jalview Build Details---
246         </header>
247       <property name="VERSION" value="${JALVIEW_VERSION}" />
248       <property name="INSTALLATION" value="${INSTALLATION} git-commit:${git.commit} [${git.branch}]" />
249       <property name="BUILD_DATE" value="${build.date}" />
250     </properties>
251   </target>
252
253
254   <target name="clean" depends="init">
255     <!-- not efficient yet. -->
256     <delete dir="${outputDir}" includes="*,**/*" />
257   </target>
258
259   <target name="distclean" depends="init, clean">
260
261     <echo message="REMOVING ALL BACKUP/AUTOSAVES!" />
262     <delete>
263       <fileset dir=".">
264         <include name="${outputJar}" />
265         <include name="#*#" />
266         <include name="#*.*#" />
267         <include name="**/#*#" />
268         <include name="**/#*.*#" />
269         <include name="*~" />
270         <include name="*.*~" />
271         <include name="**/*~" />
272         <include name="**/*.*~" />
273       </fileset>
274     </delete>
275   </target>
276
277   <target name="prepare" depends="init">
278     <mkdir dir="${outputDir}" />
279     <copy todir="${outputDir}">
280       <fileset dir=".">
281         <include name="${docDir}/**/*.*" />
282         <include name="${helpDir}/**/*.*" />
283         <include name="${libDir}/*.jar" />
284       </fileset>
285       <fileset dir="${resourceDir}">
286         <include name="**/*.*" />
287       </fileset>
288     </copy>
289   </target>
290
291   <target name="build" depends="prepare">
292     <!-- not efficient yet. -->
293     <javac source="${javac.source}" target="${javac.target}" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}" classpathref="build.classpath">
294       <exclude name="jalview/*applet*" />
295       <exclude name="jalview/appletgui/**" />
296       <exclude name="com/stevesoft/**" />
297     </javac>
298   </target>
299
300
301   <target name="testclean" depends="init">
302     <delete dir="${testOutputDir}" includes="*,**/*" />
303   </target>
304
305   <target name="prepareTests" depends="init,testclean">
306     <mkdir dir="${testOutputDir}" />
307   </target>
308
309   <target name="buildTests" depends="build,buildindices,prepareTests">
310     <javac source="${javac.source}" target="${javac.target}" srcdir="${testDir}" destdir="${testOutputDir}" debug="${javac.debug}" classpathref="test.classpath" includeantruntime="false">
311     </javac>
312   </target>
313
314   <taskdef resource="testngtasks" classpath="utils/testnglibs/testng.jar" />
315
316   <target name="testng" depends="buildTests">
317     <testng outputDir="${reportDir}" haltOnFailure="false" groups="${testng-groups}" mode="testng"
318       verbose="2">
319       <classpath>
320         <pathelement location="${testOutputDir}" />
321         <pathelement location="${clover.jar}" if:set="clover.jar"/>
322         <path refid="test.classpath" />
323       </classpath>
324       <jvmarg value="--module-path=${j11libDir}" if:set="java11"/>
325       <jvmarg value="--add-modules=java.se.ee" if:set="java9"/>
326       <jvmarg value="--illegal-access=warn" if:set="java9"/>
327       <classfileset dir="${testOutputDir}" includes="**/*.class" />
328     </testng>
329   </target>
330
331   <target name="buildindices" depends="init, prepare" unless="help.uptodate">
332     <replace value="${JALVIEW_VERSION}">
333       <replacetoken><![CDATA[$$Version-Rel$$]]></replacetoken>
334       <fileset dir="${outputDir}/${helpDir}">
335         <include name="help.jhm" />
336       </fileset>
337     </replace>
338
339     <java classname="com.sun.java.help.search.Indexer" classpathref="build.classpath" fork="true" dir="${outputDir}/${helpDir}">
340       <arg line="html" />
341     </java>
342   </target>
343
344   <target name="preparejnlp" depends="makedist">
345     <copy todir="${packageDir}">
346       <fileset dir="${resourceDir}/images">
347         <include name="${WebStartImage}" />
348       </fileset>
349     </copy>
350
351     <taskdef classpathref="build.classpath" resource="com/roxes/tools/ant/taskdefs.properties" />
352
353     <!-- create a dummy jar which will eventually contain the jnlp template -->
354     <jar destfile="${packageDir}/jalview_jnlp_vm.jar" index="true">
355       <fileset dir="${packageDir}">
356         <include name="jalview.jar" />
357       </fileset>
358     </jar>
359
360     <mkdir dir="${packageDir}/JNLP-INF" />
361     <antcall target="writejnlpf">
362       <param name="jnlpFile" value="${packageDir}/JNLP-INF/APPLICATION-TEMPLATE.JNLP" />
363       <param name="inih" value="*" />
364       <param name="maxh" value="*" />
365     </antcall>
366
367     <jar destfile="${packageDir}/jalview_jnlp_vm.jar" index="true">
368       <fileset dir="${packageDir}">
369         <include name="JNLP-INF/APPLICATION-TEMPLATE.JNLP" />
370       </fileset>
371     </jar>
372
373     <antcall target="writejnlpf">
374       <param name="jnlpFile" value="${packageDir}/jalview_256M.jnlp" />
375       <param name="inih" value="10M" />
376       <param name="maxh" value="256M" />
377     </antcall>
378     <antcall target="writejnlpf">
379       <param name="jnlpFile" value="${packageDir}/jalview.jnlp" />
380       <param name="inih" value="800M" />
381       <param name="maxh" value="1024M" />
382     </antcall>
383
384     <antcall target="writejnlpf">
385       <param name="jnlpFile" value="${packageDir}/jalview_1G.jnlp" />
386       <param name="inih" value="128M" />
387       <param name="maxh" value="512M" />
388     </antcall>
389
390     <antcall target="writejnlpf">
391       <param name="jnlpFile" value="${packageDir}/jalview_2G.jnlp" />
392       <param name="inih" value="800M" />
393       <param name="maxh" value="1024M" />
394     </antcall>
395
396     <!-- finally, need to postprocess to add in associations at end of 'information' element 
397                         
398                         <xslt in="${packageDir}/jalview_noa_1G.jnlp" out="${packageDir}/jalview_1G.jnlp">
399                 
400                 </xslt>
401                         
402                         
403                         -->
404     <!--
405                                 <association mime-type="application-x/ext-file" extensions="fa"/>
406         <association mime-type="application-x/ext-file" extensions="fasta"/>
407         <association mime-type="application-x/ext-file" extensions="mfa"/>
408         <association mime-type="application-x/ext-file" extensions="fastq"/>
409         <association mime-type="application-x/ext-file" extensions="blc"/>
410         <association mime-type="application-x/ext-file" extensions="msf"/>
411         <association mime-type="application-x/ext-file" extensions="pfam"/>
412         <association mime-type="application-x/ext-file" extensions="aln"/>
413         <association mime-type="application-x/ext-file" extensions="pir"/>
414         <association mime-type="application-x/ext-file" extensions="amsa"/>
415         <association mime-type="application-x/ext-file" extensions="stk"/>
416         <association mime-type="application-x/ext-file" extensions="jar"/>-->
417   </target>
418
419   <target name="-jarsignwithtsa" depends="makedist,preparejnlp" if="timestamp" unless="nosign">
420     <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}"
421       tsaproxyhost="${proxyHost}" tsaproxyport="${proxyPort}" tsaurl="${jalview.tsaurl}">
422       <fileset dir="${packageDir}">
423         <include name="*.jar" />
424       </fileset>
425     </signjar>
426   </target>
427   <target name="-jarsignnotsa" depends="makedist,preparejnlp" if:blank="timestamp" unless="nosign">
428     <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}">
429       <fileset dir="${packageDir}">
430         <include name="*.jar" />
431       </fileset>
432     </signjar>
433   </target>
434
435   <target name="makefulldist" depends="makedist,preparejnlp,-jarsignwithtsa,-jarsignnotsa">
436     <!-- and sign the jars -->
437     <!-- the default keystore details might need to be edited here -->
438   </target>
439
440   <target name="runenv" depends="init">
441     <path id="run.classpath">
442       <pathelement location="${outputDir}" />
443       <fileset dir="${outputDir}">
444         <include name="${libDir}/*.jar" />
445       </fileset>
446     </path>
447     <pathconvert targetos="unix" refid="run.classpath" property="run.classpath" />
448
449     <echo>java -classpath ${run.classpath} jalview.bin.Jalview
450       </echo>
451   </target>
452
453   <target name="-generatejnlpf">
454     <presetdef name="jnlpf">
455       <jnlp codebase="${WebStartLocation}">
456         <information>
457           <title>Jalview</title>
458           <vendor>The Barton Group</vendor>
459           <homepage href="http://www.jalview.org" />
460           <description>Jalview Multiple Alignment Editor</description>
461           <description kind="short">Jalview</description>
462           <icon href="${WebStartImage}" />
463           <offline_allowed />
464         </information>
465         <resources>
466           <j2se version="1.8+" />
467           <jar main="true" href="jalview.jar"/>
468           <fileset dir="${packageDir}">
469             <exclude name="jalview.jar" />
470             <include name="*.jar" />
471             <include name="*_*.jar" />
472             <exclude name="*quaqua*.jar" />
473           </fileset>
474           <property name="jalview.version" value="${JALVIEW_VERSION}" />
475         </resources>
476         <resources os="Mac OS X">
477           <fileset dir="${packageDir}">
478                  <include name="quaqua-filechooser-only-8.0.jar"/>
479             <include name="*quaqua64*.jnilib.jar" />
480           </fileset>
481         </resources>
482
483         <application_desc main_class="jalview.bin.Jalview">
484         </application_desc>
485         <security>
486           <all_permissions />
487         </security>
488       </jnlp>
489     </presetdef>
490
491     <jnlpf toFile="${jnlpFile}" />
492     <!-- add the add-modules j2se attribute for java 9 -->
493     <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;">
494           <replacetoken>j2se version="1.8+"</replacetoken>
495     </replace>
496   </target>
497
498   <target name="-dofakejnlpfileassoc" depends="-generatejnlpf" if="nojnlpfileassocs">
499     <echo message="Not adding JNLP File Associations" />
500   </target>
501
502   <target name="-dojnlpfileassoc" depends="-generatejnlpf" unless="nojnlpfileassocs">
503     <replace file="${jnlpFile}">
504       <replacetoken>
505         <![CDATA[</information>]]></replacetoken>
506       <replacevalue>
507         <![CDATA[
508           <association mime-type="application-x/ext-file" extensions="fa" />
509         <association mime-type="application-x/ext-file" extensions="fasta" />
510         <association mime-type="application-x/ext-file" extensions="mfa" />
511         <association mime-type="application-x/ext-file" extensions="fastq" />
512         <association mime-type="application-x/ext-file" extensions="blc" />
513         <association mime-type="application-x/ext-file" extensions="msf" />
514         <association mime-type="application-x/ext-file" extensions="pfam" />
515         <association mime-type="application-x/ext-file" extensions="aln"/>
516         <association mime-type="application-x/ext-file" extensions="pir"/>
517         <association mime-type="application-x/ext-file" extensions="amsa"/>
518         <association mime-type="application-x/ext-file" extensions="stk"/>
519         <association mime-type="application-x/ext-file" extensions="jvp"/>
520       </information>]]></replacevalue>
521   </replace>
522   <echo message="Added file associations to JNLP file" />
523 </target>
524 <target name="writejnlpf" depends="-dojnlpfileassoc,-dofakejnlpfileassoc">
525 </target>
526
527 <target name="buildextclients" depends="init">
528   <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" />
529   <condition property="dontextbuild">
530     <equals arg1="n" arg2="${doextbuild.response}" />
531   </condition>
532   <condition property="dontextbuild">
533     <equals arg1="N" arg2="${doextbuild.response}" />
534   </condition>
535   <fail if="dontextbuild">
536         Build External Client Code process aborted by user. Jalview source is unchanged.
537       </fail>
538   <!-- Currently, this doesn't happen automatically.
539      1. Run WSDL2Java as below, which generates an ext.vamsas +
540      vamsas.<datapackages> fileset.
541      2. refactor ext.vamsas.SpecificserviceWS* to
542      ext.vamsas.ServiceclassWS* that implements the ServiceclassWSI interface.
543      3. Update the jalview.ws.*WServices classes to reflect the
544      interface type, and all locations of this wsdl type that Jalview
545      might be using.
546
547 -->
548   <path id="axisbuild">
549     <path refid="build.classpath" />
550   </path>
551   <taskdef resource="axis-tasks.properties" classpathref="axisbuild" />
552   <move todir="./bak">
553     <fileset dir="${sourceDir}" id="client">
554       <include name="${wsdl.ClientNS}/*.*" />
555     </fileset>
556   </move>
557
558   <axis-wsdl2java output="${sourceDir}" verbose="true" url="${wsdl.MsaWS2}" serverside="false" deployscope="Request" debug="false" helpergen="true" all="true">
559     <mappingSet>
560       <mapping namespace="${wsdl.Namespace}" package="${wsdl.ClientNS}" />
561       <mapping namespace="http://dataTypes.vamsas" package="${wsdl.ClientNS}" />
562     </mappingSet>
563   </axis-wsdl2java>
564 </target>
565
566 <target name="makedist" depends="build, buildPropertiesFile, linkcheck, buildindices">
567   <fail if="clover.jar">
568     Ignoring request to build jalview distribution with clover-instrumented classes
569   </fail>
570   <!-- make the package jar if not already existing -->
571   <mkdir dir="${packageDir}" />
572   <!-- clean dir if it already existed -->
573   <delete>
574     <fileset dir="${packageDir}">
575       <include name="*.jar" />
576     </fileset>
577   </delete>
578   <jar destfile="${packageDir}/${outputJar}" index="true">
579     <manifest>
580       <attribute name="Main-Class" value="jalview.bin.Jalview" />
581       <attribute name="Permissions" value="all-permissions" />
582       <attribute name="Application-Name" value="Jalview Desktop" />
583       <attribute name="Codebase" value="${application.codebase}" />
584     </manifest>
585     <fileset dir="${outputDir}/">
586       <exclude name="cache*/**" />
587       <exclude name="*.jar" />
588       <exclude name="*.jar.*" />
589       <exclude name="**/*.jar" />
590       <exclude name="**/*.jar.*" />
591     </fileset>
592   </jar>
593
594   <copy toDir="${packageDir}" flatten="true">
595     <fileset dir="${outputDir}">
596       <include name="*.jar" />
597       <include name="**/*.jar" />
598     </fileset>
599   </copy>
600 </target>
601
602
603 <!-- jalopy code reformatter -->
604 <target name="sourcescrub" depends="init,build">
605   <jalopy destdir="jsrc" classpathref="run.classpath" convention="jalview-jalopy.xml">
606     <fileset dir="${sourceDir}">
607       <include name="*.java" />
608       <include name="**/*.java" />
609       <include name="**/**/*.java" />
610     </fileset>
611   </jalopy>
612 </target>
613
614
615
616 <!-- Compile, package and obfuscate Jalview Applet -->
617 <target name="makeApplet" depends="obfuscate" description="assemble the final jalviewLite applet jar with or without obfuscation" />
618
619 <target name="compileApplet" depends="init,clean">
620   <mkdir dir="${outputDir}" />
621   <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/**" />
622 </target>
623
624 <target name="packageApplet" depends="compileApplet, buildPropertiesFile">
625   <copy file="${resourceDir}/images/link.gif" toFile="${outputDir}/images/link.gif" />
626   <copy todir="${outputDir}/lang">
627     <fileset dir="${resourceDir}/lang">
628       <include name="**.*" />
629     </fileset>
630   </copy>
631   <jar destfile="in.jar" index="true">
632     <manifest>
633       <attribute name="Main-Class" value="jalview.bin.JalviewLite" />
634       <attribute name="Application-Name" value="JalviewLite" />
635       <attribute name="Codebase" value="${applet.codebase}" />
636     </manifest>
637     <fileset dir="${outputDir}">
638       <include name="com/**" />
639       <include name="MCview/**" />
640       <include name="jalview/**" />
641       <include name=".build_properties" />
642       <include name="images/link.gif" />
643       <include name="lang/**" />
644     </fileset>
645   </jar>
646 </target>
647 <target name="obfuscate" depends="-obfuscatefake,-obfuscatereally">
648 </target>
649 <target name="-obfuscatefake" depends="packageApplet" if="donotobfuscate">
650   <copy file="in.jar" tofile="${jalviewLiteJar}" overwrite="true" />
651   <delete file="in.jar" />
652 </target>
653 <target name="-obfuscatereally" unless="donotobfuscate">
654
655   <path id="obfuscateDeps.path">
656     <pathelement location="${applet.jre.tools}" />
657     <pathelement location="appletlib/${jmolJar}" />
658     <pathelement location="lib/${varnaJar}" />
659     <pathelement location="appletlib/${jsoup}" />
660     <pathelement location="appletlib/${jsonSimple}" />
661     <pathelement location="appletlib/${javaJson}" />
662     <fileset dir="${java.home}/lib">
663       <include name="plugin.jar" />
664     </fileset>
665   </path>
666   <taskdef resource="proguard/ant/task.properties" classpath="utils/proguard_5.3.3.jar" />
667
668   <proguard verbose="true" >
669     <injar file="in.jar" />
670     <outjar file="${jalviewLiteJar}" />
671     <libraryjar refid="obfuscateDeps.path" />
672     <dontwarn />
673     <keep access="public" type="class" name="jalview.bin.JalviewLite">
674       <field access="public" />
675       <method access="public" />
676       <constructor access="public" />
677     </keep>
678     <keep access="public" type="class" name="jalview.appletgui.AlignFrame">
679       <field access="public" />
680       <method access="public" />
681       <constructor access="public" />
682     </keep>
683
684     <keep name="jalview.json.binding**">
685       <constructor/>
686       <method name="*"/>
687     </keep>
688
689     <keep access="public" type="class" name="MCview.PDBfile">
690       <field access="public" />
691       <method access="public" />
692       <constructor access="public" />
693     </keep>
694
695     <keep access="public" type="class" name="jalview.ws.jws1.Annotate3D">
696       <field access="public" />
697       <method access="public" />
698       <constructor access="public" />
699     </keep>
700
701     <keep access="public" type="class" name="jalview.ext.jmol.JmolParser">
702       <field access="public" />
703       <method access="public" />
704       <constructor access="public" />
705     </keep>
706
707
708     <!--      -libraryjars "${obfuscateDeps}"
709       -injars      in.jar
710       -outjars     jalviewApplet.jar
711       -keep public class jalview.bin.JalviewLite
712        { public * ; } -->
713   </proguard>
714   <delete file="in.jar" />
715 </target>
716
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" if:blank="timestamp" depends="-signapplet" unless="nosign">
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" unless="nosign">
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>