3 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
4 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
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/>.
19 <project name="jalviewX" default="usage" basedir=".">
20 <!-- we use jalopy to format our sources -->
21 <taskdef name="jalopy" classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
23 <fileset dir="utils/jalopy/lib">
24 <include name="*.jar" />
29 <target name="help" depends="usage" />
31 <echo message="~~~Jalview Ant build.xml Usage~~~~" />
32 <echo message="Targets include:" />
33 <echo message="usage - default target, displays this message" />
34 <echo message="buildindices - generates JavaHelpSearch from the help files" />
35 <echo message="build - compiles all necessary files for Application" />
36 <echo message="makedist - compiles and places all necessary jar files into directory dist" />
37 <echo message="makefulldist - signs all jar files and builds jnlp file for full distribution" />
38 <echo message=" this needs a keystore and key. 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="See docs/building.html and the comments in build file for other targets." />
42 <echo message="note: compile and makeApplet require the property java118.home to be set to point to a java 1.1.8 jdk." />
43 <echo message="Useful -D flags: -Ddonotobfuscate will prevent applet obfuscation" />
47 <!-- utils is a class path to additional utilities needed for
48 building docs, jars and webstart stuff -->
50 Userdefined build property defaults
52 wsdl.server list (plus namespace mapping info ???) - also want
53 ... to make this a dynamically generatable property
55 Build location - provide a temporary root for speed
56 jarsigner keystore and info
57 Jakarta and axis classpath ?
58 Default argument for starting Jalview (if it exists).
63 <path id="axis.classpath">
65 <fileset dir="/usr/local/axis/lib">
66 <include name="**/*.jar" />
68 <fileset dir="/usr/local/jakarta-tomcat-5/webapps/axis/WEB-INF/lib">
69 <include name="**/*.jar"/>
70 <include name="*.jar"/>
73 <!-- Jalview Version String displayed by application on startup and used to check for updates -->
74 <property name="JALVIEW_VERSION" value="DEVELOPMENT" />
75 <!-- 2.4 (VAMSAS)" -->
76 <!-- Include debugging information in javac true or false -->
77 <property name="javac.debug" value="true" />
79 <!-- JarSigner Key Store for Webstart Distribution -->
80 <property name="jalview.keystore" value="./keys/.keystore" />
81 <!-- Keystore Password -->
82 <property name="jalview.keystore.pass" value="alignmentisfun" />
84 <property name="jalview.key" value="jalview" />
86 <property name="jalview.key.pass" value="alignmentisfun" />
88 <!-- Don't change anything below here unless you know what you are doing! -->
89 <!-- Url path for WebStart in JNLP file -->
90 <property name="WebStartLocation" value="http://www.jalview.org/webstart" />
91 <!-- Webstart Image - looked for in resources/images -->
92 <property name="WebStartImage" value="JalviewLogo_big.png"/>
93 <!-- J2SE version needed for webstart launch -->
94 <!-- Anne's version needs 1.7 - should rebuild VARNA to java 1.6 for release -->
95 <property name="j2sev" value="1.7+"/>
96 <!-- build directory configuration -->
97 <property name="libDir" value="lib" />
98 <property name="resourceDir" value="resources" />
99 <property name="helpDir" value="help" />
100 <property name="docDir" value="doc" />
101 <property name="sourceDir" value="src" />
102 <property name="schemaDir" value="schemas" />
103 <property name="outputDir" value="classes" />
104 <property name="packageDir" value="dist" />
105 <property name="outputJar" value="jalview.jar" />
106 <!-- Jalview Applet JMol Jar Dependency -->
107 <property name="jmolJar" value="JmolApplet-12.2.4.jar" />
108 <property name="varnaJar" value="VARNAv3-9-dev.jar" />
109 <property name="jalviewLiteJar" value="jalviewApplet.jar" />
110 <!-- switch to indicate if we should obfuscate jalviewLite -->
111 <!--<property name="donotobfuscate" value="true"/> -->
113 <!-- Jalview Web Service Clients - see the comments in 'buildextclients' for details -->
114 <property name="wsdl.File" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred?wsdl" />
115 <property name="wsdl.Files" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/vamsas?wsdlFiles" />
116 <property name="wsdl.MsaWS" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/MuscleWS?wsdl" />
117 <property name="wsdl.MsaWS2" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/ClustalWS?wsdl" />
118 <property name="WSInterf" value="MsaWS" />
119 <property name="wsdl.Namespace" value="vamsas" />
120 <property name="wsdl.ClientNS" value="ext.vamsas" />
121 <!-- the class path for building the application -->
122 <path id="build.classpath">
123 <fileset dir="utils">
124 <include name="*.jar" />
125 <include name="**/*.jar" />
127 <fileset dir="${libDir}">
128 <include name="*.jar" />
129 <include name="**/*.jar" />
131 <fileset dir="${java.home}/lib">
132 <include name="plugin.jar"/>
134 <fileset dir="appletlib">
135 <!-- the JmolApplet includes the JmolApplet console and the application javac seems to always try and build all packages
137 <include name="${jmolJar}" />
138 <include name="${varnaJar}" />
142 <property name="source.dist.name" value="${basedir}/jalview-src.tar.gz" />
143 <!-- The Location of the java 1.1.8 jdk -->
144 <!--<property name="java118.home" value="C:\Sun\jdk1.1.8" />
146 <property name="java118.home" value="${java.home}" />
147 <!--<property name="applet.jre.tools" value="${java118.home}/lib/classes.zip" />
148 --><!-- jre for 1.4 version -->
149 <property name="applet.jre.tools" value="${java.home}/lib/rt.jar"/>
151 <!-- the classpath for building the 1.1 applet -->
152 <path id="jalviewlite.deps">
153 <fileset dir="${java118.home}">
154 <include name="lib/classes.zip" />
156 <fileset dir="${java.home}/lib">
157 <include name="plugin.jar"/>
159 <pathelement location="appletlib/${jmolJar}" />
161 <!-- default location for outputting javadoc -->
162 <property name="javadocDir" value="${packageDir}/javadoc"/>
166 <taskdef classpath="utils/roxes-ant-tasks-1.2-2004-01-30.jar" resource="com/roxes/tools/ant/taskdefs.properties" />
167 <target name="buildPropertiesFile" depends="init">
168 <tstamp prefix="build">
169 <format property="date" pattern="dd MMMM yyyy" />
171 <properties file="${outputDir}/.build_properties">
173 ---Jalview Build Details---
175 <property name="VERSION" value="${JALVIEW_VERSION}" />
176 <property name="BUILD_DATE" value="${build.date}" />
181 <target name="clean" depends="init">
182 <!-- not efficient yet. -->
183 <delete dir="${outputDir}" includes="*,**/*"/>
186 <target name="distclean" depends="init, clean">
188 <echo message="REMOVING ALL BACKUP/AUTOSAVES!" />
191 <include name="${outputJar}" />
192 <include name="#*#" />
193 <include name="#*.*#" />
194 <include name="**/#*#" />
195 <include name="**/#*.*#" />
196 <include name="*~" />
197 <include name="*.*~" />
198 <include name="**/*~" />
199 <include name="**/*.*~" />
204 <target name="prepare" depends="init">
205 <mkdir dir="${outputDir}" />
206 <copy todir="${outputDir}">
208 <include name="${docDir}/**/*.*" />
209 <include name="${helpDir}/**/*.*" />
210 <include name="${libDir}/*.jar" />
212 <fileset dir="${resourceDir}">
213 <include name="**/*.*" />
218 <target name="build" depends="prepare">
219 <!-- not efficient yet. -->
220 <javac source="1.5" target="1.5" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}" classpathref="build.classpath">
221 <exclude name="jalview/*applet*" />
222 <exclude name="jalview/appletgui/**" />
223 <exclude name="com/stevesoft/**" />
226 <target name="buildindices" depends="init, prepare" unless="help.uptodate">
227 <java classname="com.sun.java.help.search.Indexer" classpathref="build.classpath" fork="true" dir="${outputDir}/${helpDir}">
232 <target name="makefulldist" depends="makedist">
233 <!-- the default keystore details might need to be edited here -->
234 <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false">
236 <fileset dir="${packageDir}">
237 <include name="*.jar" />
240 <copy todir="${packageDir}">
241 <fileset dir="${resourceDir}/images">
242 <include name="${WebStartImage}"/>
246 <taskdef classpathref="build.classpath" resource="com/roxes/tools/ant/taskdefs.properties" />
248 <!-- codebase="http://www.jalview.org/jalview/webstart" -->
249 <!-- href="jalview.jnlp" prevent hard-wired pickup of jnlp in certain javaws versions -->
250 <jnlp toFile="${packageDir}/jalview.jnlp" codebase="${WebStartLocation}">
252 <title>Jalview</title>
253 <vendor>The Barton Group</vendor>
254 <homepage href="http://www.jalview.org" />
255 <description>Jalview Multiple Alignment Editor</description>
256 <description kind="short">Jalview</description>
257 <icon href="${WebStartImage}" />
261 <j2se version="${j2sev}" initial_heap_size="10M" />
262 <fileset dir="${packageDir}">
263 <include name="jalview.jar" />
265 <fileset dir="${packageDir}">
266 <include name="*.jar" />
267 <include name="*_*.jar" />
268 <exclude name="jalview.jar" />
270 <property name="jalview.version" value="${JALVIEW_VERSION}" />
272 <application_desc main_class="jalview.bin.Jalview">
278 <jnlp toFile="${packageDir}/jalview_1G.jnlp" codebase="${WebStartLocation}">
280 <title>Jalview</title>
281 <vendor>The Barton Group</vendor>
282 <homepage href="http://www.jalview.org" />
283 <description>Jalview Multiple Alignment Editor</description>
284 <description kind="short">Jalview</description>
285 <icon href="${WebStartImage}" />
289 <j2se version="${j2sev}" initial_heap_size="128M" max_heap_size="512M" />
290 <fileset dir="${packageDir}">
291 <include name="jalview.jar" />
293 <fileset dir="${packageDir}">
294 <include name="*.jar" />
295 <include name="*_*.jar" />
296 <exclude name="jalview.jar" />
298 <property name="jalview.version" value="${JALVIEW_VERSION}" />
300 <application_desc main_class="jalview.bin.Jalview">
306 <jnlp toFile="${packageDir}/jalview_2G.jnlp" codebase="${WebStartLocation}">
308 <title>Jalview</title>
309 <vendor>The Barton Group</vendor>
310 <homepage href="http://www.jalview.org" />
311 <description>Jalview Multiple Alignment Editor</description>
312 <description kind="short">Jalview</description>
313 <icon href="${WebStartImage}" />
317 <j2se version="${j2sev}" initial_heap_size="256M" max_heap_size="1024M" />
318 <fileset dir="${packageDir}">
319 <include name="jalview.jar" />
321 <fileset dir="${packageDir}">
322 <include name="*.jar" />
323 <include name="*_*.jar" />
324 <exclude name="jalview.jar" />
326 <property name="jalview.version" value="${JALVIEW_VERSION}" />
328 <application_desc main_class="jalview.bin.Jalview">
334 <!-- finally, need to postprocess to add in associations at end of 'information' element
336 <xslt in="${packageDir}/jalview_noa_1G.jnlp" out="${packageDir}/jalview_1G.jnlp">
343 <association mime-type="application-x/ext-file" extensions="fa"/>
344 <association mime-type="application-x/ext-file" extensions="fasta"/>
345 <association mime-type="application-x/ext-file" extensions="fastq"/>
346 <association mime-type="application-x/ext-file" extensions="blc"/>
347 <association mime-type="application-x/ext-file" extensions="msf"/>
348 <association mime-type="application-x/ext-file" extensions="pfam"/>
349 <association mime-type="application-x/ext-file" extensions="aln"/>
350 <association mime-type="application-x/ext-file" extensions="pir"/>
351 <association mime-type="application-x/ext-file" extensions="amsa"/>
352 <association mime-type="application-x/ext-file" extensions="stk"/>
353 <association mime-type="application-x/ext-file" extensions="jar"/>-->
357 <target name="runenv" depends="init">
358 <path id="run.classpath">
359 <pathelement location="${outputDir}" />
360 <fileset dir="${outputDir}">
361 <include name="${libDir}/*.jar" />
364 <pathconvert targetos="unix" refid="run.classpath" property="run.classpath" />
366 <echo>java -classpath ${run.classpath} jalview.bin.Jalview
370 <target name="buildextclients" depends="init">
371 <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" />
372 <condition property="dontextbuild">
373 <equals arg1="n" arg2="${doextbuild.response}" />
375 <condition property="dontextbuild">
376 <equals arg1="N" arg2="${doextbuild.response}" />
378 <fail if="dontextbuild">
379 Build External Client Code process aborted by user. Jalview source is unchanged.
381 <!-- Currently, this doesn't happen automatically.
382 1. Run WSDL2Java as below, which generates an ext.vamsas +
383 vamsas.<datapackages> fileset.
384 2. refactor ext.vamsas.SpecificserviceWS* to
385 ext.vamsas.ServiceclassWS* that implements the ServiceclassWSI interface.
386 3. Update the jalview.ws.*WServices classes to reflect the
387 interface type, and all locations of this wsdl type that Jalview
391 <path id="axisbuild">
392 <path refid="build.classpath" />
394 <taskdef resource="axis-tasks.properties" classpathref="axisbuild" />
396 <fileset dir="${sourceDir}" id="client">
397 <include name="${wsdl.ClientNS}/*.*" />
401 <axis-wsdl2java output="${sourceDir}" verbose="true" url="${wsdl.MsaWS2}" serverside="false" deployscope="Request" debug="false" helpergen="true" all="true">
403 <mapping namespace="${wsdl.Namespace}" package="${wsdl.ClientNS}" />
404 <mapping namespace="http://dataTypes.vamsas" package="${wsdl.ClientNS}" />
409 <target name="makedist" depends="build, buildPropertiesFile, buildindices">
410 <!-- make the package jar if not already existing -->
411 <mkdir dir="${packageDir}" />
412 <!-- clean dir if it already existed -->
414 <fileset dir="${packageDir}">
415 <include name="*.jar"/>
418 <jar destfile="${packageDir}/${outputJar}">
420 <attribute name="Main-Class" value="jalview.bin.Jalview" />
422 <fileset dir="${outputDir}/">
423 <exclude name="cache*/**" />
424 <exclude name="*.jar" />
425 <exclude name="*.jar.*" />
426 <exclude name="**/*.jar" />
427 <exclude name="**/*.jar.*" />
431 <copy toDir="${packageDir}" flatten="true">
432 <fileset dir="${outputDir}">
433 <include name="*.jar" />
434 <include name="**/*.jar" />
440 <!-- jalopy code reformatter -->
441 <target name="sourcescrub" depends="init,build">
442 <jalopy destdir="jsrc" classpathref="run.classpath" convention="jalview-jalopy.xml">
443 <fileset dir="${sourceDir}">
444 <include name="*.java" />
445 <include name="**/*.java" />
446 <include name="**/**/*.java" />
453 <!-- Compile, package and obfuscate Jalview Applet -->
454 <target name="makeApplet" depends="obfuscate" description="assemble the final jalviewLite applet jar with or without obfuscation"/>
456 <target name="compileApplet" depends="init,clean">
457 <mkdir dir="${outputDir}" />
458 <javac source="1.5" target="1.5" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}"
459 classpathref="jalviewlite.deps" includes="jalview/appletgui/**"
460 excludes="ext/**,MCview/**,org/**,vamsas/**" />
463 <target name="packageApplet" depends="compileApplet, buildPropertiesFile">
464 <copy file="${resourceDir}/images/idwidth.gif" toFile="${outputDir}/images/idwidth.gif" />
465 <copy file="${resourceDir}/images/link.gif" toFile="${outputDir}/images/link.gif" />
466 <jar destfile="in.jar">
468 <attribute name="Main-Class" value="jalview.bin.JalviewLite" />
470 <fileset dir="${outputDir}">
471 <include name="com/**" />
472 <include name="MCview/**" />
473 <include name="jalview/**" />
474 <include name=".build_properties" />
475 <include name="images/idwidth.gif" />
476 <include name="images/link.gif" />
480 <target name="obfuscate" depends="-obfuscatefake,-obfuscatereally">
482 <target name="-obfuscatefake" depends="packageApplet" if="donotobfuscate">
483 <copy file="in.jar" tofile="${jalviewLiteJar}" overwrite="true" />
484 <delete file="in.jar" />
486 <target name="-obfuscatereally" unless="donotobfuscate">
488 <path id="obfuscateDeps.path">
489 <pathelement location="${applet.jre.tools}" />
490 <pathelement location="appletlib/${jmolJar}" />
492 <taskdef resource="proguard/ant/task.properties" classpath="utils/proguard.jar" />
495 <injar file="in.jar" />
496 <outjar file="${jalviewLiteJar}" />
497 <libraryjar refid="obfuscateDeps.path" />
498 <keep access="public" type="class" name="jalview.bin.JalviewLite">
499 <field access="public" />
500 <method access="public" />
501 <constructor access="public" />
503 <!-- -libraryjars "${obfuscateDeps}"
505 -outjars jalviewApplet.jar
506 -keep public class jalview.bin.JalviewLite
509 <delete file="in.jar" />
512 <target name="castorbinding" depends="init" description="Generate Java bindings to supported Jalview XML models.">
513 <taskdef name="castor-srcgen" classname="org.castor.anttask.CastorCodeGenTask" classpathref="build.classpath" />
515 <fileset dir="${sourceDir}/jalview/schemabinding/version2">
516 <include name="*.java" />
517 <include name="descriptors/*.java" />
520 <castor-srcgen file="${schemaDir}/vamsas.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
521 <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
522 <castor-srcgen file="${schemaDir}/JalviewWsParamSet.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
523 <castor-srcgen file="${schemaDir}/jalview.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
525 now build the jalview.binding package with the old schema set
528 <fileset dir="${sourceDir}/jalview/binding/">
529 <include name="**" />
532 <castor-srcgen file="${schemaDir}/vamsasJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
533 <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
534 <castor-srcgen file="${schemaDir}/jalviewJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
536 <target name="sourcedist" description="create jalview source distribution" depends="init">
537 <delete file="${source.dist.name}" />
538 <tar destfile="${source.dist.name}" compression="gzip">
539 <tarfileset dir="./" prefix="jalview" preserveLeadingSlashes="true">
540 <include name="LICENSE" />
541 <include name="README" />
542 <include name="build.xml" />
543 <include name="jalview-jalopy.xml" />
544 <include name="JalviewApplet.jpx" />
545 <include name="JalviewX.jpx" />
546 <include name="nbbuild.xml"/>
547 <include name="nbproject/genfiles.properties"/>
548 <include name="nbproject/project.properties"/>
549 <include name="nbproject/project.xml"/>
550 <include name="${sourceDir}/*.java" />
551 <include name="${sourceDir}/**/*.java" />
552 <include name="${sourceDir}/**/*.cdr" />
553 <include name="${libDir}/**/*" />
554 <include name="${resourceDir}/**/*" />
555 <include name="${helpDir}/**/*" />
556 <include name="appletlib/${jmolJar}" />
557 <exclude name="**/*locales" />
558 <exclude name="*locales/**" />
559 <exclude name="utils/InstallAnywhere/**Build.iap_xml" />
560 <exclude name="utils/InstallAnywhere/**Build*/**" />
561 <exclude name="utils/InstallAnywhere/**Build*/**" />
562 <exclude name="utils/InstallAnywhere/**locale*" />
563 <exclude name="utils/InstallAnywhere/**locale*/**" />
564 <include name="${schemaDir}/**/*" />
565 <include name="utils/**/*" />
566 <include name="${docDir}/**/*" />
567 <include name="examples/**/*" />
571 <target name="pubapplet" description="installs the jalviewLite applet and dependent jars into an applet examples directory built under ${outputDir}" depends="makeApplet">
572 <copy todir="${packageDir}/examples">
573 <fileset dir="examples">
574 <include name="**/*"/>
575 <include name="javascript/*"/>
576 <include name="jmol/*"/>
579 <include name="jalviewApplet.jar"/>
581 <fileset dir="appletlib">
582 <include name="**/*"/>
587 <target name="sourcedoc" description="Create jalview source documentation pages" depends="init">
588 <javadoc destdir="${javadocDir}">
589 <packageset dir="${sourceDir}" includes="jalview/*,MCView/*">