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 <copy todir="${packageDir}">
236 <fileset dir="${resourceDir}/images">
237 <include name="JalviewLogo_big.png"/>
241 <taskdef classpathref="build.classpath" resource="com/roxes/tools/ant/taskdefs.properties" />
243 <!-- codebase="http://www.jalview.org/jalview/webstart" -->
244 <!-- href="jalview.jnlp" prevent hard-wired pickup of jnlp in certain javaws versions -->
245 <jnlp toFile="${packageDir}/jalview.jnlp" codebase="${WebStartLocation}">
247 <title>Jalview</title>
248 <vendor>The Barton Group</vendor>
249 <homepage href="http://www.jalview.org" />
250 <description>Jalview Multiple Alignment Editor</description>
251 <description kind="short">Jalview</description>
252 <icon href="JalviewLogo_big.png" />
256 <j2se version="${j2sev}" initial_heap_size="10M" />
257 <fileset dir="${packageDir}">
258 <include name="jalview.jar" />
260 <fileset dir="${packageDir}">
261 <include name="*.jar" />
262 <include name="*_*.jar" />
263 <exclude name="jalview.jar" />
265 <property name="jalview.version" value="${JALVIEW_VERSION}" />
267 <application_desc main_class="jalview.bin.Jalview">
273 <jnlp toFile="${packageDir}/jalview_1G.jnlp" codebase="${WebStartLocation}">
275 <title>Jalview</title>
276 <vendor>The Barton Group</vendor>
277 <homepage href="http://www.jalview.org" />
278 <description>Jalview Multiple Alignment Editor</description>
279 <description kind="short">Jalview</description>
280 <icon href="JalviewLogo_big.png" />
284 <j2se version="${j2sev}" initial_heap_size="128M" max_heap_size="512M" />
285 <fileset dir="${packageDir}">
286 <include name="jalview.jar" />
288 <fileset dir="${packageDir}">
289 <include name="*.jar" />
290 <include name="*_*.jar" />
291 <exclude name="jalview.jar" />
293 <property name="jalview.version" value="${JALVIEW_VERSION}" />
295 <application_desc main_class="jalview.bin.Jalview">
301 <jnlp toFile="${packageDir}/jalview_2G.jnlp" codebase="${WebStartLocation}">
303 <title>Jalview</title>
304 <vendor>The Barton Group</vendor>
305 <homepage href="http://www.jalview.org" />
306 <description>Jalview Multiple Alignment Editor</description>
307 <description kind="short">Jalview</description>
308 <icon href="JalviewLogo_big.png" />
312 <j2se version="${j2sev}" initial_heap_size="256M" max_heap_size="1024M" />
313 <fileset dir="${packageDir}">
314 <include name="jalview.jar" />
316 <fileset dir="${packageDir}">
317 <include name="*.jar" />
318 <include name="*_*.jar" />
319 <exclude name="jalview.jar" />
321 <property name="jalview.version" value="${JALVIEW_VERSION}" />
323 <application_desc main_class="jalview.bin.Jalview">
329 <!-- finally, need to postprocess to add in associations at end of 'information' element
331 <xslt in="${packageDir}/jalview_noa_1G.jnlp" out="${packageDir}/jalview_1G.jnlp">
338 <association mime-type="application-x/ext-file" extensions="fa"/>
339 <association mime-type="application-x/ext-file" extensions="fasta"/>
340 <association mime-type="application-x/ext-file" extensions="fastq"/>
341 <association mime-type="application-x/ext-file" extensions="blc"/>
342 <association mime-type="application-x/ext-file" extensions="msf"/>
343 <association mime-type="application-x/ext-file" extensions="pfam"/>
344 <association mime-type="application-x/ext-file" extensions="aln"/>
345 <association mime-type="application-x/ext-file" extensions="pir"/>
346 <association mime-type="application-x/ext-file" extensions="amsa"/>
347 <association mime-type="application-x/ext-file" extensions="stk"/>
348 <association mime-type="application-x/ext-file" extensions="jar"/>-->
352 <target name="runenv" depends="init">
353 <path id="run.classpath">
354 <pathelement location="${outputDir}" />
355 <fileset dir="${outputDir}">
356 <include name="${libDir}/*.jar" />
359 <pathconvert targetos="unix" refid="run.classpath" property="run.classpath" />
361 <echo>java -classpath ${run.classpath} jalview.bin.Jalview
365 <target name="buildextclients" depends="init">
366 <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" />
367 <condition property="dontextbuild">
368 <equals arg1="n" arg2="${doextbuild.response}" />
370 <condition property="dontextbuild">
371 <equals arg1="N" arg2="${doextbuild.response}" />
373 <fail if="dontextbuild">
374 Build External Client Code process aborted by user. Jalview source is unchanged.
376 <!-- Currently, this doesn't happen automatically.
377 1. Run WSDL2Java as below, which generates an ext.vamsas +
378 vamsas.<datapackages> fileset.
379 2. refactor ext.vamsas.SpecificserviceWS* to
380 ext.vamsas.ServiceclassWS* that implements the ServiceclassWSI interface.
381 3. Update the jalview.ws.*WServices classes to reflect the
382 interface type, and all locations of this wsdl type that Jalview
386 <path id="axisbuild">
387 <path refid="build.classpath" />
389 <taskdef resource="axis-tasks.properties" classpathref="axisbuild" />
391 <fileset dir="${sourceDir}" id="client">
392 <include name="${wsdl.ClientNS}/*.*" />
396 <axis-wsdl2java output="${sourceDir}" verbose="true" url="${wsdl.MsaWS2}" serverside="false" deployscope="Request" debug="false" helpergen="true" all="true">
398 <mapping namespace="${wsdl.Namespace}" package="${wsdl.ClientNS}" />
399 <mapping namespace="http://dataTypes.vamsas" package="${wsdl.ClientNS}" />
404 <target name="makedist" depends="build, buildPropertiesFile, buildindices">
405 <!-- make the package jar if not already existing -->
406 <mkdir dir="${packageDir}" />
407 <!-- clean dir if it already existed -->
409 <fileset dir="${packageDir}">
410 <include name="*.jar"/>
413 <jar destfile="${packageDir}/${outputJar}">
415 <attribute name="Main-Class" value="jalview.bin.Jalview" />
417 <fileset dir="${outputDir}/">
418 <exclude name="cache*/**" />
419 <exclude name="*.jar" />
420 <exclude name="*.jar.*" />
421 <exclude name="**/*.jar" />
422 <exclude name="**/*.jar.*" />
426 <copy toDir="${packageDir}" flatten="true">
427 <fileset dir="${outputDir}">
428 <include name="*.jar" />
429 <include name="**/*.jar" />
435 <!-- jalopy code reformatter -->
436 <target name="sourcescrub" depends="init,build">
437 <jalopy destdir="jsrc" classpathref="run.classpath" convention="jalview-jalopy.xml">
438 <fileset dir="${sourceDir}">
439 <include name="*.java" />
440 <include name="**/*.java" />
441 <include name="**/**/*.java" />
448 <!-- Compile, package and obfuscate Jalview Applet -->
449 <target name="makeApplet" depends="obfuscate" description="assemble the final jalviewLite applet jar with or without obfuscation"/>
451 <target name="compileApplet" depends="init,clean">
452 <mkdir dir="${outputDir}" />
453 <javac source="1.5" target="1.5" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}"
454 classpathref="jalviewlite.deps" includes="jalview/appletgui/**"
455 excludes="ext/**,MCview/**,org/**,vamsas/**" />
458 <target name="packageApplet" depends="compileApplet, buildPropertiesFile">
459 <copy file="${resourceDir}/images/idwidth.gif" toFile="${outputDir}/images/idwidth.gif" />
460 <copy file="${resourceDir}/images/link.gif" toFile="${outputDir}/images/link.gif" />
461 <jar destfile="in.jar">
463 <attribute name="Main-Class" value="jalview.bin.JalviewLite" />
465 <fileset dir="${outputDir}">
466 <include name="com/**" />
467 <include name="MCview/**" />
468 <include name="jalview/**" />
469 <include name=".build_properties" />
470 <include name="images/idwidth.gif" />
471 <include name="images/link.gif" />
475 <target name="obfuscate" depends="-obfuscatefake,-obfuscatereally">
477 <target name="-obfuscatefake" depends="packageApplet" if="donotobfuscate">
478 <copy file="in.jar" tofile="${jalviewLiteJar}" overwrite="true" />
479 <delete file="in.jar" />
481 <target name="-obfuscatereally" unless="donotobfuscate">
483 <path id="obfuscateDeps.path">
484 <pathelement location="${applet.jre.tools}" />
485 <pathelement location="appletlib/${jmolJar}" />
487 <taskdef resource="proguard/ant/task.properties" classpath="utils/proguard.jar" />
490 <injar file="in.jar" />
491 <outjar file="${jalviewLiteJar}" />
492 <libraryjar refid="obfuscateDeps.path" />
493 <keep access="public" type="class" name="jalview.bin.JalviewLite">
494 <field access="public" />
495 <method access="public" />
496 <constructor access="public" />
498 <!-- -libraryjars "${obfuscateDeps}"
500 -outjars jalviewApplet.jar
501 -keep public class jalview.bin.JalviewLite
504 <delete file="in.jar" />
507 <target name="castorbinding" depends="init" description="Generate Java bindings to supported Jalview XML models.">
508 <taskdef name="castor-srcgen" classname="org.castor.anttask.CastorCodeGenTask" classpathref="build.classpath" />
510 <fileset dir="${sourceDir}/jalview/schemabinding/version2">
511 <include name="*.java" />
512 <include name="descriptors/*.java" />
515 <castor-srcgen file="${schemaDir}/vamsas.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
516 <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
517 <castor-srcgen file="${schemaDir}/JalviewWsParamSet.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
518 <castor-srcgen file="${schemaDir}/jalview.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
520 now build the jalview.binding package with the old schema set
523 <fileset dir="${sourceDir}/jalview/binding/">
524 <include name="**" />
527 <castor-srcgen file="${schemaDir}/vamsasJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
528 <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
529 <castor-srcgen file="${schemaDir}/jalviewJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
531 <target name="sourcedist" description="create jalview source distribution" depends="init">
532 <delete file="${source.dist.name}" />
533 <tar destfile="${source.dist.name}" compression="gzip">
534 <tarfileset dir="./" prefix="jalview" preserveLeadingSlashes="true">
535 <include name="LICENSE" />
536 <include name="README" />
537 <include name="build.xml" />
538 <include name="jalview-jalopy.xml" />
539 <include name="JalviewApplet.jpx" />
540 <include name="JalviewX.jpx" />
541 <include name="nbbuild.xml"/>
542 <include name="nbproject/genfiles.properties"/>
543 <include name="nbproject/project.properties"/>
544 <include name="nbproject/project.xml"/>
545 <include name="${sourceDir}/*.java" />
546 <include name="${sourceDir}/**/*.java" />
547 <include name="${sourceDir}/**/*.cdr" />
548 <include name="${libDir}/**/*" />
549 <include name="${resourceDir}/**/*" />
550 <include name="${helpDir}/**/*" />
551 <include name="appletlib/${jmolJar}" />
552 <exclude name="**/*locales" />
553 <exclude name="*locales/**" />
554 <exclude name="utils/InstallAnywhere/**Build.iap_xml" />
555 <exclude name="utils/InstallAnywhere/**Build*/**" />
556 <exclude name="utils/InstallAnywhere/**Build*/**" />
557 <exclude name="utils/InstallAnywhere/**locale*" />
558 <exclude name="utils/InstallAnywhere/**locale*/**" />
559 <include name="${schemaDir}/**/*" />
560 <include name="utils/**/*" />
561 <include name="${docDir}/**/*" />
562 <include name="examples/**/*" />
566 <target name="pubapplet" description="installs the jalviewLite applet and dependent jars into an applet examples directory built under ${outputDir}" depends="makeApplet">
567 <copy todir="${packageDir}/examples">
568 <fileset dir="examples">
569 <include name="**/*"/>
570 <include name="javascript/*"/>
571 <include name="jmol/*"/>
574 <include name="jalviewApplet.jar"/>
576 <fileset dir="appletlib">
577 <include name="**/*"/>
582 <target name="sourcedoc" description="Create jalview source documentation pages" depends="init">
583 <javadoc destdir="${javadocDir}">
584 <packageset dir="${sourceDir}" includes="jalview/*,MCView/*">