Ant-common.xml

From HaFrWiki42
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.


getos

Called by Calls Variables
local.xml
internal.local.availability
 
  1. isWindoze
  2. isUnix

Gets the operating system and set 1 of the variables to true, the others are false by default.

  <target name="getos">
     <condition property="isWindoze">
        <os family="windows"/>
     </condition>
     <condition property="isUnix">
        <os family="unix"/>
     </condition>
  </target>

internal.show.help

Shows help if the variable cmd.option.help has been set. To set this variable use the command line option -Dcmd.option.help [true|false]. Examples:

  • ant -f build.xml -Dcmd.option.help true
  • ant -f build.xml -Dcmd.option.help false
  <target name="internal.show.cmd.help" if="${cmd.option.help}">
     <echo>--------------- Help Information --------------------------------
     ...
     </echo>
  </target>

internal.show.cmd.options

  <target name="internal.show.cmd.options">
     <echo>--------------- Command line options ----------------------------</echo>
     <echo>help          : Gives help about the usage of the script</echo>
     ...
     <echo>-----------------------------------------------------------------</echo>
  </target>

internal.show.properties

Called by Calls Variables
Template Show
internal.show.cmd.options
 internal.show.cmd.help
 

This routines is called by the user script to show help functionality.

  <target name    = "internal.show.properties"
          depends = "internal.show.cmd.options, internal.show.cmd.help" >
     <echo>--------------- Common Used Properties --------------------------</echo>
     <echo>Common Loc.   : ${build.localxml.loc}</echo>
     <echo>Common Version: ${common.version.number} - ${common.version.date}</echo>
     <echo>Common CR     : ${common.version.copy}</echo>
     <echo>Granularity   : ${copy.granularity}</echo>
     <echo>Last modified : ${copy.preservelastmodified}</echo>
     <echo>--------------- Environment Variables ---------------------------</echo>
     <echo>ANT_HOME      : ${env.ANT_HOME}</echo>
     <echo>ANT_VERSION   : ${env.ANT_VERSION}</echo>
     <echo>CLASSPATH     : ${env.CLASSPATH}</echo>
     <echo>JAVA_HOME     : ${env.JAVA_HOME}</echo>
     <echo>JAVA_VERSION  : ${env.JAVA_VERSION}</echo>
     <echo>User name     : ${env.USERNAME}</echo>
     <echo>Windows root  : ${env.SystemRoot}</echo>
     <echo>Run Date-Time : ${TODAY_NL} (dutch)</echo>
     <echo>-----------------------------------------------------------------</echo>
  </target>

internal.show.sync.properties

internal.test.availability

  <target name="internal.test.availability">
     <propertycopy name="isa.isAvailable" from="${param}.isaDir" />           
  </target>

internal.test.availability.directory

  <target name="internal.test.availability.directory">
     <propertycopy name="ita.isAvailable"  from="${param1}.isaDir" />
     <propertycopy name="ita.srcdir"       from="${param2}.srcdir" />
     <available file="${ita.srcdir}" type="dir" property="ita.isAvailable" />
     <echo>${ita.srcdir} is ${ita.isAvailable}</echo>
  </target>

internal.show.availability

  <target name="internal.show.availability" >
     <propertycopy name="isa.isAvailable" from="${param}.isaDir" />
     <propertycopy name="isa.driveName"   from="${param}.name" />
     <propertycopy name="isa.driveLetter" from="${param}.letter" />
     <if>
       <equals arg1="${isa.isAvailable}" arg2="true" />
       <then>
           <echo>${isa.driveName} : available as ${isa.driveLetter}</echo>
       </then>
       <else>
           <if>
              <equals arg1="${cmd.option.debug}" arg2="true" />
              <then>
                 <echo>${isa.driveName} : NOT available!</echo>
              </then>
           </if>
       </else>
     </if>
  </target>

internal.general.fullcopy.id

Please note the sb.srcname and the sb.dstname are obsolete.

  <target name        = "internal.general.fullcopy.id"
          description = "Generic sync"
          depends     = "initial">
     <propertycopy name="sb.isaDir"      from  = "${param}.isDirSD1"            />
     <propertycopy name="sb.isDirSD1"    from  = "${param}.isDirSD1"            />
     <propertycopy name="sb.isDirSD2"    from  = "${param}.isDirSD2"            />
     <propertycopy name="sb.message"     from  = "${param}.message"             />
     <propertycopy name="sb.srcId"       from  = "${param}.srcId"               />
     <propertycopy name="sb.todir"       from  = "${param}.todir"               />
     <propertycopy name="sb.verbose"     from  = "${param}.verbose"             />
     <property     name="sb.stopwatch"   value = "${common.stopwatch}"          />
     <propertycopy name="sb.target"      from  = "${internal.general.copy.id}"  />
     <property     name="sb.srcname"     value = "lacieB.name"                  />
     <property     name="sb.dstname"     value = "lac1t.name"                   />
     <propertycopy name="sb.show"        from  = "${param}.show"                />
     <if>
        <equals arg1= "${sb.show}" arg2="true" />
     <then>
        <antcall target = "internal.show.fullcopy.id">
           <param name = "param" value="sb" />
        </antcall>
     </then>
     </if>
     <antcall target = "internal.general.prepare.copy">
        <param name = "param" value="sb" />
     </antcall>
  </target>

internal.show.fullcopy.id

  <target name    = "internal.show.fullcopy.id">
     <propertycopy name="isb.isaDir"     from="${param}.isaDir"     />     
     <propertycopy name="isb.isDirSD1"   from="${param}.isDirSD1"   />
     <propertycopy name="isb.isDirSD2"   from="${param}.isDirSD2"   />
     <propertycopy name="isb.message"    from="${param}.message"    />
     <propertycopy name="isb.srcId"      from="${param}.srcId"      />
     <propertycopy name="isb.todir"      from="${param}.todir"      />
     <propertycopy name="isb.verbose"    from="${param}.verbose"    />
     <propertycopy name="isb.stopwatch"  from="${param}.stopwatch"  />
     <propertycopy name="isb.target"     from="${param}.target"     />
     <propertycopy name="isb.srcname"    from="${param}.srcname"    />
     <propertycopy name="isb.dstname"    from="${param}.dstname"    />
     <echo>isb.isaDir        : ${isb.isaDir}</echo>
     <echo>isb.isaDirSD1     : ${isb.isDirSD1}</echo>
     <echo>isb.isaDirSD2     : ${isb.isDirSD2}</echo>
     <echo>isb.message       : ${isb.message}</echo>
     <echo>isb.srcId         : ${isb.srcId}</echo>
     <echo>isb.todir         : ${isb.todir}</echo>
     <echo>isb.verbose       : ${isb.verbose}</echo>
     <echo>isb.stopwatch     : ${isb.stopwatch}</echo>
     <echo>isb.target        : ${isb.target}</echo>
     <echo>isb.srcname       : ${isb.srcname}</echo>
     <echo>isb.dstname       : ${isb.dstname}</echo>
  </target>

internal.general.prepare.copy

  <target name="internal.general.prepare.copy">
     <propertycopy name = "igpc.isaDir"    from="${param}.isaDir"     />
     <propertycopy name = "igpc.isDirSD1"  from="${param}.isDirSD1"   />
     <propertycopy name = "igpc.isDirSD2"  from="${param}.isDirSD2"   />
     <propertycopy name = "igpc.message"   from="${param}.message"    />
     <propertycopy name = "igpc.srcId"     from="${param}.srcId"      />
     <propertycopy name = "igpc.todir"     from="${param}.todir"      />
     <propertycopy name = "igpc.verbose"   from="${param}.verbose"    />
     <propertycopy name = "igpc.stopwatch" from="${param}.stopwatch"  />
     <propertycopy name = "igpc.target"    from="${param}.target"     />
     <propertycopy name = "igpc.srcname"   from="${param}.srcname"    />
     <propertycopy name = "igpc.dstname"   from="${param}.dstname"    />
     <stopwatch name="${igpc.stopwatch}" action="start" />
     <if>
        <equals arg1= "${igpc.isaDir}" arg2="true" />
     <then>
        <antcall target="${igpc.target}" >
           <param name = "param" value = "igpc"/>
        </antcall>
        <stopwatch name="${igpc.stopwatch}" action="elapsed" />
     </then>
     <else>
        <echo>LocalHD (${igpc.srcname}) is not available.</echo>
     </else>
     </if>
     <stopwatch name="${igpc.stopwatch}" action="total" />
  </target>

internal.general.copy.id

  <target name="internal.general.copy.id">
     <propertycopy name="igci.isDir"    from="${param}.isDirSD1" />
     <if>
        <equals arg1="${igci.isDir}" arg2="true"/>
     <then>
        <propertycopy name="igci.message" from="${param}.message" />
        <propertycopy name="igci.srcId"   from="${param}.srcId"   />
        <propertycopy name="igci.todir"   from="${param}.todir" />
        <propertycopy name="igci.message" from="${param}.message" />
        <propertycopy name="igci.verbose" from="${param}.verbose" />
        <echo>${igci.message}</echo>
        <copy todir="${igci.todir}"
              granularity="${copy.granularity}"
              preservelastmodified="${copy.preservelastmodified}"
              verbose="${igci.verbose}">
           <fileset refid="${igci.srcId}"/>
        </copy>        
     </then>
     <else>
        <propertycopy name="igci.todir"   from="${param}.todir" />
        <echo>${igci.todir} is currently not available!</echo>
     </else>
     </if>
  </target>


internal.general.doscmd

Executes a windows command.

<!--
      Executes a doscmd.
      @param.dir     : Path, directory where the cvommand is located
      @param.command : Command to be executed.
   -->
   <target name="internal.general.doscmd"
           description="Executes a command" >
      <echo>${env.windir}\system32</echo>
      <exec dir="${param.dir}"
            executable="cmd"
            failonerror="Errrror" >
         <arg line="${param.command}" />
      </exec>
   </target>

internal.general.java

   <!-- ======================================================= -->
   <!-- Performs the java command FileFind                      -->
   <!-- @param.dir   : Path, directory                          -->
   <!-- @param.filter: Dos filter like *.*                      -->
   <!-- V: 1.0.1.2 - Created                                    -->
   <!-- ======================================================= -->
   <target name="internal.general.java">
      <java classname="com.frielink.nl.filefind.FileFind"
            classpathref="common.general.classpath">
         <arg value="-d" />
         <arg value="${param.dir}" />
         <arg value="-f" />
         <arg value="${param.filter}" />
      </java>
   </target>

timestamp

Called by Calls Variables
local.init,
internal.local.availability
 
  1. TODAY_NL
  2. TODAY_UK

Sets the format of the Date-Time timestamp.

   <!-- ======================================================= -->
   <!-- Tools, Helptasks                                        -->
   <!-- Sets the usage for date and time                        -->
   <!-- ======================================================= -->
   <target name="timestamp"
           description="Sets the the timestamp of this ant-task-execution">
      <tstamp>
         <format property="TODAY_NL" pattern="dd MMM yyyy  HH:mm:ss" locale="nl" />
         <format property="TODAY_UK" pattern="yyyy MM  dd  HH:mm:ss" locale="uk" />
      </tstamp>
   </target>

See also

top

References

top