3 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
4 * Copyright (C) $$Year-Rel$$ The Jalview Authors
6 * This file is part of Jalview.
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.
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.
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.
20 <project name="jalviewX" default="usage" basedir="."
22 xmlns:unless="ant:unless">
23 <taskdef classpath="${clover.jar}" resource="cloverlib.xml" if:set="clover.jar"/>
24 <clover-env if:set="clover.jar"/>
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" />
50 <!-- utils is a class path to additional utilities needed for
51 building docs, jars and webstart stuff -->
53 Userdefined build property defaults
55 wsdl.server list (plus namespace mapping info ???) - also want
56 ... to make this a dynamically generatable property
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).
66 <path id="axis.classpath">
68 <fileset dir="/usr/local/axis/lib">
69 <include name="**/*.jar" />
71 <fileset dir="/usr/local/jakarta-tomcat-5/webapps/axis/WEB-INF/lib">
72 <include name="**/*.jar"/>
73 <include name="*.jar"/>
77 <!-- Jalview Version String displayed by application on startup and used to check for updates -->
78 <property name="JALVIEW_VERSION" value="DEVELOPMENT" />
80 <property name="INSTALLATION" value="Source" />
82 <!-- 2.4 (VAMSAS)" -->
83 <!-- Include debugging information in javac true or false -->
84 <property name="javac.debug" value="true" />
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" />
91 <property name="jalview.key" value="jalview" />
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"/>
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"/>
109 <!-- Java 10 JVM args -->
110 <condition property="java10">
111 <equals arg1="${ant.java.version}" arg2="10"/>
113 <!-- Java 11 JVM args -->
114 <condition property="java11">
115 <equals arg1="${ant.java.version}" arg2="11"/>
117 <echo message="java version is ${ant.java.version}"/>
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" />
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}" />
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"/> -->
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" />
180 <fileset dir="${j11libDir}">
181 <include name="*.jar" />
182 <include name="**/*.jar" />
184 <fileset dir="${libDir}">
185 <include name="*.jar" />
186 <include name="**/*.jar" />
188 <fileset dir="${java.home}/lib">
189 <include name="plugin.jar" />
191 <fileset dir="appletlib">
192 <!-- the JmolApplet includes the JmolApplet console and the application javac seems to always try and build all packages
194 <include name="${jmolJar}" />
195 <include name="${varnaJar}" />
198 <path id="test.classpath">
199 <pathelement path="${outputDir}" />
200 <path refid="build.classpath" />
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" />
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" />
213 <fileset dir="${java.home}/lib">
214 <include name="plugin.jar" />
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}" />
223 <!-- default location for outputting javadoc -->
224 <property name="javadocDir" value="${packageDir}/javadoc" />
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" />
233 <exec executable="/usr/bin/git" outputproperty="git.commit" failifexecutionfails="false">
234 <arg value="rev-parse" />
235 <arg value="--short" />
238 <exec executable="/usr/bin/git" outputproperty="git.branch" failifexecutionfails="false">
239 <arg value="rev-parse" />
240 <arg value="--abbrev-ref" />
243 <properties file="${outputDir}/.build_properties">
245 ---Jalview Build Details---
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}" />
254 <target name="clean" depends="init">
255 <!-- not efficient yet. -->
256 <delete dir="${outputDir}" includes="*,**/*" />
259 <target name="distclean" depends="init, clean">
261 <echo message="REMOVING ALL BACKUP/AUTOSAVES!" />
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="**/*.*~" />
277 <target name="prepare" depends="init">
278 <mkdir dir="${outputDir}" />
279 <copy todir="${outputDir}">
281 <include name="${docDir}/**/*.*" />
282 <include name="${helpDir}/**/*.*" />
283 <include name="${libDir}/*.jar" />
285 <fileset dir="${resourceDir}">
286 <include name="**/*.*" />
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/**" />
301 <target name="testclean" depends="init">
302 <delete dir="${testOutputDir}" includes="*,**/*" />
305 <target name="prepareTests" depends="init,testclean">
306 <mkdir dir="${testOutputDir}" />
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">
314 <taskdef resource="testngtasks" classpath="utils/testnglibs/testng.jar" />
316 <target name="testng" depends="buildTests">
317 <testng outputDir="${reportDir}" haltOnFailure="false" groups="${testng-groups}" mode="testng"
320 <pathelement location="${testOutputDir}" />
321 <pathelement location="${clover.jar}" if:set="clover.jar"/>
322 <path refid="test.classpath" />
324 <jvmarg value="--add-modules=java.se.ee" if:set="java9"/>
325 <jvmarg value="--illegal-access=warn" if:set="java9"/>
326 <classfileset dir="${testOutputDir}" includes="**/*.class" />
330 <target name="buildindices" depends="init, prepare" unless="help.uptodate">
331 <replace value="${JALVIEW_VERSION}">
332 <replacetoken><![CDATA[$$Version-Rel$$]]></replacetoken>
333 <fileset dir="${outputDir}/${helpDir}">
334 <include name="help.jhm" />
338 <java classname="com.sun.java.help.search.Indexer" classpathref="build.classpath" fork="true" dir="${outputDir}/${helpDir}">
343 <target name="preparejnlp" depends="makedist">
344 <copy todir="${packageDir}">
345 <fileset dir="${resourceDir}/images">
346 <include name="${WebStartImage}" />
350 <taskdef classpathref="build.classpath" resource="com/roxes/tools/ant/taskdefs.properties" />
352 <!-- create a dummy jar which will eventually contain the jnlp template -->
353 <jar destfile="${packageDir}/jalview_jnlp_vm.jar" index="true">
354 <fileset dir="${packageDir}">
355 <include name="jalview.jar" />
359 <mkdir dir="${packageDir}/JNLP-INF" />
360 <antcall target="writejnlpf">
361 <param name="jnlpFile" value="${packageDir}/JNLP-INF/APPLICATION-TEMPLATE.JNLP" />
362 <param name="inih" value="*" />
363 <param name="maxh" value="*" />
366 <jar destfile="${packageDir}/jalview_jnlp_vm.jar" index="true">
367 <fileset dir="${packageDir}">
368 <include name="JNLP-INF/APPLICATION-TEMPLATE.JNLP" />
372 <antcall target="writejnlpf">
373 <param name="jnlpFile" value="${packageDir}/jalview_256M.jnlp" />
374 <param name="inih" value="10M" />
375 <param name="maxh" value="256M" />
377 <antcall target="writejnlpf">
378 <param name="jnlpFile" value="${packageDir}/jalview.jnlp" />
379 <param name="inih" value="800M" />
380 <param name="maxh" value="1024M" />
383 <antcall target="writejnlpf">
384 <param name="jnlpFile" value="${packageDir}/jalview_1G.jnlp" />
385 <param name="inih" value="128M" />
386 <param name="maxh" value="512M" />
389 <antcall target="writejnlpf">
390 <param name="jnlpFile" value="${packageDir}/jalview_2G.jnlp" />
391 <param name="inih" value="800M" />
392 <param name="maxh" value="1024M" />
395 <!-- finally, need to postprocess to add in associations at end of 'information' element
397 <xslt in="${packageDir}/jalview_noa_1G.jnlp" out="${packageDir}/jalview_1G.jnlp">
404 <association mime-type="application-x/ext-file" extensions="fa"/>
405 <association mime-type="application-x/ext-file" extensions="fasta"/>
406 <association mime-type="application-x/ext-file" extensions="mfa"/>
407 <association mime-type="application-x/ext-file" extensions="fastq"/>
408 <association mime-type="application-x/ext-file" extensions="blc"/>
409 <association mime-type="application-x/ext-file" extensions="msf"/>
410 <association mime-type="application-x/ext-file" extensions="pfam"/>
411 <association mime-type="application-x/ext-file" extensions="aln"/>
412 <association mime-type="application-x/ext-file" extensions="pir"/>
413 <association mime-type="application-x/ext-file" extensions="amsa"/>
414 <association mime-type="application-x/ext-file" extensions="stk"/>
415 <association mime-type="application-x/ext-file" extensions="jar"/>-->
418 <target name="-jarsignwithtsa" depends="makedist,preparejnlp" if="timestamp" unless="nosign">
419 <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}"
420 tsaproxyhost="${proxyHost}" tsaproxyport="${proxyPort}" tsaurl="${jalview.tsaurl}">
421 <fileset dir="${packageDir}">
422 <include name="*.jar" />
426 <target name="-jarsignnotsa" depends="makedist,preparejnlp" if:blank="timestamp" unless="nosign">
427 <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}">
428 <fileset dir="${packageDir}">
429 <include name="*.jar" />
434 <target name="makefulldist" depends="makedist,preparejnlp,-jarsignwithtsa,-jarsignnotsa">
435 <!-- and sign the jars -->
436 <!-- the default keystore details might need to be edited here -->
439 <target name="runenv" depends="init">
440 <path id="run.classpath">
441 <pathelement location="${outputDir}" />
442 <fileset dir="${outputDir}">
443 <include name="${libDir}/*.jar" />
446 <pathconvert targetos="unix" refid="run.classpath" property="run.classpath" />
448 <echo>java -classpath ${run.classpath} jalview.bin.Jalview
452 <target name="-generatejnlpf">
453 <presetdef name="jnlpf">
454 <jnlp codebase="${WebStartLocation}">
456 <title>Jalview</title>
457 <vendor>The Barton Group</vendor>
458 <homepage href="http://www.jalview.org" />
459 <description>Jalview Multiple Alignment Editor</description>
460 <description kind="short">Jalview</description>
461 <icon href="${WebStartImage}" />
465 <j2se version="1.8+" />
466 <jar main="true" href="jalview.jar"/>
467 <fileset dir="${packageDir}">
468 <exclude name="jalview.jar" />
469 <include name="*.jar" />
470 <include name="*_*.jar" />
471 <exclude name="*quaqua*.jar" />
473 <property name="jalview.version" value="${JALVIEW_VERSION}" />
475 <resources os="Mac OS X">
476 <fileset dir="${packageDir}">
477 <include name="quaqua-filechooser-only-8.0.jar"/>
478 <include name="*quaqua64*.jnilib.jar" />
482 <application_desc main_class="jalview.bin.Jalview">
490 <jnlpf toFile="${jnlpFile}" />
491 <!-- add the add-modules j2se attribute for java 9 -->
492 <replace file="${jnlpFile}" value="j2se version="1.8+" initial-heap-size="${inih}" max-heap-size="${maxh}" java-vm-args="--add-modules=java.se.ee --illegal-access=warn"">
493 <replacetoken>j2se version="1.8+"</replacetoken>
497 <target name="-dofakejnlpfileassoc" depends="-generatejnlpf" if="nojnlpfileassocs">
498 <echo message="Not adding JNLP File Associations" />
501 <target name="-dojnlpfileassoc" depends="-generatejnlpf" unless="nojnlpfileassocs">
502 <replace file="${jnlpFile}">
504 <![CDATA[</information>]]></replacetoken>
507 <association mime-type="application-x/ext-file" extensions="fa" />
508 <association mime-type="application-x/ext-file" extensions="fasta" />
509 <association mime-type="application-x/ext-file" extensions="mfa" />
510 <association mime-type="application-x/ext-file" extensions="fastq" />
511 <association mime-type="application-x/ext-file" extensions="blc" />
512 <association mime-type="application-x/ext-file" extensions="msf" />
513 <association mime-type="application-x/ext-file" extensions="pfam" />
514 <association mime-type="application-x/ext-file" extensions="aln"/>
515 <association mime-type="application-x/ext-file" extensions="pir"/>
516 <association mime-type="application-x/ext-file" extensions="amsa"/>
517 <association mime-type="application-x/ext-file" extensions="stk"/>
518 <association mime-type="application-x/ext-file" extensions="jvp"/>
519 </information>]]></replacevalue>
521 <echo message="Added file associations to JNLP file" />
523 <target name="writejnlpf" depends="-dojnlpfileassoc,-dofakejnlpfileassoc">
526 <target name="buildextclients" depends="init">
527 <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" />
528 <condition property="dontextbuild">
529 <equals arg1="n" arg2="${doextbuild.response}" />
531 <condition property="dontextbuild">
532 <equals arg1="N" arg2="${doextbuild.response}" />
534 <fail if="dontextbuild">
535 Build External Client Code process aborted by user. Jalview source is unchanged.
537 <!-- Currently, this doesn't happen automatically.
538 1. Run WSDL2Java as below, which generates an ext.vamsas +
539 vamsas.<datapackages> fileset.
540 2. refactor ext.vamsas.SpecificserviceWS* to
541 ext.vamsas.ServiceclassWS* that implements the ServiceclassWSI interface.
542 3. Update the jalview.ws.*WServices classes to reflect the
543 interface type, and all locations of this wsdl type that Jalview
547 <path id="axisbuild">
548 <path refid="build.classpath" />
550 <taskdef resource="axis-tasks.properties" classpathref="axisbuild" />
552 <fileset dir="${sourceDir}" id="client">
553 <include name="${wsdl.ClientNS}/*.*" />
557 <axis-wsdl2java output="${sourceDir}" verbose="true" url="${wsdl.MsaWS2}" serverside="false" deployscope="Request" debug="false" helpergen="true" all="true">
559 <mapping namespace="${wsdl.Namespace}" package="${wsdl.ClientNS}" />
560 <mapping namespace="http://dataTypes.vamsas" package="${wsdl.ClientNS}" />
565 <target name="makedist" depends="build, buildPropertiesFile, linkcheck, buildindices">
566 <fail if="clover.jar">
567 Ignoring request to build jalview distribution with clover-instrumented classes
569 <!-- make the package jar if not already existing -->
570 <mkdir dir="${packageDir}" />
571 <!-- clean dir if it already existed -->
573 <fileset dir="${packageDir}">
574 <include name="*.jar" />
577 <jar destfile="${packageDir}/${outputJar}" index="true">
579 <attribute name="Main-Class" value="jalview.bin.Jalview" />
580 <attribute name="Permissions" value="all-permissions" />
581 <attribute name="Application-Name" value="Jalview Desktop" />
582 <attribute name="Codebase" value="${application.codebase}" />
584 <fileset dir="${outputDir}/">
585 <exclude name="cache*/**" />
586 <exclude name="*.jar" />
587 <exclude name="*.jar.*" />
588 <exclude name="**/*.jar" />
589 <exclude name="**/*.jar.*" />
593 <copy toDir="${packageDir}" flatten="true">
594 <fileset dir="${outputDir}">
595 <include name="*.jar" />
596 <include name="**/*.jar" />
602 <!-- jalopy code reformatter -->
603 <target name="sourcescrub" depends="init,build">
604 <jalopy destdir="jsrc" classpathref="run.classpath" convention="jalview-jalopy.xml">
605 <fileset dir="${sourceDir}">
606 <include name="*.java" />
607 <include name="**/*.java" />
608 <include name="**/**/*.java" />
615 <!-- Compile, package and obfuscate Jalview Applet -->
616 <target name="makeApplet" depends="obfuscate" description="assemble the final jalviewLite applet jar with or without obfuscation" />
618 <target name="compileApplet" depends="init,clean">
619 <mkdir dir="${outputDir}" />
620 <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/**" />
623 <target name="packageApplet" depends="compileApplet, buildPropertiesFile">
624 <copy file="${resourceDir}/images/link.gif" toFile="${outputDir}/images/link.gif" />
625 <copy todir="${outputDir}/lang">
626 <fileset dir="${resourceDir}/lang">
627 <include name="**.*" />
630 <jar destfile="in.jar" index="true">
632 <attribute name="Main-Class" value="jalview.bin.JalviewLite" />
633 <attribute name="Application-Name" value="JalviewLite" />
634 <attribute name="Codebase" value="${applet.codebase}" />
636 <fileset dir="${outputDir}">
637 <include name="com/**" />
638 <include name="MCview/**" />
639 <include name="jalview/**" />
640 <include name=".build_properties" />
641 <include name="images/link.gif" />
642 <include name="lang/**" />
646 <target name="obfuscate" depends="-obfuscatefake,-obfuscatereally">
648 <target name="-obfuscatefake" depends="packageApplet" if="donotobfuscate">
649 <copy file="in.jar" tofile="${jalviewLiteJar}" overwrite="true" />
650 <delete file="in.jar" />
652 <target name="-obfuscatereally" unless="donotobfuscate">
654 <path id="obfuscateDeps.path">
655 <pathelement location="${applet.jre.tools}" />
656 <pathelement location="appletlib/${jmolJar}" />
657 <pathelement location="lib/${varnaJar}" />
658 <pathelement location="appletlib/${jsoup}" />
659 <pathelement location="appletlib/${jsonSimple}" />
660 <pathelement location="appletlib/${javaJson}" />
661 <fileset dir="${java.home}/lib">
662 <include name="plugin.jar" />
665 <taskdef resource="proguard/ant/task.properties" classpath="utils/proguard_5.3.3.jar" />
667 <proguard verbose="true" >
668 <injar file="in.jar" />
669 <outjar file="${jalviewLiteJar}" />
670 <libraryjar refid="obfuscateDeps.path" />
672 <keep access="public" type="class" name="jalview.bin.JalviewLite">
673 <field access="public" />
674 <method access="public" />
675 <constructor access="public" />
677 <keep access="public" type="class" name="jalview.appletgui.AlignFrame">
678 <field access="public" />
679 <method access="public" />
680 <constructor access="public" />
683 <keep name="jalview.json.binding**">
688 <keep access="public" type="class" name="MCview.PDBfile">
689 <field access="public" />
690 <method access="public" />
691 <constructor access="public" />
694 <keep access="public" type="class" name="jalview.ws.jws1.Annotate3D">
695 <field access="public" />
696 <method access="public" />
697 <constructor access="public" />
700 <keep access="public" type="class" name="jalview.ext.jmol.JmolParser">
701 <field access="public" />
702 <method access="public" />
703 <constructor access="public" />
707 <!-- -libraryjars "${obfuscateDeps}"
709 -outjars jalviewApplet.jar
710 -keep public class jalview.bin.JalviewLite
713 <delete file="in.jar" />
716 <target name="castorbinding" depends="init" description="Generate Java bindings to supported Jalview XML models.">
717 <taskdef name="castor-srcgen" classname="org.castor.anttask.CastorCodeGenTask" classpathref="build.classpath" />
719 <fileset dir="${sourceDir}/jalview/schemabinding/version2">
720 <include name="*.java" />
721 <include name="descriptors/*.java" />
724 <castor-srcgen file="${schemaDir}/vamsas.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
725 <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
726 <castor-srcgen file="${schemaDir}/JalviewWsParamSet.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
727 <castor-srcgen file="${schemaDir}/jalview.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
729 now build the jalview.binding package with the old schema set
732 <fileset dir="${sourceDir}/jalview/binding/">
733 <include name="**" />
736 <castor-srcgen file="${schemaDir}/vamsasJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
737 <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
738 <castor-srcgen file="${schemaDir}/jalviewJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
740 <target name="sourcedist" description="create jalview source distribution" depends="init">
741 <delete file="${source.dist.name}" />
742 <!-- temporary copy of source to update timestamps -->
743 <copy todir="_sourcedist">
745 <exclude name=".*" />
746 <exclude name="**/.*" />
747 <exclude name="*.class" />
748 <exclude name="**/*.class" />
749 <include name="LICENSE" />
750 <include name="README" />
751 <include name="build.xml" />
752 <include name="jalview-jalopy.xml" />
753 <include name="JalviewApplet.jpx" />
754 <include name="JalviewX.jpx" />
755 <include name="nbbuild.xml" />
756 <include name="nbproject/genfiles.properties" />
757 <include name="nbproject/project.properties" />
758 <include name="nbproject/project.xml" />
759 <include name="${sourceDir}/*.java" />
760 <include name="${sourceDir}/**/*.java" />
761 <include name="${sourceDir}/**/*.cdr" />
762 <include name="${libDir}/**/*" />
763 <include name="${resourceDir}/**/*" />
764 <include name="${helpDir}/**/*" />
765 <include name="appletlib/${jmolJar}" />
766 <include name="appletlib/${jsonSimple}" />
767 <include name="appletlib/${javaJson}" />
768 <exclude name="**/*locales" />
769 <exclude name="*locales/**" />
770 <exclude name="utils/InstallAnywhere/**Build.iap_xml" />
771 <exclude name="utils/InstallAnywhere/**Build*/**" />
772 <exclude name="utils/InstallAnywhere/**Build*/**" />
773 <exclude name="utils/InstallAnywhere/.build*.*/**" />
774 <exclude name="utils/InstallAnywhere/**locale*" />
775 <exclude name="utils/InstallAnywhere/**locale*/**" />
776 <exclude name="utils/InstallAnywhere/**locale*/**" />
777 <include name="${schemaDir}/**/*" />
778 <include name="utils/**/*" />
779 <include name="${docDir}/**/*" />
780 <include name="examples/**/*" />
784 <tstamp prefix="build">
785 <format property="year" pattern="yyyy" />
787 <!-- each replacetoken CDATA body must be on one line -
788 otherwise the pattern doesn't match -->
789 <replace value="${JALVIEW_VERSION}">
790 <replacetoken><![CDATA[$$Version-Rel$$]]></replacetoken>
791 <fileset dir="_sourcedist">
792 <include name="**/*" />
795 <replace dir="_sourcedist" value="${build.year}">
796 <replacetoken><![CDATA[$$Year-Rel$$]]></replacetoken>
797 <fileset dir="_sourcedist">
798 <include name="**/*" />
802 <tar destfile="${source.dist.name}" compression="gzip">
803 <tarfileset dir="_sourcedist/" prefix="jalview" preserveLeadingSlashes="true">
807 <delete dir="_sourcedist" />
809 <target name="prepubapplet_1" depends="makeApplet">
810 <copy todir="${packageDir}/examples">
811 <fileset dir="examples">
812 <include name="**/*" />
813 <include name="javascript/*" />
814 <include name="jmol/*" />
817 <include name="${jalviewLiteJar}" />
819 <fileset dir="appletlib">
820 <include name="**/*" />
823 <jar update="true" index="true" jarfile="${packageDir}/examples/${jalviewLiteJar}" />
824 <jar update="true" index="true" jarfile="${packageDir}/examples/${javaJson}" />
825 <jar update="true" index="true" jarfile="${packageDir}/examples/${jsonSimple}" />
826 <jar update="true" index="true" jarfile="${packageDir}/examples/${jmolJar}">
828 <attribute name="Application-Name" value="Jmol (bundled with JalviewLite)" />
829 <!-- <attribute name="Permissions" value="sandbox" /> -->
830 <!--<attribute name="Trusted-Lib" value="true" /> -->
831 <attribute name="Codebase" value="${applet.codebase}" />
832 <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}" />
836 <presetdef name="ap_applet.jar">
837 <!-- build a signed applet with 'all-permissions' -
838 Needs 'param name="permissions' value="all-permissions"' in applet tag
839 JalviewLite+JmolApplet linked sequence/structure fails
840 Mixed code warnings are raised
842 <jar update="true" index="true">
844 <attribute name="Application-Name" value="JalviewLite" />
845 <attribute name="Permissions" value="all-permissions" />
846 <attribute name="Codebase" value="${applet.codebase}" />
847 <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}" />
848 <attribute name="Application-Library-Allowable-Codebase" value="${applet.codebase}" />
852 <presetdef name="applet.jar">
853 <!-- build signed applet with sandbox permissions -
854 Needs 'param name="permissions' value="sandbox"' in applet tag
855 Preserves Pre-Java 1.7_u45 behavior once 'permissions' parameter added to applet tag
858 <jar update="true" index="true">
860 <attribute name="Application-Name" value="JalviewLite" />
861 <attribute name="Permissions" value="sandbox" />
862 <attribute name="Codebase" value="${applet.codebase}" />
863 <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}" />
864 <attribute name="Application-Library-Allowable-Codebase" value="${applet.codebase}" />
868 <presetdef name="tl_applet.jar">
869 <!-- build signed applet with trusted library/trusted permissions -
870 Needs 'param name="permissions' value="all-permissions"' in applet tag
872 No mixed code warnings raised
873 Jmol/JalviewLite sequence/structure example doesn't link structures
874 Raises dialog asking user to allow page to control applet via LiveConnect javascript
878 <jar update="true" index="true">
880 <attribute name="Application-Name" value="JalviewLite" />
881 <attribute name="Permissions" value="all-permissions" />
882 <attribute name="Codebase" value="${applet.codebase}" />
883 <attribute name="Trusted-Only" value="true" />
884 <attribute name="Trusted-Library" value="true" />
888 <presetdef name="to_applet.jar">
889 <!-- not fully test variant (yet) -->
890 <jar update="true" index="true">
892 <attribute name="Application-Name" value="JalviewLite" />
893 <attribute name="Permissions" value="all-permissions" />
894 <attribute name="Codebase" value="${applet.codebase}" />
895 <attribute name="Trusted-Only" value="true" />
899 <!-- create differently privileged artefacts -->
900 <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/u_${jalviewLiteJar}" />
901 <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/u_${jmolJar}" overwrite="true" />
902 <copy file="${packageDir}/examples/${javaJson}" tofile="${packageDir}/examples/u_${javaJson}" overwrite="true" />
903 <copy file="${packageDir}/examples/${jsonSimple}" tofile="${packageDir}/examples/u_${jsonSimple}" overwrite="true" />
904 <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/ap_${jalviewLiteJar}" />
905 <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/ap_${jmolJar}" />
906 <copy file="${packageDir}/examples/${javaJson}" tofile="${packageDir}/examples/ap_${javaJson}" />
907 <copy file="${packageDir}/examples/${jsonSimple}" tofile="${packageDir}/examples/ap_${jsonSimple}" />
908 <ap_applet.jar jarfile="${packageDir}/examples/ap_${jalviewLiteJar}" />
909 <ap_applet.jar jarfile="${packageDir}/examples/ap_${jmolJar}" />
910 <ap_applet.jar jarfile="${packageDir}/examples/ap_${javaJson}" />
911 <ap_applet.jar jarfile="${packageDir}/examples/ap_${jsonSimple}" />
912 <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/tl_${jalviewLiteJar}" />
913 <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/tl_${jmolJar}" />
914 <copy file="${packageDir}/examples/${javaJson}" tofile="${packageDir}/examples/tl_${javaJson}" />
915 <copy file="${packageDir}/examples/${jsonSimple}" tofile="${packageDir}/examples/tl_${jsonSimple}" />
916 <tl_applet.jar jarfile="${packageDir}/examples/tl_${jalviewLiteJar}" />
917 <tl_applet.jar jarfile="${packageDir}/examples/tl_${jmolJar}" />
918 <tl_applet.jar jarfile="${packageDir}/examples/tl_${javaJson}" />
919 <tl_applet.jar jarfile="${packageDir}/examples/tl_${jsonSimple}" />
920 <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/to_${jalviewLiteJar}" />
921 <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/to_${jmolJar}" />
922 <copy file="${packageDir}/examples/${javaJson}" tofile="${packageDir}/examples/to_${javaJson}" />
923 <copy file="${packageDir}/examples/${jsonSimple}" tofile="${packageDir}/examples/to_${jsonSimple}" />
924 <to_applet.jar jarfile="${packageDir}/examples/to_${jalviewLiteJar}" />
925 <to_applet.jar jarfile="${packageDir}/examples/to_${jmolJar}" />
926 <to_applet.jar jarfile="${packageDir}/examples/to_${javaJson}" />
927 <to_applet.jar jarfile="${packageDir}/examples/to_${jsonSimple}" />
928 <!-- finally, create manifest for original jars -->
929 <applet.jar jarfile="${packageDir}/examples/${jalviewLiteJar}" />
930 <applet.jar jarfile="${packageDir}/examples/${jmolJar}" />
931 <applet.jar jarfile="${packageDir}/examples/${javaJson}" />
932 <applet.jar jarfile="${packageDir}/examples/${jsonSimple}" />
934 <!-- todo - write examples/downloads for alternate versions of the applet
935 probably don't need to do this now since we don't have alternate versions anymore !-->
937 <target name="-signapplet" depends="prepubapplet_1">
938 <fileset id="signappletjarset" dir="${packageDir}/examples">
939 <exclude name="u_*.jar" />
940 <include name="${jalviewLiteJar}" />
941 <include name="${jmolJar}" />
942 <include name="${javaJson}" />
943 <include name="${jsonSimple}" />
944 <include name="to_${jalviewLiteJar}" />
945 <include name="to_${jmolJar}" />
946 <include name="to_${javaJson}" />
947 <include name="to_${jsonSimple}" />
948 <include name="tl_${jalviewLiteJar}" />
949 <include name="tl_${jmolJar}" />
950 <include name="tl_${javaJson}" />
951 <include name="tl_${jsonSimple}" />
952 <include name="ap_${jalviewLiteJar}" />
953 <include name="ap_${jmolJar}" />
954 <include name="ap_${javaJson}" />
955 <include name="ap_${jsonSimple}" />
958 <target name="-signappletnotsa" if:blank="timestamp" depends="-signapplet" unless="nosign">
959 <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false">
960 <fileset refid="signappletjarset" />
964 <target name="-signapplettsa" if="timestamp" depends="-signapplet" unless="nosign">
965 <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}">
966 <fileset refid="signappletjarset" />
970 <target name="signApplet" description="internal target to sign applet" depends="-signappletnotsa,-signapplettsa" />
972 <target name="pubapplet" description="installs the jalviewLite applet and dependent jars into an applet examples directory built under ${outputDir}" depends="makeApplet, signApplet">
974 <!-- bizarre bug causes JmolApplet to always get signed, even if excluded from above. so copy explicitly -->
975 <copy file="appletlib/${jmolJar}" tofile="${packageDir}/examples/u_${jmolJar}" overwrite="true" />
976 <copy file="appletlib/${jsonSimple}" tofile="${packageDir}/examples/u_${jsonSimple}" overwrite="true" />
977 <copy file="appletlib/${javaJson}" tofile="${packageDir}/examples/u_${javaJson}" overwrite="true" />
978 <!-- finally, replace any launchApp servlet tags with a version specification -->
979 <replace value="http://www.jalview.org/services/launchApp?version=${JALVIEW_VERSION}"">
981 <![CDATA[http://www.jalview.org/services/launchApp"]]>
983 <fileset dir="${packageDir}/examples">
984 <include name="**/*.html" />
987 <replace value="http://www.jalview.org/services/launchApp?version=${JALVIEW_VERSION}'">
989 <![CDATA[http://www.jalview.org/services/launchApp']]>
991 <fileset dir="${packageDir}/examples">
992 <include name="**/*.html" />
997 <target name="sourcedoc" description="Create jalview source documentation pages" depends="init">
998 <javadoc destdir="${javadocDir}">
999 <packageset dir="${sourceDir}" includes="jalview/*,MCView/*">
1003 <target name="linkcheck" depends="init,prepare">
1004 <javac srcdir="utils" destdir="utils" includes="HelpLinksChecker.java"/>
1005 <java fork="true" dir="${helpDir}" classpath="utils" classname="HelpLinksChecker" failonerror="true">
1006 <arg file="${helpDir}"/>
1007 <arg value="-nointernet"/>