mev-4.0.01/build_script/ant_build_readme.txt

Code
Comments
Other
Rev Date Author Line
2 26 Feb 07 jari 1 12.17.2004
2 26 Feb 07 jari 2 Ant Build ReadMe
2 26 Feb 07 jari 3
2 26 Feb 07 jari 4
2 26 Feb 07 jari 5 Contents:
2 26 Feb 07 jari 6          *Ant Script for MeV Compilation (Intro, overview)
2 26 Feb 07 jari 7          *About Using build.xml (use of the script)
2 26 Feb 07 jari 8          *Modification/Customization of build.xml (mods for feature or
2 26 Feb 07 jari 9           module development)
2 26 Feb 07 jari 10
2 26 Feb 07 jari 11     
2 26 Feb 07 jari 12
2 26 Feb 07 jari 13 Ant Script for MeV Compilation
2 26 Feb 07 jari 14 ------------------------------
2 26 Feb 07 jari 15
2 26 Feb 07 jari 16 Ant is a java based tools to support the building of java projects in a
2 26 Feb 07 jari 17 controlled manner.  A comprehensive description of Ant, a manual, and Ant
2 26 Feb 07 jari 18 executable and source code is available at: http://ant.apache.org.
2 26 Feb 07 jari 19 Installation instructions are also available at the above site.
2 26 Feb 07 jari 20 Installation of Ant is fairly easy and mostly involves specification
2 26 Feb 07 jari 21 or modification of environment variables as described in the installation
2 26 Feb 07 jari 22 instructions. 
2 26 Feb 07 jari 23
2 26 Feb 07 jari 24 Once installed Ant will use the build.xml file to direct MeV compilation
2 26 Feb 07 jari 25 and jar construction.  Before using build.xml, you will need to update the file
2 26 Feb 07 jari 26 so that the "javac-location" property  refers to a java compiler.
2 26 Feb 07 jari 27
2 26 Feb 07 jari 28
2 26 Feb 07 jari 29
2 26 Feb 07 jari 30 About Using build.xml
2 26 Feb 07 jari 31 ---------------------
2 26 Feb 07 jari 32
2 26 Feb 07 jari 33 build.xml defines Ant 'targets' that can be called to compile MeV.
2 26 Feb 07 jari 34 The building process uses multiple targets but three main targets
2 26 Feb 07 jari 35 can be specified to control the building process.  These commands can
2 26 Feb 07 jari 36 be called on the command line from within the devel/ant_script directory
2 26 Feb 07 jari 37 or from within an IDE with support for Ant.
2 26 Feb 07 jari 38
2 26 Feb 07 jari 39 >ant build-all (or just >ant, since build-all is the default target)
2 26 Feb 07 jari 40
2 26 Feb 07 jari 41 will build the entire code base of MeV and will produce the following
2 26 Feb 07 jari 42 jar files:
2 26 Feb 07 jari 43
2 26 Feb 07 jari 44 1.) mev-util.jar
2 26 Feb 07 jari 45 2.) mev-algorithm-support.jar
2 26 Feb 07 jari 46 3.) mev-gui-support.jar
2 26 Feb 07 jari 47 4.) mev-base.jar
2 26 Feb 07 jari 48
2 26 Feb 07 jari 49 5.) mev-algorithm-impl.jar   //algorithm module implementation jars
2 26 Feb 07 jari 50 6.) mev-algorithm-impl.jar
2 26 Feb 07 jari 51
2 26 Feb 07 jari 52 7.) images.jar     //updates jar of org.tigr.images
2 26 Feb 07 jari 53 8.) dialogHelp.jar //updates jar of mev html help pages
2 26 Feb 07 jari 54
2 26 Feb 07 jari 55
2 26 Feb 07 jari 56 >ant build-base
2 26 Feb 07 jari 57
2 26 Feb 07 jari 58 will produce the six jars that support the module implementations
2 26 Feb 07 jari 59 (jars 1-4, and 7 and 8 above).  These contain utilities, basic mev classes, 
2 26 Feb 07 jari 60 support classes, images, and html help pages.
2 26 Feb 07 jari 61
2 26 Feb 07 jari 62
2 26 Feb 07 jari 63 >ant build-modules
2 26 Feb 07 jari 64
2 26 Feb 07 jari 65 will produce the two jars that contain the module algorithm and
2 26 Feb 07 jari 66 gui implementations (jars 5 and 6 above).  These jar files are the
2 26 Feb 07 jari 67 most likely to be modified when developing a new module.
2 26 Feb 07 jari 68
2 26 Feb 07 jari 69
2 26 Feb 07 jari 70 Note that the output of the script execution can be redireted to
2 26 Feb 07 jari 71 an output file. (e.g. >ant build-all >output_log.txt)
2 26 Feb 07 jari 72
2 26 Feb 07 jari 73 **See mev-jar-readme.txt in devel/devel_docs to see a description
2 26 Feb 07 jari 74 of the contents of the six jar files above.
2 26 Feb 07 jari 75
2 26 Feb 07 jari 76
2 26 Feb 07 jari 77
2 26 Feb 07 jari 78 Modification/Customization of build.xml
2 26 Feb 07 jari 79 ---------------------------------------
2 26 Feb 07 jari 80
2 26 Feb 07 jari 81 To enable inclusion of new analysis modules and features in MeV it
2 26 Feb 07 jari 82 is often necessary to modify build.xml to compile and jar the new
2 26 Feb 07 jari 83 classes.  Use mev-jar-readme.txt to identify which jars should
2 26 Feb 07 jari 84 contain the new classes or packages.  Modifications can be broadly
2 26 Feb 07 jari 85 placed into two main categories, 1.) features and utilities, and
2 26 Feb 07 jari 86 2.) new analysis modules. 
2 26 Feb 07 jari 87
2 26 Feb 07 jari 88
2 26 Feb 07 jari 89 1.) Feature and Utility Enhancements
2 26 Feb 07 jari 90     --------------------------------
2 26 Feb 07 jari 91 For feature enhancements usually the mev-base and/or support jars 
2 26 Feb 07 jari 92 will be the final destination of the new classes.  Within the build.xml
2 26 Feb 07 jari 93 script, roughly the first third contains targets for the compilation
2 26 Feb 07 jari 94 and jar creation of utilities, gui and algorithm support, and mev
2 26 Feb 07 jari 95 package classes.  Each of these targets contains a descriptive comment
2 26 Feb 07 jari 96 listing the packages included in the compilation or build.  If the
2 26 Feb 07 jari 97 work is within an existing package, build.xml might not have to change
2 26 Feb 07 jari 98 to support compilation and jar creation. If the work is in a new package,
2 26 Feb 07 jari 99 the appropriate targets should include the new package.  Be sure to modify
2 26 Feb 07 jari 100 a target for compilation and a target for jar creation.
2 26 Feb 07 jari 101
2 26 Feb 07 jari 102 Here is a sample target with comment used to compile org.tigr.util. 
2 26 Feb 07 jari 103
2 26 Feb 07 jari 104     <!-- TARGET ============================================    
2 26 Feb 07 jari 105            Target Name: util
2 26 Feb 07 jari 106     Depends: init
2 26 Feb 07 jari 107            Target Description: Compiles org/tigr/util and packages below
2 26 Feb 07 jari 108            Compilation Summary:
2 26 Feb 07 jari 109         org/tigr/util
2 26 Feb 07 jari 110         org/tigr/util/awt
2 26 Feb 07 jari 111         org/tigr/util/swing
2 26 Feb 07 jari 112     -->
2 26 Feb 07 jari 113     <target name="util" depends="init">
2 26 Feb 07 jari 114         <javac srcdir="${tigr.dir}/util" destdir="${dest.dir}">
2 26 Feb 07 jari 115       <classpath>
2 26 Feb 07 jari 116                 <pathelement location="${lib.dir}/jai_core.jar"/>
2 26 Feb 07 jari 117                 <pathelement location="${lib.dir}/jai_codec.jar"/>
2 26 Feb 07 jari 118                 <pathelement location="${lib.dir}/images.jar"/>
2 26 Feb 07 jari 119             </classpath>
2 26 Feb 07 jari 120         </javac>
2 26 Feb 07 jari 121     </target>
2 26 Feb 07 jari 122
2 26 Feb 07 jari 123 Note that all packages below org.tigr.util will be compiled.  Some targets
2 26 Feb 07 jari 124 set the sourcepath attribute of the javac task to "" which effectively disables
2 26 Feb 07 jari 125 directory searching for compilation.  In these instances specific classes
2 26 Feb 07 jari 126 or packages to include or exclude within the srcdir will be explicitly specified.
2 26 Feb 07 jari 127
2 26 Feb 07 jari 128
2 26 Feb 07 jari 129
2 26 Feb 07 jari 130 2.) New Analysis Module Development
2 26 Feb 07 jari 131     -------------------------------
2 26 Feb 07 jari 132
2 26 Feb 07 jari 133 Most developers will be primarily concerned with the development and integration
2 26 Feb 07 jari 134 of new analysis modules.  Description of the details of interface implementation
2 26 Feb 07 jari 135 to create a new module is handled elsewhere.  This document will focus on
2 26 Feb 07 jari 136 compilation and jar construction of new modules.
2 26 Feb 07 jari 137
2 26 Feb 07 jari 138 There are three required modifications to build.xml to support compilation and
2 26 Feb 07 jari 139 jar construction of the new module.
2 26 Feb 07 jari 140
2 26 Feb 07 jari 141   1.) Create Targets for Compilation
2 26 Feb 07 jari 142   2.) Include a new module property
2 26 Feb 07 jari 143   3.) Modify the 'algorithm-modules' and 'modules-only' targets to compile
2 26 Feb 07 jari 144       the new targets created in step 1.
2 26 Feb 07 jari 145
2 26 Feb 07 jari 146 1.) Create targets to permit compilation of the module's algorithm class or package
2 26 Feb 07 jari 147 and the corresponding gui.impl package.  This pair of targets will direct compilation
2 26 Feb 07 jari 148 of the new module.  Target pairs for each module are found in the lower half of build.xml.
2 26 Feb 07 jari 149 Creation of a new target pair can be easily done by using an existing target pair as
2 26 Feb 07 jari 150 a template.  The last two targets in the script are generic targets that can be
2 26 Feb 07 jari 151 modified to suite the new module.  Here is an example target pair for the KMC module:
2 26 Feb 07 jari 152
2 26 Feb 07 jari 153     <target name="KMC" depends="KMC-GUI" if="KMC">
2 26 Feb 07 jari 154         <javac sourcepath="" srcdir="${alg.impl.dir}" destdir="${dest.dir}">
2 26 Feb 07 jari 155     <classpath refid="module.build.class.path"/>
2 26 Feb 07 jari 156             <include name="KMC.java"/>
2 26 Feb 07 jari 157     </javac>
2 26 Feb 07 jari 158     <propertyfile file="${alg.properties.file}">
2 26 Feb 07 jari 159             <entry key="KMC" value="org.tigr.microarray.mev.cluster.algorithm.impl.KMC"/>
2 26 Feb 07 jari 160         </propertyfile>
2 26 Feb 07 jari 161     </target>
2 26 Feb 07 jari 162
2 26 Feb 07 jari 163     <target name="KMC-GUI">
2 26 Feb 07 jari 164         <javac srcdir="${gui.impl.dir}/kmc" destdir="${dest.dir}">
2 26 Feb 07 jari 165     <classpath refid="module.build.class.path"/>
2 26 Feb 07 jari 166     </javac>
2 26 Feb 07 jari 167     <propertyfile file="${gui.properties.file}">
2 26 Feb 07 jari 168     <entry key="gui.names" value="KMC:" operation="+"/>
2 26 Feb 07 jari 169             <entry key="KMC.name" value="KMC"/>
2 26 Feb 07 jari 170             <entry key="KMC.class" value="org.tigr.microarray.mev.cluster.gui.impl.kmc.KMCGUI"/>
2 26 Feb 07 jari 171             <entry key="KMC.smallIcon" value="analysis16.gif"/>
2 26 Feb 07 jari 172             <entry key="KMC.largeIcon" value="kmc_button.gif"/>
2 26 Feb 07 jari 173             <entry key="KMC.tooltip" value="k-Means/Medians Clustering"/>
2 26 Feb 07 jari 174         </propertyfile>
2 26 Feb 07 jari 175     </target>
2 26 Feb 07 jari 176
2 26 Feb 07 jari 177 Note that the first target compiles the algorithm while the second target shown above
2 26 Feb 07 jari 178 compiles the supporting gui implementation package.  Note that the first target has the
2 26 Feb 07 jari 179 corresponding gui target in the depends attribute and the target execution (first
2 26 Feb 07 jari 180 target) has a conditional that controls execution of the target.  This 'if' attribute
2 26 Feb 07 jari 181 is evaluated based on the inclusion of the target in the module properties list
2 26 Feb 07 jari 182 in step 2.  Most of the changes to make to these targets involve changing package names,
2 26 Feb 07 jari 183 file paths, and property files entries.  Note that in addition to compilation each module
2 26 Feb 07 jari 184 has associated properties that are entered into a 'factory.properties' file.  These
2 26 Feb 07 jari 185 properties specify algorithm names, gui and algoirthm class names, button icons, and tool tips.
2 26 Feb 07 jari 186
2 26 Feb 07 jari 187
2 26 Feb 07 jari 188 2.) Modify the module selection properties to include the new target.  Near the top
2 26 Feb 07 jari 189 of the script there are elements that list the algorithm targets to include in the build.
2 26 Feb 07 jari 190 Here is a section of this list as an example:
2 26 Feb 07 jari 191
2 26 Feb 07 jari 192     <property name="HCL" value="y"/>
2 26 Feb 07 jari 193     <property name="ST" value="y"/>
2 26 Feb 07 jari 194     <property name="SOTA" value="y"/>
2 26 Feb 07 jari 195 <!--    <property name="RN" value="y"/>  excluded from the build using comment -->
2 26 Feb 07 jari 196     <property name="KMC" value="y"/>
2 26 Feb 07 jari 197
2 26 Feb 07 jari 198 A new property with the new module's target name should be included in this list.
2 26 Feb 07 jari 199 Any module that is commented out will be excluded from the compilation and will be
2 26 Feb 07 jari 200 absent in the MeV distribution.
2 26 Feb 07 jari 201
2 26 Feb 07 jari 202
2 26 Feb 07 jari 203 3.) Modify the 'algorithm-modules' target and the 'modules-only' target to include
2 26 Feb 07 jari 204 a dependency on the new module's compilation targets from step 1.  These two targets
2 26 Feb 07 jari 205 are near the beginning of the script and each has a 'depends' attribute.  One target
2 26 Feb 07 jari 206 is for compilation of only the modules while the other target is for base and 
2 26 Feb 07 jari 207 module compilation.  In both cases the depends attribute contains a list of target
2 26 Feb 07 jari 208 names in the order that they will appear in the MeV interface.  To modify this,
2 26 Feb 07 jari 209 simply insert the target name of the new algorithm compilation target created in step 1.
2 26 Feb 07 jari 210 The list is comma delimited and inclusion of the new target name will place the target
2 26 Feb 07 jari 211 in the target execution tree.
2 26 Feb 07 jari 212
2 26 Feb 07 jari 213 Here is the algorithm-modules target, one of the two targets to modify in step three above.
2 26 Feb 07 jari 214 Note the algorithm list in the depends attribute should be modified to include the new module.
2 26 Feb 07 jari 215
2 26 Feb 07 jari 216     <target name="algorithm-modules" depends="build-base,HCL,ST,SOTA,RN,KMC,KMCS,CAST,QTC,GSH,SOM,FOM,PTM,TTEST,SAM,OWA,TFA,SVM,KNNC,DAM,GDM,PCA,TRN,EASE">
2 26 Feb 07 jari 217     </target>
2 26 Feb 07 jari 218
2 26 Feb 07 jari 219
2 26 Feb 07 jari 220  
2 26 Feb 07 jari 221
2 26 Feb 07 jari 222
2 26 Feb 07 jari 223
2 26 Feb 07 jari 224
2 26 Feb 07 jari 225
2 26 Feb 07 jari 226
2 26 Feb 07 jari 227
2 26 Feb 07 jari 228  
2 26 Feb 07 jari 229
2 26 Feb 07 jari 230
2 26 Feb 07 jari 231