Ant-local.xml

From HaFrWiki42
Jump to navigation Jump to search

This page describes the local.xml file. The order of the different parts (although not necessary in an ANT-script) are equivalent with my own local.xml.

version information

The versioning information is shown in the internal.local.show.properties.

   <!-- Versioning information -->
   <property name="local.version.number"  value="X.X.X.X"        />
   <property name="local.version.date"    value="dd MMM YYYY"    />

   <property name="local.version.copy"    value="HJMF 2000-2010" />
   <property name="local.stopwatch"       value="LocalWatch"     />

drive definitions

This part is in detail described in Ant template Drive availability.
Examples of the structure are:

   <!-- This is a windows example -->
   <property name="localhd.letter"        value="C:" />
   <property name="localhd.name"          value="Packard Bell "  />
   <property name="localhd.dpid"          value="usr/PB_LOCALHD" />
   <property name="localhd.user"          value="usr" />
   <property name="localhd.dpiddir"       value="dir"        />

   <!-- This is a unix example -->
   <property name="lacieBm.letter"        value="/Volumes/HFShare" />
   <property name="lacieBm.name"          value="LaCie ND2BMac"   />
   <property name="lacieBm.dpid"          value="Volumes/HFShare/usr/LACIE_ND2B"/>
   <property name="lacieBm.user"          value="usr"           />
   <property name="lacieBm.dpiddir"       value="dir"           />

available properties

The available properties combine the settings from drive definitions with the 'isaDir property.
This is very important for the availability of the device in the current platform ANT is running.
Please note the similar names with the drive definitions. In this case:

  • localhd: Windows example
  • lacieBm: Linux/Unix/Mac example
   <!-- ======================================================= -->
   <!-- Availability properties                                 -->
   <!-- Sets property for Local HD on C, etc                    -->
   <!-- USB Stick on F, etc                                     -->
   <!-- NB.: Availability targets sets the isaDir as variable   -->
   <!-- ======================================================= -->
   <available property="localhd.isaDir"  file="${localhd.letter}/${localhd.dpid}"   type="${localhd.dpiddir}"  />
   ...
   <available property="lacieBm.isaDir"  file="/${lacieBm.dpid}"                    type="${lacieBm.dpiddir}"  />

avail-windows

Called by Calls Variables
local.xml
internal.local.availability
 
  1. java.home.found
  2. jmx.home.found
  3. jmxr.home.found

Is executed only if the isWindoze property has been set to true.

  <target name="avail-windows" if="isWindoze" >
     <available file="${env.JAVA_HOME}/bin/java.exe"      property="java.home.found" />
     <available file="${env.JMX_HOME_LIB}/jmxri.jar"      property="jmx.home.found"  />
     <available file="${env.JMXR_HOME_LIB}/jmxremote.jar" property="jmxr.home.found"  />
  </target>

avail-unix

Called by Calls Variables
local.xml
internal.local.availability
 
  1. java.home.found

Is executed only if the isUnix property has been set to true.

  <target name="avail-unix" if="isUnix">
     <available file="/usr/bin/java"                   property="java.home.found" />
  </target>

local.init

This target is the starting point for the coupling between the user and the local and common xmlscripts.

  • Called by: ABF or build.xml from the user. See Init of the template.
  • Calls: local.init of local.xml.
   <!-- ======================================================= -->
   <!-- Initial tasks. Always call this tasks before any other  -->
   <!-- The user build.xml should include a dependency for this -->
   <!-- task                                                    -->
   <!-- ======================================================= -->
   <target name    = "local.init"
           depends = "internal.local.availability, timestamp">
   </target>

internal.local.availability

Called by Calls Variables
local.xml
Local init
timestamp,
getos,
avail-windows,
avail-unix
xxx.isaDir props.

Implements the necessary local availability tests for the hardware available on the system/network/local machine. This target uses try catch blocks for all the structures of external devices defined in drive definitions.
Called by the dependency in local.init

  <target name       = "internal.local.availability"
          depends    = "timestamp, getos, avail-windows, avail-unix"
          description= "Checks availability of required builds/jars, aborts if wrong!">
     <fail unless="java.home.found"  message="No JAVA_HOME specified or wrong!"  />
     <trycatch>
        <try>
           <antcall target="internal.test.availability">
              <param name="param"  value="lacie"/>
           </antcall>
        </try>
        <catch>
           <property name="lacie.isaDir" value="false"/>
        </catch>
     </trycatch> 
    
  </target>

See also

top

References

top