ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniels, Doug" <>
Subject RE: how can i find out about out of date non-java files?
Date Fri, 09 Apr 2004 13:40:33 GMT
The <dependset> task lets you compare a set of files to see if they're out of date with
another set of files. (dependset

You can also use the <uptodate> (
task to perform slightly more complex dependency checking such as, seeing if a jar file is
out of date with multiple class files. Or seeing if a set of generated java files are out
of date with an IDL file. What uptodate does is it sets a property if the files are uptodate,
you can then use that property as a condition (<target name="foo" unless="condition">,
or <target name="foo" if="conditon">, or the <if><then> ant-contrib tasks for a target to perform a certain action for example:

An example of uptodate with a JAR file:

  <target name="depcheckProjectJar" >
    Checks if generated Project jar file is up to date, with compiled *.class

    	<!-- Check if generated jar file is up to date with .class files -->
    <uptodate property="Project.jarbuild.isnotrequired">

      <srcfiles dir="${ProjectPackageRoot}" includes="**/*.class"/>

	<mapper type="merge" to="${ProjectJarPath}" />



  <target name="jarNetmaps" depends="depcheckNetmapsJar, compileNetmaps">

    Creates Netmaps jar file.
   <if> <not> <isset property="Project.jarbuild.isnotrequired" /> </not>

    <echo> Deleting then building jar file: ${ProjectJarPath} </echo>

    <!-- quiet=true to allow build to continue if file doesn't exist -->
    <delete file="${ProjectJarPath}" quiet="true"/>

    <jar jarfile="${ProjectJarPath}" basedir="${ProjectPackageRoot}">
      <!--exclude all use Zipfileset to create proper jar-->
      <exclude name="**/*" />
      <!-- add package prefix because to make valid package -->
      <Zipfileset prefix="${ProjectPackageStructure}" dir="${ProjectPackageRoot}">
        <include name="**/*.class"/>
	<!-- include source for debugging, in future perhaps use conditional includeSource==true
switch -->
	<include name="**/*.java"/>
	<!-- Project Look and feel gif's -->
	<include name="**/*.gif" />
        <exclude name="**/bsm/**"/>



An example of dependency checks against IDL files:

  <target name="depcheckIDL" >

     Check if generated .java files are up to date with .idl
     if they are its not necessary to generate them.

    <uptodate property="idlgenerate.notrequired">
       <srcfiles dir="${PackageRoot}" includes="**/*Ifc/**/*.idl" excludes="**/bsm/**"/>

       <!-- All IDL's in Project at least generate a * so use this
            to check if the generated java is up to date with the corresponding
            idl file -->

       <mapper type="glob" from="*.idl" to="*"/>



  <target name="generateIDL" depends="depcheckIDL" unless="idlgenerate.notrequired">

    Generate JAVA files from IDL files.

    <echo message="----- IDL Compiliation beginning ------" />
<!-- iterate through IDL files compiling with OpenOrb IDL compiler -->

    <property name="IDLFiles" refid="ProjectIDLFiles" />

    <echo level="verbose" message="IDLFiles = ${IDLFiles}" />

    <foreach target="IDLCompiler" param="idl.file" parallel="false">
	<path refid="IDLFiles"/>


~ Doug Daniels

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message