Changes between Version 11 and Version 12 of AppBuilding


Ignore:
Timestamp:
Dec 31, 1969, 4:35:47 PM (55 years ago)
Author:
Kevin Milner
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AppBuilding

    v11 v12  
    11= Application Building =
    22[[PageOutline]]
    3 ''This page describes how to build single applications. For official release and nightly build information/procedures, see [wiki:BuildProcess Automated Build Process]''
    4 ''For detailed documentation on each build file, see [wiki:BuildFiles Important Build Files]
     3''This page describes how to build single applications. For official release and nightly build information/procedures, see [wiki:BuildProcess Automated Build Process]. For detailed documentation on each build file, see [wiki:BuildFiles Important Build Files]''
    54
    65OpenSHA uses [http://ant.apache.org/ Apache Ant] to automate the build process.
    76
    8 All ant build scripts are located in the [source:trunk/ant ant] directory.
    9 
    10 == Important Files ==
    11 
    12 === [source:trunk/ant/build.xml build.xml] ===
    13 Common build functions, including project building (building the entire project in your working directory, not creating jars) are loacted in this file. This file is also used by other build files to avoid duplication.
    14 ==== Important Targets ====
    15 * build (default) - builds the entire project to the "classes" directory (unless the "build" property is overridden)
    16 * compile - compiles all .java files into the "classes.temp" directory (specified by the "tmpdest" property) as part of the build process.
    17 * resource.* - targets for copying resources to the output directory
    18   * resource.erfs.main - copies resources for main ERFs included in applications
    19   * resource.erfs.dev - This is for ERFs that we won't include in our regular apps because they are underdevelopment
    20   * resource.erfs.gem - This is for the GEM ERFs...which we may or may not include in our regular apps.
    21   * resource.erfs.aux - This is for ERFs that we won't include in our regular apps because they require too much data, but may be useful to someone.
    22   * resource.imrs - This resources required IMR files
    23   * resource.misc.required - This copies all of the other misc files that are required by most applications
    24   * resource.all - This calls all of the other resource targets to resource absolutely everything
    25   * resource.hazard.apps - This calls other resource targets for local mode hazard applications
    26   * resource.hazard.apps.server - This calls other resource targets for server mode hazard applications (leaves out ERF data)
    27 * unjar.libs.common - Expands select jars from the [source:lib lib] dir into the output dir
    28 * rmi.* - tasks for compiling RMI classes using the [http://ant.apache.org/manual/Tasks/rmic.html Rmic Task]
    29 * javadoc - generate JavaDocs for the entire project
    30 === [source:trunk/ant/CompleteJar.xml CompleteJar.xml] ===
    31 Creates single jar distributions.
    32 ==== Important Targets ====
    33 * jar.full.dist - Builds a jar with all classes and resources.
    34 * jar.classes.only - Builds a jar with all classes but no resources.
    35 === [source:trunk/ant/AppBuilder.xml AppBuilder.xml] ===
    36 This is the core app building file. This will build a jar for a single application. It '''should not be run directly''', however. It should be run by a separate build file, with the following properties set:
    37 ==== Properties that must be set ====
    38  * app.short.name - '''(required)''' The "short" name for the application (should not contain spaces/special characters).
    39    * ''example:'' !HazardCurveLocal
    40  * app.main.class - '''(required)''' The Java main class for the application.
    41    * ''example:'' org.opensha.sha.gui.!HazardCurveLocalModeApplication
    42  * javac.includes - '''''(recommended)''''' The javac includes for the application. Multiple patterns/files can be comma separated. If omitted, all .java files will be compiled. See "includes" for the [http://ant.apache.org/manual/Tasks/javac.html Javac Ant Task] for more information.
    43    * ''example:'' org/opensha/sha/gui/!HazardCurveLocalModeApplication.java
    44    * ''example:'' org/opensha/sha/gui/!HazardCurveLocalModeApplication.java,org/opensha/imr/!**/*.java
    45  * javac.excludes - ''(optional)'' The javac excludes for the application. Multiple patterns/files can be comma separated. See "excludes" for the [http://ant.apache.org/manual/Tasks/javac.html Javac Ant Task] for more information.
    46    * ''example:'' org/opensha/sra/**'
    47  * resource.target - '''''(recommended)''''' The target from [source:trunk/ant/build.xml build.xml] that should be executed to copy resources for this application.
    48    * ''example:'' resource.hazard.apps
    49    * ''example:'' resource.hazard.apps.server
    50    * ''example:'' resource.misc.required
    51  * rmi.target - ''(optional)'' The target from [source:trunk/ant/build.xml build.xml] that should be executed to compile RMI classes. Only required for RMI (remote) applications.
    52    * ''example:'' rmi.hazard.curve
    53 === [source:trunk/ant/MultiAppBuilder.xml MultiAppBuilder.xml] ===
    54 This file is used to actually build the application jar files. It contains targets which call [source:trunk/ant/AppBuilder.xml AppBuilder.xml] for each application.
    55 ==== Important Targets ====
    56 * build.nightly - '''Should not be run by end users''', for more information see BuildProcess
    57 * build.dist - '''Should not be run by end users''', for more information see BuildProcess
    58 * build.all - Build all standard local and remote applications
    59 * build.local - Build only local applications
    60 * build.server - Build only remote (RMI) applications
    61 * build.(APP NAME) - build a single application
    62 ==== Example ====
    63 {{{
    64 <target name="build.hc.local">
    65         <ant antfile="${app.build.file}" target="build.app">
    66                 <property name="app.short.name" value="HazardCurveLocal" />
    67                 <property name="app.main.class" value="${sha.gui.package}.HazardCurveLocalModeApplication" />
    68                 <property name="javac.includes"     value="${sha.gui.dir}/HazardCurveLocalModeApplication.java" />
    69                 <property name="javac.excludes" value="" />
    70                 <property name="rmi.target" value="rmi.hazard.curve" />
    71                 <property name="resource.target" value="resource.hazard.apps" />
    72         </ant>
    73 </target>
    74 }}}
    75 == Building Applications ==
    76 === Using Eclipse ===
     7== Using Eclipse ==
    778To build an application using eclipse, open [source:trunk/ant/MultiAppBuilder.xml ant/MultiAppBuilder.xml] inside eclipse. If you don't see the "Outline" view (usually on the right side of your eclipse workspace), first make sure you're in the Java perspective. If it still doesn't show up, go to Window -> Show View -> Outline.
    789
     
    8213* build.atten.rel - for the Attenuation Relationship Plotter Application
    8314
    84 Right click on the task, and select "Run As -> Ant Build". Progress will be shown in the console window.
     15Right click on the task, and select "Run As -> Ant Build". Progress will be shown in the console window. Resulting jar files will be stored in the "dist" folder.
     16
     17== On the Unix/Linux/Mac OS-X command line ==
     18 
     19In a terminal, navigate to the "ant" directory. The script [source:ant/runAnt.sh runAnt.sh] can be used to build applications. First make sure that you have ant installed and in your path:
     20
     21{{{
     22[1:opensha] ~: ant -version
     23Apache Ant version 1.7.0 compiled on December 13 2006
     24}}}
     25
     26The usage for the runAnt.sh script is: ./runAnt.sh [buildFile [target]]
     27
     28If you run it without any arguments, it will use the [source:ant/build.xml build.xml] build file with the default target. If you want to build a specific application, here is the syntax:
     29
     30{{{
     31./runAnt.sh MultiAppBuilder.xml build.(APP NAME)
     32}}}
     33
     34For example, to build the Hazard Curve Local Mode Application:
     35
     36{{{
     37./runAnt.sh MultiAppBuilder.xml build.hc.local
     38}}}
     39
     40Or, to build all local mode applications:
     41
     42{{{
     43./runAnt.sh MultiAppBuilder.xml build.local
     44}}}
     45
     46See [wiki:BuildFiles Important Build Files#MultiAppBuilder.xml] for a list of more application build targets.