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 <!-- J2SE version needed for webstart launch -->
92 <!-- Anne's version needs 1.7 - should rebuild VARNA to java 1.6 for release -->
93 <property name="j2sev" value="1.7+"/>
94 <!-- build directory configuration -->
95 <property name="libDir" value="lib" />
96 <property name="resourceDir" value="resources" />
97 <property name="helpDir" value="help" />
98 <property name="docDir" value="doc" />
99 <property name="sourceDir" value="src" />
100 <property name="schemaDir" value="schemas" />
101 <property name="outputDir" value="classes" />
102 <property name="packageDir" value="dist" />
103 <property name="outputJar" value="jalview.jar" />
104 <!-- Jalview Applet JMol Jar Dependency -->
105 <property name="jmolJar" value="JmolApplet-12.2.4.jar" />
106 <property name="varnaJar" value="VARNAv3-9-dev.jar" />
107 <property name="jalviewLiteJar" value="jalviewApplet.jar" />
108 <!-- switch to indicate if we should obfuscate jalviewLite -->
109 <!--<property name="donotobfuscate" value="true"/> -->
111 <!-- Jalview Web Service Clients - see the comments in 'buildextclients' for details -->
112 <property name="wsdl.File" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred?wsdl" />
113 <property name="wsdl.Files" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/vamsas?wsdlFiles" />
114 <property name="wsdl.MsaWS" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/MuscleWS?wsdl" />
115 <property name="wsdl.MsaWS2" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/ClustalWS?wsdl" />
116 <property name="WSInterf" value="MsaWS" />
117 <property name="wsdl.Namespace" value="vamsas" />
118 <property name="wsdl.ClientNS" value="ext.vamsas" />
119 <!-- the class path for building the application -->
120 <path id="build.classpath">
121 <fileset dir="utils">
122 <include name="*.jar" />
123 <include name="**/*.jar" />
125 <fileset dir="${libDir}">
126 <include name="*.jar" />
127 <include name="**/*.jar" />
129 <fileset dir="${java.home}/lib">
130 <include name="plugin.jar"/>
132 <fileset dir="appletlib">
133 <!-- the JmolApplet includes the JmolApplet console and the application javac seems to always try and build all packages
135 <include name="${jmolJar}" />
136 <include name="${varnaJar}" />
140 <property name="source.dist.name" value="${basedir}/jalview-src.tar.gz" />
141 <!-- The Location of the java 1.1.8 jdk -->
142 <!--<property name="java118.home" value="C:\Sun\jdk1.1.8" />
144 <property name="java118.home" value="${java.home}" />
145 <!--<property name="applet.jre.tools" value="${java118.home}/lib/classes.zip" />
146 --><!-- jre for 1.4 version -->
147 <property name="applet.jre.tools" value="${java.home}/lib/rt.jar"/>
149 <!-- the classpath for building the 1.1 applet -->
150 <path id="jalviewlite.deps">
151 <fileset dir="${java118.home}">
152 <include name="lib/classes.zip" />
154 <fileset dir="${java.home}/lib">
155 <include name="plugin.jar"/>
157 <pathelement location="appletlib/${jmolJar}" />
159 <!-- default location for outputting javadoc -->
160 <property name="javadocDir" value="${packageDir}/javadoc"/>
164 <taskdef classpath="utils/roxes-ant-tasks-1.2-2004-01-30.jar" resource="com/roxes/tools/ant/taskdefs.properties" />
165 <target name="buildPropertiesFile" depends="init">
166 <tstamp prefix="build">
167 <format property="date" pattern="dd MMMM yyyy" />
169 <properties file="${outputDir}/.build_properties">
171 ---Jalview Build Details---
173 <property name="VERSION" value="${JALVIEW_VERSION}" />
174 <property name="BUILD_DATE" value="${build.date}" />
179 <target name="clean" depends="init">
180 <!-- not efficient yet. -->
181 <delete dir="${outputDir}" includes="*,**/*"/>
184 <target name="distclean" depends="init, clean">
186 <echo message="REMOVING ALL BACKUP/AUTOSAVES!" />
189 <include name="${outputJar}" />
190 <include name="#*#" />
191 <include name="#*.*#" />
192 <include name="**/#*#" />
193 <include name="**/#*.*#" />
194 <include name="*~" />
195 <include name="*.*~" />
196 <include name="**/*~" />
197 <include name="**/*.*~" />
202 <target name="prepare" depends="init">
203 <mkdir dir="${outputDir}" />
204 <copy todir="${outputDir}">
206 <include name="${docDir}/**/*.*" />
207 <include name="${helpDir}/**/*.*" />
208 <include name="${libDir}/*.jar" />
210 <fileset dir="${resourceDir}">
211 <include name="**/*.*" />
216 <target name="build" depends="prepare">
217 <!-- not efficient yet. -->
218 <javac source="1.5" target="1.5" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}" classpathref="build.classpath">
219 <exclude name="jalview/*applet*" />
220 <exclude name="jalview/appletgui/**" />
221 <exclude name="com/stevesoft/**" />
224 <target name="buildindices" depends="init, prepare" unless="help.uptodate">
225 <java classname="com.sun.java.help.search.Indexer" classpathref="build.classpath" fork="true" dir="${outputDir}/${helpDir}">
230 <target name="makefulldist" depends="makedist">
231 <!-- the default keystore details might need to be edited here -->
232 <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false">
234 <fileset dir="${packageDir}">
235 <include name="*.jar" />
238 <taskdef classpathref="build.classpath" resource="com/roxes/tools/ant/taskdefs.properties" />
240 <!-- codebase="http://www.jalview.org/jalview/webstart" -->
241 <!-- href="jalview.jnlp" prevent hard-wired pickup of jnlp in certain javaws versions -->
242 <jnlp toFile="${packageDir}/jalview.jnlp" codebase="${WebStartLocation}">
244 <title>Jalview</title>
245 <vendor>The Barton Group</vendor>
246 <homepage href="http://www.jalview.org" />
247 <description>Jalview Multiple Alignment Editor</description>
248 <description kind="short">Jalview</description>
249 <icon href="logo_big.gif" />
253 <j2se version="${j2sev}" initial_heap_size="10M" />
254 <fileset dir="${packageDir}">
255 <include name="jalview.jar" />
257 <fileset dir="${packageDir}">
258 <include name="*.jar" />
259 <include name="*_*.jar" />
260 <exclude name="jalview.jar" />
262 <property name="jalview.version" value="${JALVIEW_VERSION}" />
264 <application_desc main_class="jalview.bin.Jalview">
270 <jnlp toFile="${packageDir}/jalview_1G.jnlp" codebase="${WebStartLocation}">
272 <title>Jalview</title>
273 <vendor>The Barton Group</vendor>
274 <homepage href="http://www.jalview.org" />
275 <description>Jalview Multiple Alignment Editor</description>
276 <description kind="short">Jalview</description>
277 <icon href="logo_big.gif" />
281 <j2se version="${j2sev}" initial_heap_size="128M" max_heap_size="512M" />
282 <fileset dir="${packageDir}">
283 <include name="jalview.jar" />
285 <fileset dir="${packageDir}">
286 <include name="*.jar" />
287 <include name="*_*.jar" />
288 <exclude name="jalview.jar" />
290 <property name="jalview.version" value="${JALVIEW_VERSION}" />
292 <application_desc main_class="jalview.bin.Jalview">
298 <jnlp toFile="${packageDir}/jalview_2G.jnlp" codebase="${WebStartLocation}">
300 <title>Jalview</title>
301 <vendor>The Barton Group</vendor>
302 <homepage href="http://www.jalview.org" />
303 <description>Jalview Multiple Alignment Editor</description>
304 <description kind="short">Jalview</description>
305 <icon href="logo_big.gif" />
309 <j2se version="${j2sev}" initial_heap_size="256M" max_heap_size="1024M" />
310 <fileset dir="${packageDir}">
311 <include name="jalview.jar" />
313 <fileset dir="${packageDir}">
314 <include name="*.jar" />
315 <include name="*_*.jar" />
316 <exclude name="jalview.jar" />
318 <property name="jalview.version" value="${JALVIEW_VERSION}" />
320 <application_desc main_class="jalview.bin.Jalview">
326 <!-- finally, need to postprocess to add in associations at end of 'information' element
328 <xslt in="${packageDir}/jalview_noa_1G.jnlp" out="${packageDir}/jalview_1G.jnlp">
335 <association mime-type="application-x/ext-file" extensions="fa"/>
336 <association mime-type="application-x/ext-file" extensions="fasta"/>
337 <association mime-type="application-x/ext-file" extensions="fastq"/>
338 <association mime-type="application-x/ext-file" extensions="blc"/>
339 <association mime-type="application-x/ext-file" extensions="msf"/>
340 <association mime-type="application-x/ext-file" extensions="pfam"/>
341 <association mime-type="application-x/ext-file" extensions="aln"/>
342 <association mime-type="application-x/ext-file" extensions="pir"/>
343 <association mime-type="application-x/ext-file" extensions="amsa"/>
344 <association mime-type="application-x/ext-file" extensions="stk"/>-->
348 <target name="runenv" depends="init">
349 <path id="run.classpath">
350 <pathelement location="${outputDir}" />
351 <fileset dir="${outputDir}">
352 <include name="${libDir}/*.jar" />
355 <pathconvert targetos="unix" refid="run.classpath" property="run.classpath" />
357 <echo>java -classpath ${run.classpath} jalview.bin.Jalview
361 <target name="buildextclients" depends="init">
362 <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" />
363 <condition property="dontextbuild">
364 <equals arg1="n" arg2="${doextbuild.response}" />
366 <condition property="dontextbuild">
367 <equals arg1="N" arg2="${doextbuild.response}" />
369 <fail if="dontextbuild">
370 Build External Client Code process aborted by user. Jalview source is unchanged.
372 <!-- Currently, this doesn't happen automatically.
373 1. Run WSDL2Java as below, which generates an ext.vamsas +
374 vamsas.<datapackages> fileset.
375 2. refactor ext.vamsas.SpecificserviceWS* to
376 ext.vamsas.ServiceclassWS* that implements the ServiceclassWSI interface.
377 3. Update the jalview.ws.*WServices classes to reflect the
378 interface type, and all locations of this wsdl type that Jalview
382 <path id="axisbuild">
383 <path refid="build.classpath" />
385 <taskdef resource="axis-tasks.properties" classpathref="axisbuild" />
387 <fileset dir="${sourceDir}" id="client">
388 <include name="${wsdl.ClientNS}/*.*" />
392 <axis-wsdl2java output="${sourceDir}" verbose="true" url="${wsdl.MsaWS2}" serverside="false" deployscope="Request" debug="false" helpergen="true" all="true">
394 <mapping namespace="${wsdl.Namespace}" package="${wsdl.ClientNS}" />
395 <mapping namespace="http://dataTypes.vamsas" package="${wsdl.ClientNS}" />
400 <target name="makedist" depends="build, buildPropertiesFile, buildindices">
401 <!-- make the package jar if not already existing -->
402 <mkdir dir="${packageDir}" />
403 <!-- clean dir if it already existed -->
405 <fileset dir="${packageDir}">
406 <include name="*.jar"/>
409 <jar destfile="${packageDir}/${outputJar}">
411 <attribute name="Main-Class" value="jalview.bin.Jalview" />
413 <fileset dir="${outputDir}/">
414 <exclude name="cache*/**" />
415 <exclude name="*.jar" />
416 <exclude name="*.jar.*" />
417 <exclude name="**/*.jar" />
418 <exclude name="**/*.jar.*" />
422 <copy toDir="${packageDir}" flatten="true">
423 <fileset dir="${outputDir}">
424 <include name="*.jar" />
425 <include name="**/*.jar" />
431 <!-- jalopy code reformatter -->
432 <target name="sourcescrub" depends="init,build">
433 <jalopy destdir="jsrc" classpathref="run.classpath" convention="jalview-jalopy.xml">
434 <fileset dir="${sourceDir}">
435 <include name="*.java" />
436 <include name="**/*.java" />
437 <include name="**/**/*.java" />
444 <!-- Compile, package and obfuscate Jalview Applet -->
445 <target name="makeApplet" depends="obfuscate" description="assemble the final jalviewLite applet jar with or without obfuscation"/>
447 <target name="compileApplet" depends="init,clean">
448 <mkdir dir="${outputDir}" />
449 <javac source="1.5" target="1.5" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}"
450 classpathref="jalviewlite.deps" includes="jalview/appletgui/**"
451 excludes="ext/**,MCview/**,org/**,vamsas/**" />
454 <target name="packageApplet" depends="compileApplet, buildPropertiesFile">
455 <copy file="${resourceDir}/images/idwidth.gif" toFile="${outputDir}/images/idwidth.gif" />
456 <copy file="${resourceDir}/images/link.gif" toFile="${outputDir}/images/link.gif" />
457 <jar destfile="in.jar">
459 <attribute name="Main-Class" value="jalview.bin.JalviewLite" />
461 <fileset dir="${outputDir}">
462 <include name="com/**" />
463 <include name="MCview/**" />
464 <include name="jalview/**" />
465 <include name=".build_properties" />
466 <include name="images/idwidth.gif" />
467 <include name="images/link.gif" />
471 <target name="obfuscate" depends="-obfuscatefake,-obfuscatereally">
473 <target name="-obfuscatefake" depends="packageApplet" if="donotobfuscate">
474 <copy file="in.jar" tofile="${jalviewLiteJar}" overwrite="true" />
475 <delete file="in.jar" />
477 <target name="-obfuscatereally" unless="donotobfuscate">
479 <path id="obfuscateDeps.path">
480 <pathelement location="${applet.jre.tools}" />
481 <pathelement location="appletlib/${jmolJar}" />
483 <taskdef resource="proguard/ant/task.properties" classpath="utils/proguard.jar" />
486 <injar file="in.jar" />
487 <outjar file="${jalviewLiteJar}" />
488 <libraryjar refid="obfuscateDeps.path" />
489 <keep access="public" type="class" name="jalview.bin.JalviewLite">
490 <field access="public" />
491 <method access="public" />
492 <constructor access="public" />
494 <!-- -libraryjars "${obfuscateDeps}"
496 -outjars jalviewApplet.jar
497 -keep public class jalview.bin.JalviewLite
500 <delete file="in.jar" />
503 <target name="castorbinding" depends="init" description="Generate Java bindings to supported Jalview XML models.">
504 <taskdef name="castor-srcgen" classname="org.castor.anttask.CastorCodeGenTask" classpathref="build.classpath" />
506 <fileset dir="${sourceDir}/jalview/schemabinding/version2">
507 <include name="*.java" />
508 <include name="descriptors/*.java" />
511 <castor-srcgen file="${schemaDir}/vamsas.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
512 <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
513 <castor-srcgen file="${schemaDir}/JalviewWsParamSet.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
514 <castor-srcgen file="${schemaDir}/jalview.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
516 now build the jalview.binding package with the old schema set
519 <fileset dir="${sourceDir}/jalview/binding/">
520 <include name="**" />
523 <castor-srcgen file="${schemaDir}/vamsasJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
524 <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
525 <castor-srcgen file="${schemaDir}/jalviewJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
527 <target name="sourcedist" description="create jalview source distribution" depends="init">
528 <delete file="${source.dist.name}" />
529 <tar destfile="${source.dist.name}" compression="gzip">
530 <tarfileset dir="./" prefix="jalview" preserveLeadingSlashes="true">
531 <include name="LICENSE" />
532 <include name="README" />
533 <include name="build.xml" />
534 <include name="jalview-jalopy.xml" />
535 <include name="JalviewApplet.jpx" />
536 <include name="JalviewX.jpx" />
537 <include name="nbbuild.xml"/>
538 <include name="nbproject/genfiles.properties"/>
539 <include name="nbproject/project.properties"/>
540 <include name="nbproject/project.xml"/>
541 <include name="${sourceDir}/*.java" />
542 <include name="${sourceDir}/**/*.java" />
543 <include name="${sourceDir}/**/*.cdr" />
544 <include name="${libDir}/**/*" />
545 <include name="${resourceDir}/**/*" />
546 <include name="${helpDir}/**/*" />
547 <include name="appletlib/${jmolJar}" />
548 <exclude name="**/*locales" />
549 <exclude name="*locales/**" />
550 <exclude name="utils/InstallAnywhere/**Build.iap_xml" />
551 <exclude name="utils/InstallAnywhere/**Build*/**" />
552 <exclude name="utils/InstallAnywhere/**Build*/**" />
553 <exclude name="utils/InstallAnywhere/**locale*" />
554 <exclude name="utils/InstallAnywhere/**locale*/**" />
555 <include name="${schemaDir}/**/*" />
556 <include name="utils/**/*" />
557 <include name="${docDir}/**/*" />
558 <include name="examples/**/*" />
562 <target name="pubapplet" description="installs the jalviewLite applet and dependent jars into an applet examples directory built under ${outputDir}" depends="makeApplet">
563 <copy todir="${packageDir}/examples">
564 <fileset dir="examples">
565 <include name="**/*"/>
566 <include name="javascript/*"/>
567 <include name="jmol/*"/>
570 <include name="jalviewApplet.jar"/>
572 <fileset dir="appletlib">
573 <include name="**/*"/>
578 <target name="sourcedoc" description="Create jalview source documentation pages" depends="init">
579 <javadoc destdir="${javadocDir}">
580 <packageset dir="${sourceDir}" includes="jalview/*,MCView/*">