You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Daniels, Doug" <Do...@GDC4S.Com> on 2004/01/29 23:02:20 UTC

Generating java files selectively from IDL files using a nd type glob

We have a bunch of IDL files that we use to generate java files and stubs.
I'm trying to to generate java files only when an IDL is updated, I've been
able to do a dependency check like this:

  <target name="depcheckIDL" unless="SkipDependencyCheck">
    	<!-- 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="${Src}" includes="**/*.idl"
excludes="**/test/**"/>
		 <mapper type="glob" from="*.idl" to="*Helper.java"/>
     	 </uptodate>
  </target>

This works fantastic, but the only problem is if even one of the IDL's are
updated the task that uses this check for, compiles ALL the IDL files. I
wish there was a way to directly use the <uptodate > task to retrieve the
files that aren't uptodate. I looked into this and there seems to be a
<depend> selector (
http://ant.apache.org/manual/CoreTypes/selectors.html#dependselect ) element
of the FileSet, that allows you to list a source and a target, and a mapper
to compare them and then return the files that need to be updated.

This is what I do to try and retrieve only the files that need updating:
   <path id="IDLFiles">
	<fileset id="IDLFileSet" dir="${PackageRoot}"
	includes="**/*.idl"
	excludes="**/test/**">
	<!-- get only the out of date .idl files -->
           <depend targetdir="${Src}" >
	     <mapper type="glob" from="*.idl" to="*Helper.java"/>
	   </depend>
	</fileset>
    </path>

It gives me a fileset with all the IDL files except for the ones in the test
directory, even after I update it. So the depcheckIDLFiles works fine but
the <depend> selector doesn't give me the newly modified *.idl files it
gives me everything. Maybe I'm using the selector wrong, can anyone give me
an idea of what to do?
  

Douglas Daniels

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org