Local.xml 20080129
Jump to navigation
Jump to search
The file below is part of the Ant-templates. A detailed description will be added later.
<?xml version="1.0"?> <!-- = Target/Purpose ============================================= Ant 'local.xml' is an include file for application builds. This Ant file contains the local PC machine settings. Each different machine should have its own local.xml file. Because this Ant file knows the settings it can also call the other include file 'common.xml' which contains global Ant and script settings. So the structure is: +++++++++++++ +++++++++++++ ++++++++++++++ + Ant + + Ant + + Ant + + build.xml + include + local.xml + include + common.xml + +++++++++++++ +++++++++++++ ++++++++++++++ = Requirement ================================================ Since the local.xml has to be found the following requirements has to be satisfied: 1. The local hard disk has to be available as drive C: 2. The C: drive has a directory 'C:/usr/home/script' containing: - local.xml 3. The file local.xml has the properties for the local HD: - localhd.letter - localhd.user 4. The under 3 named file is the place for 'common.xml' If these conditions are not made correctly the script fails (error about the loading of the common.xml). = Contains =================================================== Has all the settings available on this local PC. Assumes the following environment settings - JAVA_HOME - JAVA_VERSION - ANT_HOME - ANT_VERSION = Adding new Drives ========================================== When adding a new drive: - Add the 'drive defininition' Specify the 'letter, name, dpid and user' - Add the 'Availability properties' Specify the isaDir file or directory check - Add the 'Check availability tests' Specify a try catch block for the drive - Add the drive to the 'internal.local.show.drives' target = Targets ==================================================== - local.init Inits the local and common build xml-include files Always call this one first! - internal.local.availability Implementation of all the necessary local availability tests. - avail-windows Sets the windows properties (derived variables) - internal.local.show.properties = Version Information ======================================== Creator : Harm Frielink, November 2007 Modified : 1.0.1.0 - 02 Nov 2007 - Created 1.0.1.1 - 04 Nov 2007 - Added Comment 1.0.2.1 - 05 Nov 2007 - Made the Local and IBM pc version. --> <project name="local"> <!-- ======================================================= --> <!-- Properties for the common build --> <!-- Are definied in common.xml --> <!-- ======================================================= --> <!-- property environment="env" --> <!-- Versioning information --> <property name="local.version.number" value="1.0.3.1" /> <property name="local.version.date" value="29 Jan 2008" /> <property name="local.stopwatch" value="LocalWatch" /> <!-- Drive definitions --> <property name="localhd.letter" value="C:" /> <property name="localhd.name" value="Local HD " /> <property name="localhd.dpid" value="usr/CHICON_HJMF_LOCALHD" /> <property name="localhd.user" value="usr" /> <property name="localhd.dpiddir" value="dir" /> <property name="ibmlhd.letter" value="C:" /> <property name="ibmlhd.name" value="IBM Laptop " /> <property name="ibmlhd.dpid" value="user/IBM_HJMF_2007" /> <property name="ibmlhd.user" value="user" /> <property name="ibmlhd.dpiddir" value="dir" /> <property name="lacie.letter" value="E:" /> <property name="lacie.name" value="LaCie " /> <property name="lacie.dpid" value="usr/LaCie_HJMF" /> <property name="lacie.user" value="usr" /> <property name="lacie.dpiddir" value="dir" /> <property name="usbstick.letter" value="F:" /> <property name="usbstick.name" value="USB Stick " /> <property name="usbstick.dpid" value="usr/SWEEX_HJMF" /> <property name="usbstick.user" value="usr" /> <property name="usbstick.dpiddir" value="dir" /> <property name="alpdata.letter" value="G:" /> <property name="alpdata.name" value="Achmea Data " /> <property name="alpdata.dpid" value="usr/ACHMEA_NET_HJMF" /> <property name="alpdata.user" value="usr" /> <property name="alpdata.dpiddir" value="dir" /> <property name="maxtor.letter" value="H:" /> <property name="maxtor.name" value="DTH Maxtor " /> <property name="maxtor.dpid" value="usr/Maxtor" /> <property name="maxtor.user" value="usr" /> <property name="maxtor.dpiddir" value="dir" /> <property name="lacie2.letter" value="L:" /> <property name="lacie2.name" value="DTH Lacie2 " /> <property name="lacie2.dpid" value="usr/LaCie2_HJMF" /> <property name="lacie2.user" value="usr" /> <property name="lacie2.dpiddir" value="dir" /> <property name="lacieN.letter" value="Z:" /> <property name="lacieN.name" value="LaCie ND " /> <property name="lacieN.dpid" value="usr/LACIE_ND" /> <property name="lacieN.user" value="usr" /> <property name="lacieN.dpiddir" value="dir" /> <!-- ======================================================= --> <!-- Imports the common.xml file containing: --> <!-- - Antcontrib taskdef --> <!-- - getos, internet.test.availability, and more... --> <!-- ======================================================= --> <import file="${localhd.letter}/${localhd.user}/home/script/common.xml" /> <!-- ======================================================= --> <!-- Availability properties --> <!-- Sets property for Local HD on C, Lacy RHD on E and --> <!-- USB Stick on F, Achmea drives --> <!-- IBM Laptop on C --> <!-- NB.: Availability targets sets the isaDir as variable --> <!-- ======================================================= --> <available property="localhd.isaDir" file="${localhd.letter}/${localhd.dpid}" type="${localhd.dpiddir}" /> <available property="lacie.isaDir" file="${lacie.letter}/${lacie.dpid}" type="${lacie.dpiddir}" /> <available property="usbstick.isaDir" file="${usbstick.letter}/${usbstick.dpid}" type="${usbstick.dpiddir}" /> <available property="alpdata.isaDir" file="${alpdata.letter}/${alpdata.dpid}" type="${alpdata.dpiddir}" /> <available property="ibmlhd.isaDir" file="${ibmlhd.letter}/${ibmlhd.dpid}" type="${ibmlhd.dpiddir}" /> <available property="maxtor.isaDir" file="${maxtor.letter}/${maxtor.dpid}" type="${maxtor.dpiddir}" /> <available property="lacie2.isaDir" file="${lacie2.letter}/${lacie2.dpid}" type="${lacie2.dpiddir}" /> <available property="lacieN.isaDir" file="${lacieN.letter}/${lacieN.dpid}" type="${lacieN.dpiddir}" /> <!-- ======================================================= --> <!-- Inital 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> <!-- ======================================================= --> <!-- Sets the availability variables by checking the --> <!-- availability-tests --> <!-- ======================================================= --> <target name = "internal.local.availability" depends = "timestamp, getos, avail-windows" 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> <trycatch> <try> <antcall target="internal.test.availability"> <param name="param" value="localhd"/> </antcall> </try> <catch> <property name="localhd.isaDir" value="false"/> </catch> </trycatch> <trycatch> <try> <antcall target="internal.test.availability"> <param name="param" value="usbstick"/> </antcall> </try> <catch> <property name="usbstick.isaDir" value="false"/> </catch> </trycatch> <trycatch> <try> <antcall target="internal.test.availability"> <param name="param" value="alpdata"/> </antcall> </try> <catch> <property name="alpdata.isaDir" value="false"/> </catch> </trycatch> <trycatch> <try> <antcall target="internal.test.availability"> <param name="param" value="ibmlhd"/> </antcall> </try> <catch> <property name="ibmlhd.isaDir" value="false"/> </catch> </trycatch> <trycatch> <try> <antcall target="internal.test.availability"> <param name="param" value="maxtor"/> </antcall> </try> <catch> <property name="maxtor.isaDir" value="false"/> <echo>catched error</echo> </catch> </trycatch> <trycatch> <try> <antcall target="internal.test.availability"> <param name="param" value="lacie2"/> </antcall> </try> <catch> <property name="lacie2.isaDir" value="false"/> </catch> </trycatch> <trycatch> <try> <antcall target="internal.test.availability"> <param name="param" value="lacieN"/> </antcall> </try> <catch> <property name="lacieN.isaDir" value="false"/> </catch> </trycatch> </target> <!-- ======================================================= --> <!-- Sets the windows property found variables --> <!-- ======================================================= --> <target name="avail-windows" if="isWindoze" > <!-- <echo message="Checks for Windows (${env.JAVA_HOME}/bin/java.exe)" /> --> <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> <!-- ======================================================= --> <!-- Shows the internal used properties. --> <!-- Calls the internal.local.show.drives --> <!-- ======================================================= --> <target name="internal.local.show.properties"> <echo>--------------- Local Used Properties ---------------------------</echo> <echo>Local Version : ${local.version.number} - ${local.version.date}</echo> <antcall target="internal.local.show.drives" /> </target> <!-- ======================================================= --> <!-- Shows the status of all internal defined drives. --> <!-- Is called by the 'internal.local.show.properties'. --> <!-- ======================================================= --> <target name="internal.local.show.drives" > <antcall target="internal.show.availability" > <param name="param" value="localhd" /> </antcall> <antcall target="internal.show.availability" > <param name="param" value="ibmlhd" /> </antcall> <antcall target="internal.show.availability" > <param name="param" value="lacie" /> </antcall> <antcall target="internal.show.availability" > <param name="param" value="usbstick" /> </antcall> <antcall target="internal.show.availability" > <param name="param" value="alpdata" /> </antcall> <antcall target="internal.show.availability" > <param name="param" value="maxtor" /> </antcall> <antcall target="internal.show.availability" > <param name="param" value="lacie2" /> </antcall> <antcall target="internal.show.availability" > <param name="param" value="lacieN" /> </antcall> </target> </project>
See also
- Ant template
- build.xml, the template build file
- common.xml, the generic code file.