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 <property name="j2sev" value="1.6+"/>
93 <!-- build directory configuration -->
94 <property name="libDir" value="lib" />
95 <property name="resourceDir" value="resources" />
96 <property name="helpDir" value="help" />
97 <property name="docDir" value="doc" />
98 <property name="sourceDir" value="src" />
99 <property name="schemaDir" value="schemas" />
100 <property name="outputDir" value="classes" />
101 <property name="packageDir" value="dist" />
102 <property name="outputJar" value="jalview.jar" />
103 <!-- Jalview Applet JMol Jar Dependency -->
104 <property name="jmolJar" value="JmolApplet-12.2.4.jar" />
105 <property name="jalviewLiteJar" value="jalviewApplet.jar" />
106 <!-- switch to indicate if we should obfuscate jalviewLite -->
107 <!--<property name="donotobfuscate" value="true"/> -->
109 <!-- Jalview Web Service Clients - see the comments in 'buildextclients' for details -->
110 <property name="wsdl.File" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred?wsdl" />
111 <property name="wsdl.Files" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/vamsas?wsdlFiles" />
112 <property name="wsdl.MsaWS" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/MuscleWS?wsdl" />
113 <property name="wsdl.MsaWS2" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/ClustalWS?wsdl" />
114 <property name="WSInterf" value="MsaWS" />
115 <property name="wsdl.Namespace" value="vamsas" />
116 <property name="wsdl.ClientNS" value="ext.vamsas" />
117 <!-- the class path for building the application -->
118 <path id="build.classpath">
119 <fileset dir="utils">
120 <include name="*.jar" />
121 <include name="**/*.jar" />
123 <fileset dir="${libDir}">
124 <include name="*.jar" />
125 <include name="**/*.jar" />
127 <fileset dir="${java.home}/lib">
128 <include name="plugin.jar"/>
130 <fileset dir="appletlib">
131 <!-- the JmolApplet includes the JmolApplet console and the application javac seems to always try and build all packages
133 <include name="${jmolJar}" />
137 <property name="source.dist.name" value="${basedir}/jalview-src.tar.gz" />
138 <!-- The Location of the java 1.1.8 jdk -->
139 <!--<property name="java118.home" value="C:\Sun\jdk1.1.8" />
141 <property name="java118.home" value="${java.home}" />
142 <!--<property name="applet.jre.tools" value="${java118.home}/lib/classes.zip" />
143 --><!-- jre for 1.4 version -->
144 <property name="applet.jre.tools" value="${java.home}/lib/rt.jar"/>
146 <!-- the classpath for building the 1.1 applet -->
147 <path id="jalviewlite.deps">
148 <fileset dir="${java118.home}">
149 <include name="lib/classes.zip" />
151 <fileset dir="${java.home}/lib">
152 <include name="plugin.jar"/>
154 <pathelement location="appletlib/${jmolJar}" />
156 <!-- default location for outputting javadoc -->
157 <property name="javadocDir" value="${packageDir}/javadoc"/>
161 <taskdef classpath="utils/roxes-ant-tasks-1.2-2004-01-30.jar" resource="com/roxes/tools/ant/taskdefs.properties" />
162 <target name="buildPropertiesFile" depends="init">
163 <tstamp prefix="build">
164 <format property="date" pattern="dd MMMM yyyy" />
166 <properties file="${outputDir}/.build_properties">
168 ---Jalview Build Details---
170 <property name="VERSION" value="${JALVIEW_VERSION}" />
171 <property name="BUILD_DATE" value="${build.date}" />
176 <target name="clean" depends="init">
177 <!-- not efficient yet. -->
178 <delete dir="${outputDir}" includes="*,**/*"/>
181 <target name="distclean" depends="init, clean">
183 <echo message="REMOVING ALL BACKUP/AUTOSAVES!" />
186 <include name="${outputJar}" />
187 <include name="#*#" />
188 <include name="#*.*#" />
189 <include name="**/#*#" />
190 <include name="**/#*.*#" />
191 <include name="*~" />
192 <include name="*.*~" />
193 <include name="**/*~" />
194 <include name="**/*.*~" />
199 <target name="prepare" depends="init">
200 <mkdir dir="${outputDir}" />
201 <copy todir="${outputDir}">
203 <include name="${docDir}/**/*.*" />
204 <include name="${helpDir}/**/*.*" />
205 <include name="${libDir}/*.jar" />
207 <fileset dir="${resourceDir}">
208 <include name="**/*.*" />
213 <target name="build" depends="prepare">
214 <!-- not efficient yet. -->
215 <javac source="1.5" target="1.5" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}" classpathref="build.classpath">
216 <exclude name="jalview/*applet*" />
217 <exclude name="jalview/appletgui/**" />
218 <exclude name="com/stevesoft/**" />
221 <target name="buildindices" depends="init, prepare" unless="help.uptodate">
222 <java classname="com.sun.java.help.search.Indexer" classpathref="build.classpath" fork="true" dir="${outputDir}/${helpDir}">
227 <target name="makefulldist" depends="makedist">
228 <!-- the default keystore details might need to be edited here -->
229 <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false">
231 <fileset dir="${packageDir}">
232 <include name="*.jar" />
235 <taskdef classpathref="build.classpath" resource="com/roxes/tools/ant/taskdefs.properties" />
237 <!-- codebase="http://www.jalview.org/jalview/webstart" -->
238 <!-- href="jalview.jnlp" prevent hard-wired pickup of jnlp in certain javaws versions -->
239 <jnlp toFile="${packageDir}/jalview.jnlp" codebase="${WebStartLocation}">
241 <title>Jalview</title>
242 <vendor>The Barton Group</vendor>
243 <homepage href="http://www.jalview.org" />
244 <description>Jalview Multiple Alignment Editor</description>
245 <description kind="short">Jalview</description>
246 <icon href="JalviewLogo_big.png" />
250 <j2se version="${j2sev}" initial_heap_size="10M" />
251 <fileset dir="${packageDir}">
252 <include name="jalview.jar" />
254 <fileset dir="${packageDir}">
255 <include name="*.jar" />
256 <include name="*_*.jar" />
257 <exclude name="jalview.jar" />
259 <property name="jalview.version" value="${JALVIEW_VERSION}" />
261 <application_desc main_class="jalview.bin.Jalview">
267 <jnlp toFile="${packageDir}/jalview_1G.jnlp" codebase="${WebStartLocation}">
269 <title>Jalview</title>
270 <vendor>The Barton Group</vendor>
271 <homepage href="http://www.jalview.org" />
272 <description>Jalview Multiple Alignment Editor</description>
273 <description kind="short">Jalview</description>
274 <icon href="JalviewLogo_big.png" />
278 <j2se version="${j2sev}" initial_heap_size="128M" max_heap_size="512M" />
279 <fileset dir="${packageDir}">
280 <include name="jalview.jar" />
282 <fileset dir="${packageDir}">
283 <include name="*.jar" />
284 <include name="*_*.jar" />
285 <exclude name="jalview.jar" />
287 <property name="jalview.version" value="${JALVIEW_VERSION}" />
289 <application_desc main_class="jalview.bin.Jalview">
295 <jnlp toFile="${packageDir}/jalview_2G.jnlp" codebase="${WebStartLocation}">
297 <title>Jalview</title>
298 <vendor>The Barton Group</vendor>
299 <homepage href="http://www.jalview.org" />
300 <description>Jalview Multiple Alignment Editor</description>
301 <description kind="short">Jalview</description>
302 <icon href="JalviewLogo_big.png" />
306 <j2se version="${j2sev}" initial_heap_size="256M" max_heap_size="1024M" />
307 <fileset dir="${packageDir}">
308 <include name="jalview.jar" />
310 <fileset dir="${packageDir}">
311 <include name="*.jar" />
312 <include name="*_*.jar" />
313 <exclude name="jalview.jar" />
315 <property name="jalview.version" value="${JALVIEW_VERSION}" />
317 <application_desc main_class="jalview.bin.Jalview">
323 <!-- finally, need to postprocess to add in associations at end of 'information' element
325 <xslt in="${packageDir}/jalview_noa_1G.jnlp" out="${packageDir}/jalview_1G.jnlp">
332 <association mime-type="application-x/ext-file" extensions="fa"/>
333 <association mime-type="application-x/ext-file" extensions="fasta"/>
334 <association mime-type="application-x/ext-file" extensions="fastq"/>
335 <association mime-type="application-x/ext-file" extensions="blc"/>
336 <association mime-type="application-x/ext-file" extensions="msf"/>
337 <association mime-type="application-x/ext-file" extensions="pfam"/>
338 <association mime-type="application-x/ext-file" extensions="aln"/>
339 <association mime-type="application-x/ext-file" extensions="pir"/>
340 <association mime-type="application-x/ext-file" extensions="amsa"/>
341 <association mime-type="application-x/ext-file" extensions="stk"/>-->
345 <target name="runenv" depends="init">
346 <path id="run.classpath">
347 <pathelement location="${outputDir}" />
348 <fileset dir="${outputDir}">
349 <include name="${libDir}/*.jar" />
352 <pathconvert targetos="unix" refid="run.classpath" property="run.classpath" />
354 <echo>java -classpath ${run.classpath} jalview.bin.Jalview
358 <target name="buildextclients" depends="init">
359 <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" />
360 <condition property="dontextbuild">
361 <equals arg1="n" arg2="${doextbuild.response}" />
363 <condition property="dontextbuild">
364 <equals arg1="N" arg2="${doextbuild.response}" />
366 <fail if="dontextbuild">
367 Build External Client Code process aborted by user. Jalview source is unchanged.
369 <!-- Currently, this doesn't happen automatically.
370 1. Run WSDL2Java as below, which generates an ext.vamsas +
371 vamsas.<datapackages> fileset.
372 2. refactor ext.vamsas.SpecificserviceWS* to
373 ext.vamsas.ServiceclassWS* that implements the ServiceclassWSI interface.
374 3. Update the jalview.ws.*WServices classes to reflect the
375 interface type, and all locations of this wsdl type that Jalview
379 <path id="axisbuild">
380 <path refid="build.classpath" />
382 <taskdef resource="axis-tasks.properties" classpathref="axisbuild" />
384 <fileset dir="${sourceDir}" id="client">
385 <include name="${wsdl.ClientNS}/*.*" />
389 <axis-wsdl2java output="${sourceDir}" verbose="true" url="${wsdl.MsaWS2}" serverside="false" deployscope="Request" debug="false" helpergen="true" all="true">
391 <mapping namespace="${wsdl.Namespace}" package="${wsdl.ClientNS}" />
392 <mapping namespace="http://dataTypes.vamsas" package="${wsdl.ClientNS}" />
397 <target name="makedist" depends="build, buildPropertiesFile, buildindices">
398 <!-- make the package jar if not already existing -->
399 <mkdir dir="${packageDir}" />
400 <!-- clean dir if it already existed -->
402 <fileset dir="${packageDir}">
403 <include name="*.jar"/>
406 <jar destfile="${packageDir}/${outputJar}">
408 <attribute name="Main-Class" value="jalview.bin.Jalview" />
410 <fileset dir="${outputDir}/">
411 <exclude name="cache*/**" />
412 <exclude name="*.jar" />
413 <exclude name="*.jar.*" />
414 <exclude name="**/*.jar" />
415 <exclude name="**/*.jar.*" />
419 <copy toDir="${packageDir}" flatten="true">
420 <fileset dir="${outputDir}">
421 <include name="*.jar" />
422 <include name="**/*.jar" />
428 <!-- jalopy code reformatter -->
429 <target name="sourcescrub" depends="init,build">
430 <jalopy destdir="jsrc" classpathref="run.classpath" convention="jalview-jalopy.xml">
431 <fileset dir="${sourceDir}">
432 <include name="*.java" />
433 <include name="**/*.java" />
434 <include name="**/**/*.java" />
441 <!-- Compile, package and obfuscate Jalview Applet -->
442 <target name="makeApplet" depends="obfuscate" description="assemble the final jalviewLite applet jar with or without obfuscation"/>
444 <target name="compileApplet" depends="init,clean">
445 <mkdir dir="${outputDir}" />
446 <javac source="1.5" target="1.5" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}"
447 classpathref="jalviewlite.deps" includes="jalview/appletgui/**"
448 excludes="ext/**,MCview/**,org/**,vamsas/**" />
451 <target name="packageApplet" depends="compileApplet, buildPropertiesFile">
452 <copy file="${resourceDir}/images/idwidth.gif" toFile="${outputDir}/images/idwidth.gif" />
453 <copy file="${resourceDir}/images/link.gif" toFile="${outputDir}/images/link.gif" />
454 <jar destfile="in.jar">
456 <attribute name="Main-Class" value="jalview.bin.JalviewLite" />
458 <fileset dir="${outputDir}">
459 <include name="com/**" />
460 <include name="MCview/**" />
461 <include name="jalview/**" />
462 <include name=".build_properties" />
463 <include name="images/idwidth.gif" />
464 <include name="images/link.gif" />
468 <target name="obfuscate" depends="-obfuscatefake,-obfuscatereally">
470 <target name="-obfuscatefake" depends="packageApplet" if="donotobfuscate">
471 <copy file="in.jar" tofile="${jalviewLiteJar}" overwrite="true" />
472 <delete file="in.jar" />
474 <target name="-obfuscatereally" unless="donotobfuscate">
476 <path id="obfuscateDeps.path">
477 <pathelement location="${applet.jre.tools}" />
478 <pathelement location="appletlib/${jmolJar}" />
480 <taskdef resource="proguard/ant/task.properties" classpath="utils/proguard.jar" />
483 <injar file="in.jar" />
484 <outjar file="${jalviewLiteJar}" />
485 <libraryjar refid="obfuscateDeps.path" />
486 <keep access="public" type="class" name="jalview.bin.JalviewLite">
487 <field access="public" />
488 <method access="public" />
489 <constructor access="public" />
491 <!-- -libraryjars "${obfuscateDeps}"
493 -outjars jalviewApplet.jar
494 -keep public class jalview.bin.JalviewLite
497 <delete file="in.jar" />
500 <target name="castorbinding" depends="init" description="Generate Java bindings to supported Jalview XML models.">
501 <taskdef name="castor-srcgen" classname="org.castor.anttask.CastorCodeGenTask" classpathref="build.classpath" />
503 <fileset dir="${sourceDir}/jalview/schemabinding/version2">
504 <include name="*.java" />
505 <include name="descriptors/*.java" />
508 <castor-srcgen file="${schemaDir}/vamsas.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
509 <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
510 <castor-srcgen file="${schemaDir}/JalviewWsParamSet.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
511 <castor-srcgen file="${schemaDir}/jalview.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
513 now build the jalview.binding package with the old schema set
516 <fileset dir="${sourceDir}/jalview/binding/">
517 <include name="**" />
520 <castor-srcgen file="${schemaDir}/vamsasJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
521 <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
522 <castor-srcgen file="${schemaDir}/jalviewJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
524 <target name="sourcedist" description="create jalview source distribution" depends="init">
525 <delete file="${source.dist.name}" />
526 <tar destfile="${source.dist.name}" compression="gzip">
527 <tarfileset dir="./" prefix="jalview" preserveLeadingSlashes="true">
528 <include name="LICENSE" />
529 <include name="README" />
530 <include name="build.xml" />
531 <include name="jalview-jalopy.xml" />
532 <include name="JalviewApplet.jpx" />
533 <include name="JalviewX.jpx" />
534 <include name="nbbuild.xml"/>
535 <include name="nbproject/genfiles.properties"/>
536 <include name="nbproject/project.properties"/>
537 <include name="nbproject/project.xml"/>
538 <include name="${sourceDir}/*.java" />
539 <include name="${sourceDir}/**/*.java" />
540 <include name="${sourceDir}/**/*.cdr" />
541 <include name="${libDir}/**/*" />
542 <include name="${resourceDir}/**/*" />
543 <include name="${helpDir}/**/*" />
544 <include name="appletlib/${jmolJar}" />
545 <exclude name="**/*locales" />
546 <exclude name="*locales/**" />
547 <exclude name="utils/InstallAnywhere/**Build.iap_xml" />
548 <exclude name="utils/InstallAnywhere/**Build*/**" />
549 <exclude name="utils/InstallAnywhere/**Build*/**" />
550 <exclude name="utils/InstallAnywhere/**locale*" />
551 <exclude name="utils/InstallAnywhere/**locale*/**" />
552 <include name="${schemaDir}/**/*" />
553 <include name="utils/**/*" />
554 <include name="${docDir}/**/*" />
555 <include name="examples/**/*" />
559 <target name="pubapplet" description="installs the jalviewLite applet and dependent jars into an applet examples directory built under ${outputDir}" depends="makeApplet">
560 <copy todir="${packageDir}/examples">
561 <fileset dir="examples">
562 <include name="**/*"/>
563 <include name="javascript/*"/>
564 <include name="jmol/*"/>
567 <include name="jalviewApplet.jar"/>
569 <fileset dir="appletlib">
570 <include name="**/*"/>
575 <target name="sourcedoc" description="Create jalview source documentation pages" depends="init">
576 <javadoc destdir="${javadocDir}">
577 <packageset dir="${sourceDir}" includes="jalview/*,MCView/*">